def call_wrap2(p, mmax=1e6, fc=0.05, x=None, y=None, err=None, fjac=None, more_out=False): #print mmax #print fc print p #print shape(p) nfake = 10 fall_cpp_wrapper(t0 = p[0], t1=p[0]+p[1], mmax = mmax, f_c=fc,\ mmin=10.**p[2], cmfslope = p[3], age_slope = p[4], \ grid_out = 'bast.dat') out, table = sfrl1_parse('bast.dat') qq = data2q(data_xind, data_yind, out, table) #print qq D, p = kstest(qq, 'uniform') print [1-p, D] print '------' status = 0 #return [status, (1-p)*ones(nfake)] if more_out == True: var_rat = std(qq)**2*12 mean_dat = mean(qq) return [D, p, var_rat, mean_dat] return [status, D*ones(nfake)]
## for Palatino and other serif fonts use: #rc('font',**{'family':'serif','serif':['Palatino']}) rc('text', usetex=True) sfr=[-2, -3, -1] files=["re_sfrm2.txt", "re_sfrm3.txt","re_sfrm1.txt"] i=0 #the same for all sfrs fcs = 1e6*np.log(100)/(1e9-1e7) print "f_c" print fcs #fcs2 = fcs*1611.81/qpow(100,1e9, -2., 0.6) #multilpy by 6 looks good fcw.fall_cpp_wrapper(t0=0, t1=0.01, age_slope=-0.99,\ obs_err=0.01, f_c=fcs, grid_out="slug_comp_rere.dat",\ length=1e9,\ sfr_err=0.01, step=0.125/4, mmin=100, mmax=1e5) #fcw.fall_cpp_wrapper(t0=0, t1=0.01, age_slope=-0.99,\ # obs_err=0.01, f_c=fcs, grid_out="slug_comp2.dat",\ # length=1e8,\ # gamma_min = 2.438e19, sfr_err=0.01, step=0.125/4) #fcs2 = 1e6*np.log(1000)/(1e9-1e8) #fcw.fall_cpp_wrapper(t0=0, t1=0.01, age_slope=-0.99,\ # obs_err=0.01, f_c=fcs2, grid_out="slug_comp.dat",\ ## length=1e9,\ # sfr_err=0.01, step=0.125/4) out,table = p.sfrl1_parse('slug_comp_rere.dat') #out2,table2 = p.sfrl1_parse('slug_comp_rere.dat')
rc('text', usetex=True) sfr = [-2, -3, -1] files = ["sfrm2.txt", "sfrm3.txt", "sfrm1.txt"] i = 0 #the same for all sfrs fcs = 1e6 * np.log(100) / (1e9 - 1e7) #fcs2 = fcs*1611.81/qpow(100,1e9, -2., 0.6) #multilpy by 6 looks good #fcw.fall_cpp_wrapper(t0=0, t1=0.01, age_slope=-0.99,\ # obs_err=0.01, f_c=fcs2, grid_out="slug_comp.dat",\ # length=1e8,\ # gamma_min = 2.438e19, sfr_err=0.01, step=0.125/4) fcw.fall_cpp_wrapper(t0=0, t1=0.01, age_slope=-0.99,\ obs_err=0.01, f_c=fcs, grid_out="slug_comp_cut.dat",\ length=1e9,\ sfr_err=0.01, step=0.125/4, mmax=1e9, mmin=100) #fcs2 = 1e6*np.log(1000)/(1e9-1e8) #fcw.fall_cpp_wrapper(t0=0, t1=0.01, age_slope=-0.99,\ # obs_err=0.01, f_c=fcs2, grid_out="slug_comp.dat",\ ## length=1e9,\ # sfr_err=0.01, step=0.125/4) out, table = p.sfrl1_parse('slug_comp_cut.dat') #out2,table2 = p.sfrl1_parse('slug_comp2.dat') #get names of tags #out.dtype.names sfrs = out.sfr_x x = out.x
import fall_cpp_wrapper as fcw import numpy as np import parse as p import matplotlib.pyplot as plt from matplotlib import rc def qpow(min1, max1, slope, q): return (q*(max1**(slope+1) - min1**(slope+1)) + min1**(slope+1))**(1./(slope+1)) rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) ## for Palatino and other serif fonts use: #rc('font',**{'family':'serif','serif':['Palatino']}) rc('text', usetex=True) fcw.fall_cpp_wrapper(t0=0, t1=1.0, age_slope=-0.9,\ obs_err=0.005, f_c=0.01, grid_out="slug_comp.dat",\ length=1e8,mmin=500, mmax=1e9,\ gamma_min = 2.438e19, sfr_err=0.005, step=0.125/4) out,table = p.sfrl1_parse('slug_comp.dat') mcdata = open("/Users/rdasilva/Dropbox/sfr_l1_plots/montecarlo/mctest.txt",'r') mcdata = mcdata.read().split("\n")[0:-1] mcdata = np.array(mcdata).astype(float) mcdata=mcdata[mcdata<-3] #get names of tags #out.dtype.names sfrs = out.sfr_x x = out.x #get the sfr closest to \log sfr = -1 index = np.argmin(abs(out.sfr_x -(-1)))
#the same for all sfrs fcs = 1e6 * np.log(10) / (1e8 - 1e7) #fcs2 = fcs*1611.81/qpow(100,1e9, -2., 0.6) #multilpy by 6 looks good #fcw.fall_cpp_wrapper(t0=0, t1=0.01, age_slope=-0.99,\ # obs_err=0.01, f_c=fcs, grid_out="slug_comp_rere.dat",\ # length=1e9,\ # sfr_err=0.01, step=0.125/4, mmin=100, mmax=1e9) #afcw.fall_cpp_wrapper(t0=0, t1=0.01, age_slope=-0.99,\ ## obs_err=0.01, f_c=fcs2, grid_out="slug_comp.dat",\ # length=1e9, mmin=100,mmax=1e9\ # sfr_err=0.01, step=0.125/4) fcw.fall_cpp_wrapper(t0=0, t1=0.01, age_slope=-0.99,\ obs_err=0.01, f_c=fcs, grid_out="slug_comp.dat",\ length=1e8,\ gamma_min = 2.438e19, sfr_err=0.01, step=0.125/4) #fcs2 = 1e6*np.log(1000)/(1e9-1e8) #fcw.fall_cpp_wrapper(t0=0, t1=0.01, age_slope=-0.99,\ # obs_err=0.01, f_c=fcs2, grid_out="slug_comp.dat",\ ## length=1e9,\ # sfr_err=0.01, step=0.125/4) out, table = p.sfrl1_parse('slug_comp.dat') #out2,table2 = p.sfrl1_parse('slug_comp2.dat') #get names of tags #out.dtype.names sfrs = out.sfr_x x = out.x
fcs = 1e6*np.log(10)/(1e8-1e7) #fcs2 = fcs*1611.81/qpow(100,1e9, -2., 0.6) #multilpy by 6 looks good #fcw.fall_cpp_wrapper(t0=0, t1=0.01, age_slope=-0.99,\ # obs_err=0.01, f_c=fcs, grid_out="slug_comp_rere.dat",\ # length=1e9,\ # sfr_err=0.01, step=0.125/4, mmin=100, mmax=1e9) #afcw.fall_cpp_wrapper(t0=0, t1=0.01, age_slope=-0.99,\ ## obs_err=0.01, f_c=fcs2, grid_out="slug_comp.dat",\ # length=1e9, mmin=100,mmax=1e9\ # sfr_err=0.01, step=0.125/4) fcw.fall_cpp_wrapper(t0=0, t1=0.01, age_slope=-0.99,\ obs_err=0.01, f_c=fcs, grid_out="slug_comp.dat",\ length=1e8,\ gamma_min = 2.438e19, sfr_err=0.01, step=0.125/4) #fcs2 = 1e6*np.log(1000)/(1e9-1e8) #fcw.fall_cpp_wrapper(t0=0, t1=0.01, age_slope=-0.99,\ # obs_err=0.01, f_c=fcs2, grid_out="slug_comp.dat",\ ## length=1e9,\ # sfr_err=0.01, step=0.125/4) out,table = p.sfrl1_parse('slug_comp.dat') #out2,table2 = p.sfrl1_parse('slug_comp2.dat') #get names of tags #out.dtype.names sfrs = out.sfr_x x = out.x