# ------------------------------------------------ # # Copyright (C) 2021 Alessandro Languasco # # ------------------------------------------------ import pandas as pd import numpy as np #import mpmath as mp #mp.dps = 38 pd.options.display.float_format = '{:.10f}'.format # functions needed to create the normalised values def f(x): #mp.dps = 38 #x1 = mp.mpmathify(x) #y = mp.log(x1) y= np.log(x) return y for r in range(1, 7): # iteration for r from 1 to 6 if r == 1: LvRfile = "outputs/LvR-r=1" Sqfile = "inputs/10^10-mergedS1qfile" Iqfile = "inputs/I1qfile" elif r == 2: LvRfile = "outputs/LvR-r=2" Sqfile = "inputs/10^10-mergedS2qfile" Iqfile = "inputs/I2qfile" elif r == 3: LvRfile = "outputs/LvR-r=3" Sqfile = "inputs/10^10-mergedS3qfile" Iqfile = "inputs/I3qfile" elif r == 4: LvRfile = "outputs/LvR-r=4" Sqfile = "inputs/10^10-mergedS4qfile" Iqfile = "inputs/I4qfile" elif r == 5: LvRfile = "outputs/LvR-r=5" Sqfile = "inputs/10^10-mergedS5qfile" Iqfile = "inputs/I5qfile" elif r == 6: LvRfile = "outputs/LvR-r=6" Sqfile = "inputs/10^10-mergedS6qfile" Iqfile = "inputs/I6qfile" print('---------------') print(' Case r = ', r) # input data from csv files data=pd.read_csv(f'{Sqfile}.csv', sep=';',dtype='str') data.head(4) dfSr = pd.DataFrame(data, columns= ['q','r','Sr','errSr']) dfSr = dfSr.astype('float128') #print(dfSr) data=pd.read_csv(f'{Iqfile}.csv', sep=';',dtype='str') data.head(6) dfgamma = pd.DataFrame(data, columns= ['q','gammaKr','gammaK2r','gammaKcomb','Ir','Irprime']) dfgamma = dfgamma.astype('float128') #print(dfgamma) # remove the redundant columns q, gammaKcomb from dfgamma del dfgamma['q'] #del dfgamma['gammaKr'] #del dfgamma['gammaK2r'] del dfgamma['gammaKcomb'] #print(dfgamma) dftotal=dfSr.join(dfgamma) #append dfgamma to dfSr dftotal = dftotal.astype('float128') # just to be sure ... dftotal['q'] = dftotal['q'].astype('int') # convert q to int dftotal['r'] = dftotal['r'].astype('int') # convert r to int #create gammakq for this r dftotal['gammakqinf'] = (dftotal['Ir'] + dftotal['Sr'] - dftotal['errSr']) # lower bound dftotal['gammakqsup'] = (dftotal['Ir'] + dftotal['Sr'] + dftotal['errSr']) # upper bound # and the winner is ... dftotal['Winner'] = np.where(dftotal['gammakqsup'] < 0.5, 'Ramanujan', 'Landau') #create gammaprimekq for this r dftotal['gammaprimekqinf'] = (dftotal['Irprime'] + dftotal['Sr'] - dftotal['errSr']) # lower bound dftotal['gammaprimekqsup'] = (dftotal['Irprime'] + dftotal['Sr'] + dftotal['errSr']) # upper bound # and the winnerprime is ... dftotal['Winnerprime'] = np.where(dftotal['gammaprimekqsup'] < 0.5, 'Ramanujan', 'Landau') # repeat the q coulmn to improve readability dftotal['q-again'] = dftotal['q'] #print(dftotal) # save the result on a csv file dftotal.to_csv (f'{LvRfile}.csv', sep=';', index = False, header=True) # deleting results for this particular case del dftotal del dfSr del dfgamma # endfor (end iteration over r) print('---------------') print(' ***** End analysis script *****')