예제 #1
0
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)]
예제 #2
0
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')

#get names of tags
#out.dtype.names
sfrs = out.sfr_x
x = out.x
#get the sfr closest to \log sfr = -2
for i in xrange(3):
    index = np.argmin(abs(out.sfr_x -sfr[i]))
    this_pdf = table[index]
    #this_pdf2 = table2[index]
    print sfrs[index]
   
 #   plt.plot(p.ln2mv(x), p.ln2mvpdf(this_pdf2), lw=3, color=(1.,0.5,0.5), label='Uncorrected')
    plt.plot(p.ln2mv(x), p.ln2mvpdf(this_pdf), lw=3, color='blue', label="CLOC")
예제 #3
0
        (0.14, -9.7),\
        (0.24, -11.0),\
        (0.52, -10.1),\
        (0.63, -11.9),\
        (2.7, -13.0),\
        (0.78, -11.8),\
        (0.18, -9.1),\
        (0.077, -9.7),\
        (0.2,-11.3),\
        (0.78, -11.2),\
        (0.31, -10.9),\
        (0.054,-14.0))
log_sfr = array([log10(data[i][0]) for i in xrange(len(data))] )
lnMV = mv2ln(array([data[i][1] for i in xrange(len(data))] ))

out, table = sfrl1_parse('grid.dat')

#data_xind = array([min(enumerate(abs(log_sfr[i] - out.sfr_x)), key=itemgetter(1))[0] \
#                   for i in xrange(len(log_sfr)])
#data_yind = array([min(enumerate(abs(lnMV[i] - out.x)), key=itemgetter(1))[0] \
#                   for i in xrange(len(MV)])


data_xind = array( [argmin(abs(log_sfr[i] - out.sfr_x)) for i in xrange(len(log_sfr))])

#data_yind = array( [argmin(abs(lnMV[i] - out.x)) for i in xrange(len(log_sfr))])
data_yind = lnMV

def data2q(dat_sfr_ind, dat_mv_ind, tab_out, tab_tab):
    '''use data and model to compute quantile plot'''
    q = zeros(len(dat_mv_ind))
예제 #4
0
#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
#get the sfr closest to \log sfr = -2
for i in xrange(3):
    index = np.argmin(abs(out.sfr_x - sfr[i]))
    this_pdf = table[index]
    #this_pdf2 = table2[index]
    print sfrs[index]

    plt.plot(p.ln2mv(x),
             p.ln2mvpdf(this_pdf),
예제 #5
0
#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
#get the sfr closest to \log sfr = -2
for i in xrange(3):
    index = np.argmin(abs(out.sfr_x -sfr[i]))
    this_pdf = table[index]
    #this_pdf2 = table2[index]
    print sfrs[index]
   
    plt.plot(p.ln2mv(x), p.ln2mvpdf(this_pdf), lw=3, color='blue', label='CLOC')
    #plt.plot(p.ln2mv(x), p.ln2mvpdf(this_pdf), lw=3, color='blue', label="Corrected")
예제 #6
0
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')

#get names of tags
#out.dtype.names
sfrs = out.sfr_x
x = out.x
#get the sfr closest to \log sfr = -2
for i in xrange(3):
    index = np.argmin(abs(out.sfr_x - sfr[i]))
    this_pdf = table[index]
    #this_pdf2 = table2[index]
    print sfrs[index]

    #   plt.plot(p.ln2mv(x), p.ln2mvpdf(this_pdf2), lw=3, color=(1.,0.5,0.5), label='Uncorrected')
    plt.plot(p.ln2mv(x),