if logspace: fraction = np.logspace(np.log10(pmin),np.log10(pmax),numstep) order = 2 else: fraction = np.linspace(pmin,pmax,numstep) order = 3 testRange[testParam]=abs(fraction*fparams[testParam]) # round the value to about 'order' significant digits decimal = int(-(np.ceil(np.log10(testRange[testParam][0]))-order)) testRange[testParam] = [round(x,decimal) for x in testRange[testParam]] print testRange ''' # FISHER data = np.zeros([1, (1 + len(paramList))]) dClsRoot = {} dClsRoot[testParam] = output + '_' + testParam + '_' + str(testVal) F = FisherForecast(IniFile, dClsRoot=dClsRoot) F.calcFisher(verbose=True) j = 0 data[0, j] = testVal j += 1 for paramName in paramList: data[0, j] = F.margSigma(paramName) j += 1 postfix = '_LCDM+mnu_S4_' np.savetxt(output + '_' + testParam + postfix + 'part' + str(index) + '.csv', data, delimiter=",")
testRange = {} for (key, val) in config.items('testmnu'): pmin,pmax,numstep = [float(x) for x in val.split(',')] pcenter = fparams[key] mstep = (pcenter-pmin)/(numstep/2) pstep = (pmax-pcenter)/(numstep/2) testRange[key] = np.append(np.arange(pmin,pcenter,mstep),np.arange(pcenter,pmax+pstep/2,pstep)) # round the value to about 5 significant digits decimal = int(-(np.ceil(np.log10(pmin))-5)) testRange[key] = [round(x,decimal) for x in testRange[key]] print testParam,testRange[testParam] # FISHER data = np.zeros([len(testRange[testParam]),(1+len(paramList))]) i = 0 for testVal in testRange[testParam]: prefix = testParam+'_'+str(testVal) F = FisherForecast(IniFile,prefix=prefix) F.calcFisher(verbose = True) j = 0 data[i,j]= testVal j += 1 for paramName in paramList: data[i,j] = F.margSigma(paramName) j += 1 i+=1 np.savetxt(output+'_'+testParam+'.csv',data,delimiter=",") #np.savetxt(os.environ['FISHER_DIR']+"/output/June3_testfid_mnu_"+testParam+".csv",mnudata,delimiter=",") #np.savetxt(os.environ['FISHER_DIR']+"/output/June3_testfid_H0_"+testParam+".csv",H0data,delimiter=",")
def main(argv): try: iniFile = argv[0] except: iniFile = os.environ['FISHER_DIR'] + "/input/testmnu_driver.ini" finiFile = os.environ[ 'FISHER_DIR'] + '/input/cluster-submit/testmnu_input.ini' # Read Config fConfig = ConfigParser.SafeConfigParser() fConfig.optionxform = str fConfig.read(finiFile) #paramList = [] #stepSizes = {} fparams = {} for (key, val) in fConfig.items('camb'): if ',' in val: param, step = val.split(',') #paramList.append(key) fparams[key] = float(param) #stepSizes[key]=float(step) Config = ConfigParser.SafeConfigParser() Config.optionxform = str Config.read(iniFile) testRange = {} testList = [] for (key, val) in Config.items('testmnu'): if key == 'include': continue pmin, pmax, numstep = [float(x) for x in val.split(',')] testList.append(key) pcenter = fparams[key] mstep = (pcenter - pmin) / (numstep / 2) pstep = (pmax - pcenter) / (numstep / 2) testRange[key] = np.append(np.arange(pmin, pcenter, mstep), np.arange(pcenter, pmax + pstep / 2, pstep)) # round the value to about 5 significant digits decimal = int(-(np.ceil(np.log10(pmin)) - 5)) testRange[key] = [round(x, decimal) for x in testRange[key]] print key, testRange[key] for testParam in testList: print "Testing sigma vs. fiducial ", testParam mnudata = np.zeros([len(testRange[testParam]), 2]) H0data = np.zeros([len(testRange[testParam]), 2]) i = 0 for testVal in testRange[testParam]: print testParam, " = ", testVal ''' if (abs(fraction-1.0)<1e-10): prefix = '100.0' else: prefix = str(fraction*100)+testParam ''' prefix = testParam + '_' + str(testVal) F = FisherForecast(iniFile, prefix) F.calcFisher(verbose=True) sigmamnu = 1.e3 * F.margSigma("mnu") sigmaH0 = F.margSigma("H0") #print "sigma_mnu = ",'{:3.0f}'.format(sigma), " meV for ",testParam," = ",testVal mnudata[i, 0] = testVal H0data[i, 0] = testVal mnudata[i, 1] = sigmamnu H0data[i, 1] = sigmaH0 i += 1 np.savetxt(os.environ['FISHER_DIR'] + "/output/June3_testfid_mnu_" + testParam + ".csv", mnudata, delimiter=",") np.savetxt(os.environ['FISHER_DIR'] + "/output/June3_testfid_H0_" + testParam + ".csv", H0data, delimiter=",") '''
def main(argv): try: iniFile = argv[0] except: iniFile = os.environ['FISHER_DIR']+"/input/testmnu_driver.ini" finiFile = os.environ['FISHER_DIR']+'/input/cluster-submit/testmnu_input.ini' # Read Config fConfig = ConfigParser.SafeConfigParser() fConfig.optionxform = str fConfig.read(finiFile) #paramList = [] #stepSizes = {} fparams = {} for (key, val) in fConfig.items('camb'): if ',' in val: param,step = val.split(',') #paramList.append(key) fparams[key]=float(param) #stepSizes[key]=float(step) Config = ConfigParser.SafeConfigParser() Config.optionxform = str Config.read(iniFile) testRange = {} testList = [] for (key, val) in Config.items('testmnu'): if key == 'include': continue pmin,pmax,numstep = [float(x) for x in val.split(',')] testList.append(key) pcenter = fparams[key] mstep = (pcenter-pmin)/(numstep/2) pstep = (pmax-pcenter)/(numstep/2) testRange[key] = np.append(np.arange(pmin,pcenter,mstep),np.arange(pcenter,pmax+pstep/2,pstep)) # round the value to about 5 significant digits decimal = int(-(np.ceil(np.log10(pmin))-5)) testRange[key] = [round(x,decimal) for x in testRange[key]] print key,testRange[key] for testParam in testList: print "Testing sigma vs. fiducial ",testParam mnudata = np.zeros([len(testRange[testParam]),2]) H0data = np.zeros([len(testRange[testParam]),2]) i=0 for testVal in testRange[testParam]: print testParam," = ",testVal ''' if (abs(fraction-1.0)<1e-10): prefix = '100.0' else: prefix = str(fraction*100)+testParam ''' prefix = testParam+'_'+str(testVal) F = FisherForecast(iniFile,prefix) F.calcFisher(verbose = True) sigmamnu = 1.e3*F.margSigma("mnu") sigmaH0 = F.margSigma("H0") #print "sigma_mnu = ",'{:3.0f}'.format(sigma), " meV for ",testParam," = ",testVal mnudata[i,0] = testVal H0data[i,0] = testVal mnudata[i,1] = sigmamnu H0data[i,1] = sigmaH0 i+=1 np.savetxt(os.environ['FISHER_DIR']+"/output/June3_testfid_mnu_"+testParam+".csv",mnudata,delimiter=",") np.savetxt(os.environ['FISHER_DIR']+"/output/June3_testfid_H0_"+testParam+".csv",H0data,delimiter=",") '''
for (key, val) in config.items('testmnu'): pmin, pmax, numstep = [float(x) for x in val.split(',')] pcenter = fparams[key] mstep = (pcenter - pmin) / (numstep / 2) pstep = (pmax - pcenter) / (numstep / 2) testRange[key] = np.append(np.arange(pmin, pcenter, mstep), np.arange(pcenter, pmax + pstep / 2, pstep)) # round the value to about 5 significant digits decimal = int(-(np.ceil(np.log10(pmin)) - 5)) testRange[key] = [round(x, decimal) for x in testRange[key]] print testParam, testRange[testParam] # FISHER data = np.zeros([len(testRange[testParam]), (1 + len(paramList))]) i = 0 for testVal in testRange[testParam]: prefix = testParam + '_' + str(testVal) F = FisherForecast(IniFile, prefix=prefix) F.calcFisher(verbose=True) j = 0 data[i, j] = testVal j += 1 for paramName in paramList: data[i, j] = F.margSigma(paramName) j += 1 i += 1 np.savetxt(output + '_' + testParam + '.csv', data, delimiter=",") #np.savetxt(os.environ['FISHER_DIR']+"/output/June3_testfid_mnu_"+testParam+".csv",mnudata,delimiter=",") #np.savetxt(os.environ['FISHER_DIR']+"/output/June3_testfid_H0_"+testParam+".csv",H0data,delimiter=",")