Exemple #1
0
if __name__ == '__main__':

    # ->> initialization <<- #
    sec = 'Rect'
    init_dict = myDict(param_dict) + myDict(prog_control)
    p = pc.prog_init(section=sec, **init_dict)
    p.smooth_R = p.smooth_r

    root = p.folder
    ''' ->> import data <<- '''
    print 'likelihood fname:', p.likelihood_test_fname
    z_init = 100.

    # ->> import testing data <<- #
    dd=rd.rblock(p.likelihood_test_fname, p.ngrid**3*7, \
              dtype='float').reshape(7,p.ngrid,p.ngrid,p.ngrid)
    #disp, disp_model = dd[:3,...], dd[3:,...]
    bd = 10
    disp, disp_model = dd[:3, bd:-bd, bd:-bd, bd:-bd], dd[3:, bd:-bd, bd:-bd,
                                                          bd:-bd],

    di = dd[-1, ...]

    #
    print 'mean:', disp.min(), disp_model.min()

    #->> final density <<- #
    df=rd.rblock(p.original_density_fname, p.ngrid**3, \
                 dtype='float').reshape(p.ngrid, p.ngrid, p.ngrid)

    # ->> define some other useful variables <<- #
Exemple #2
0
    init_dict = myDict(param_dict) + myDict(prog_control)
    p = pc.prog_init(section=sec, **init_dict)
    p.smooth_R = p.smooth_r

    root = p.folder

    # ->> import data <<- #
    if (p.py_import_density_field == True):

        if p.import_format == 'cita_simulation':
            p.rec_fname = p.reconstructed_fname + '_' + p.smooth_type + '_R' + str(
                p.smooth_R) + '.dat'
            print 'reading data ... ', p.rec_fname

            f_rec = rd.rblock(p.rec_fname, p.ngrid**3 * 3,
                              dtype='float').reshape(3, p.ngrid, p.ngrid,
                                                     p.ngrid)
            drec, d_disp, d_shift = f_rec

            d_ori = rd.rblock(p.original_density_fname,
                              p.ngrid**3,
                              dtype='float').reshape(p.ngrid, p.ngrid, p.ngrid)

            print 'density shape:', drec.shape, d_disp.shape, d_shift.shape, d_ori.shape
            print 'density min/max:', drec.min(), drec.max(), d_disp.min(
            ), d_disp.max(), d_shift.min(), d_shift.max()

        else:
            raise Exception

    # ->> power spectrum measurement <<- #
Exemple #3
0
}

if __name__ == '__main__':

    # ->> initialization <<- #
    sec = 'Rect'
    init_dict = myDict(param_dict) + myDict(prog_control)
    p = pc.prog_init(section=sec, **init_dict)
    p.smooth_R = p.smooth_r

    root = p.folder

    if (p.cal_rect_transfer_func == True):
        nblock = 6
        dd = rd.rblock(p.raw_disp_field_fname,
                       p.ngrid**3 * nblock,
                       dtype='float').reshape(nblock, p.ngrid, p.ngrid,
                                              p.ngrid)

        #->> discard boundary data <<- #
        bd = 5
        bsize = p.boxsize - 2. * bd * p.boxsize / float(p.ngrid)
        #bsize=p.boxsize
        print 'bsize:', bsize

        disp, disp_model = dd[:3, bd:-bd, bd:-bd, bd:-bd], dd[3:, bd:-bd,
                                                              bd:-bd, bd:-bd],
        #disp, disp_model = dd[:3], dd[3:]

        if True:
            nplt, ncol = 2, 2
            fig,ax=mpl.mysubplots(nplt,ncol_max=ncol,subp_size=5.,\
Exemple #4
0
        #->>  <<-#
        print len(pid), pid.min(), pid.max()

        ll = np.arange(len(pid)) + 1
        err = ll - pid

        print 'len of non-zeros: ', len(np.where(err != 0)[0])

    if do_displacement_test:
        #->>
        #fn_disp='/mnt/scratch-lustre/xwang/data/baorec/cubep3m_dm_sml_pid/rec_data/stat_disp_0_100.dat'
        fn_disp = '/mnt/scratch-lustre/xwang/data/baorec/cubep3m_dm_sml_pid/rec_data/disp_0_100.dat'
        nblock = 6
        dd = rd.rblock(fn_disp, p.ngrid**3 * nblock,
                       dtype='float').reshape(nblock, p.ngrid, p.ngrid,
                                              p.ngrid)
        print dd.shape

        disp, disp_lpt = dd[:3], dd[3:]

        for i in range(3):
            print 'disp :', i, disp[i].min(), disp[i].max()

        if True:
            # ->> 1D histogram <<- #
            nplt, ncol = 3, 2
            fig,ax=mpl.mysubplots(nplt,ncol_max=ncol,subp_size=5.,\
                                  gap_size=0.5,return_figure=True)
            n_bin = 500
            color = ['g', 'r', 'b', 'y']