Ejemplo n.º 1
0
def stack_coadd_export_cf(name, corr_dir, vers, zbins):

    #Check that the relevant directories are set up correctly.
    s_dir = corr_dir + '/stack/'
    submit_utils.check_dir(s_dir)
    sm_dir = s_dir + '/measurements/'
    submit_utils.check_dir(sm_dir)
    smt_dir = sm_dir + name + '/'
    submit_utils.check_dir(smt_dir)
    smtc_dir = smt_dir + '/correlations/'
    submit_utils.check_dir(smtc_dir)

    #Stack the measurements by concatenating subsamples.
    fiin = []
    for ver in vers:
        fin = corr_dir + '/' + ver + '/measurements/' + name + '/correlations/cf_{}.fits.gz'.format(
            name)
        fiin += [fin]
    fout = smtc_dir + '/cf_{}.fits.gz'.format(name)
    submit_utils.concatenate_subsamples(fiin, fout, 'cf')

    #Export the outfile.
    fout_exp = smtc_dir + '/cf_exp_{}.fits.gz'.format(name)
    command = 'picca_export.py --data {} --out {} --do-not-smooth-cov'.format(
        fout, fout_exp)
    retcode = call(command, shell=True)
    """
    in_files = ''
    for zbin in zbins:
        zbin_in_files = ''
        for in_dir in in_dirs:
            in_file = in_dir + '/cf_{}_{}_{}.fits.gz'.format(name,zbin[0],zbin[1])
            in_files += in_file + ' '
            zbin_in_files += in_file + ' '
        if args.export_individual_zbins:
            out_file = smtc_dir + '/cf_exp_{}_{}_{}.fits.gz'.format(name,zbin[0],zbin[1])
            command = 'picca_export_coadd_zint_co.py --data {} --out {} --no-dmat'.format(zbin_in_files,out_file)
            retcode = call(command,shell=True)
    out_file = smtc_dir + '/cf_exp_{}.fits.gz'.format(name)
    if coadd_only:
        coadd_only_out_file = smtc_dir + '/cf_{}.fits.gz'.format(name)
    else:
        coadd_only_out_file = None
    command='picca_export_coadd_zint.py --data {} --out {} --no-dmat --coadd-out {}'.format(in_files,out_file,coadd_only_out_file)
    retcode = call(command,shell=True)
    """

    return
Ejemplo n.º 2
0
                                              },
                                     },
                 }


################################################################################

njobs = 0
for v_rea in args.v_realisations:

    ver = 'v{}.{}.{}'.format(args.v_maj,args.v_min,v_rea)
    print('\nRunning analysis for version {}:'.format(ver))

    #Check that the directories are constructed properly.
    ac_dir = a_dir+'/correlation_functions/'
    submit_utils.check_dir(ac_dir)
    acv_dir = ac_dir+'/'+ver+'/'
    submit_utils.check_dir(acv_dir)
    acvm_dir = acv_dir+'/measurements/'
    submit_utils.check_dir(acvm_dir)

    #Define the location variables for this version.
    lya_deltas_loc = '{}/data/picca_input/{}/deltas_0.5/'.format(args.base_dir,ver)
    lya_aa_deltas_loc = '{}/data/picca_input/{}/deltas_0.5_Lyb_metals/'.format(args.base_dir,ver)
    zcat_qso_loc = '{}/data/picca_input/{}/zcat_0.5.fits'.format(args.base_dir,ver)
    zcat_dla_loc = '{}/data/picca_input/{}/zcat_DLA_0.5_lrmin1040.0_lrmax1200.0.fits'.format(args.base_dir,ver)
    zcat_qso_rand_loc = '{}/data/picca_input/{}/zcat_0.1_randoms.fits'.format(args.base_dir,ver)
    zcat_dla_rand_loc = '{}/data/picca_input/{}/zcat_DLA_0.1_randoms_lrmin1040.0_lrmax1200.0.fits'.format(args.base_dir,ver)

    for zbin in cf_zbins:
Ejemplo n.º 3
0
def stack_coadd_export_co(name, corr_dir, vers, zbins):

    s_dir = corr_dir + '/stack/'
    submit_utils.check_dir(s_dir)
    sm_dir = s_dir + '/measurements/'
    submit_utils.check_dir(sm_dir)
    smt_dir = sm_dir + name + '/'
    submit_utils.check_dir(smt_dir)
    smtc_dir = smt_dir + '/correlations/'
    submit_utils.check_dir(smtc_dir)

    #For the data and the randoms.
    fouts = {}
    for dt in ['DD', 'DR', 'RD', 'RR']:

        #Stack the measurements by concatenating subsamples.
        fiin = []
        for ver in vers:
            fin = corr_dir + '/' + ver + '/measurements/' + name + '/correlations/co_{}_{}.fits.gz'.format(
                name, dt)
            fiin += [fin]
        fout = smtc_dir + '/co_{}_{}.fits.gz'.format(name, dt)
        fouts[dt] = fout
        submit_utils.concatenate_subsamples(fiin, fout, 'co')

    #Export the outfile.
    fout_exp = smtc_dir + '/co_exp_{}.fits.gz'.format(name)
    command = 'picca_export_co.py --DD-file {} --DR-file {} --RD-file {} --RR-file {} --out {} --do-not-smooth-cov'.format(
        fouts['DD'], fouts['DR'], fouts['RD'], fouts['RR'], fout_exp)
    retcode = call(command, shell=True)
    """
    in_dirs = []
    for ver in vers:
        in_dir = corr_dir + '/' + ver + '/measurements/' + name + '/correlations/'
        in_dirs += [in_dir]

    DD_files = ''
    DR_files = ''
    RD_files = ''
    RR_files = ''
    for zbin in zbins:
        zbin_DD_files = ''
        zbin_DR_files = ''
        zbin_RD_files = ''
        zbin_RR_files = ''
        for in_dir in in_dirs:
            DD_file = in_dir + '/co_{}_DD_{}_{}.fits.gz'.format(name,zbin[0],zbin[1])
            DR_file = in_dir + '/co_{}_DR_{}_{}.fits.gz'.format(name,zbin[0],zbin[1])
            RD_file = in_dir + '/co_{}_RD_{}_{}.fits.gz'.format(name,zbin[0],zbin[1])
            RR_file = in_dir + '/co_{}_RR_{}_{}.fits.gz'.format(name,zbin[0],zbin[1])
            DD_files += DD_file + ' '
            DR_files += DR_file + ' '
            RD_files += RD_file + ' '
            RR_files += RR_file + ' '
            zbin_DD_files += DD_file + ' '
            zbin_DR_files += DR_file + ' '
            zbin_RD_files += RD_file + ' '
            zbin_RR_files += RR_file + ' '
        if args.export_individual_zbins:
            out_file = smtc_dir + '/co_exp_{}_{}_{}.fits.gz'.format(name,zbin[0],zbin[1])
            command = 'picca_export_coadd_zint_co.py --DD-files {} --DR-files {} --RD-files {} --RR-files {} --out {}'.format(zbin_DD_files,zbin_DR_files,zbin_RD_files,zbin_RR_files,out_file)
            retcode = call(command,shell=True)
    out_file = smtc_dir + '/co_exp_{}.fits.gz'.format(name)
    # TODO: implement the capability to coadd the unexported files.
    # Need to do so within picca first.
    command='picca_export_coadd_zint_co.py --DD-files {} --DR-files {} --RD-files {} --RR-files {} --out {}'.format(DD_files,DR_files,RD_files,RR_files,out_file)
    retcode = call(command,shell=True)
    """

    return
Ejemplo n.º 4
0
def stack_coadd_export_xcf(name, corr_dir, vers, zbins):

    s_dir = corr_dir + '/stack/'
    submit_utils.check_dir(s_dir)
    sm_dir = s_dir + '/measurements/'
    submit_utils.check_dir(sm_dir)
    smt_dir = sm_dir + name + '/'
    submit_utils.check_dir(smt_dir)
    smtc_dir = smt_dir + '/correlations/'
    submit_utils.check_dir(smtc_dir)

    #For the data and the randoms.
    fouts = {}
    for dt in ['D', 'R']:

        #Stack the measurements by concatenating subsamples.
        fiin = []
        for ver in vers:
            fin = corr_dir + '/' + ver + '/measurements/' + name + '/correlations/xcf_{}_{}.fits.gz'.format(
                name, dt)
            fiin += [fin]
        fout = smtc_dir + '/xcf_{}_{}.fits.gz'.format(name, dt)
        fouts[dt] = fout
        submit_utils.concatenate_subsamples(fiin, fout, 'xcf')

    #Export the outfile.
    fout_exp = smtc_dir + '/xcf_exp_{}.fits.gz'.format(name)
    command = 'picca_export.py --data {} --out {} --do-not-smooth-cov'.format(
        fouts['D'], fout_exp)
    retcode = call(command, shell=True)
    """
    in_dirs = []
    for ver in vers:
        in_dir = corr_dir + '/' + ver + '/measurements/' + name + '/correlations/'
        in_dirs += [in_dir]

    D_files = ''
    R_files = ''
    for zbin in zbins:
        zbin_D_files = ''
        zbin_R_files = ''
        for in_dir in in_dirs:
            D_file = in_dir + '/xcf_{}_D_{}_{}.fits.gz'.format(name,zbin[0],zbin[1])
            R_file = in_dir + '/xcf_{}_R_{}_{}.fits.gz'.format(name,zbin[0],zbin[1])
            D_files += D_file + ' '
            R_files += R_file + ' '
            zbin_D_files += D_file + ' '
            zbin_R_files += R_file + ' '
        if args.export_individual_zbins:
            out_file = smtc_dir + '/xcf_exp_{}_{}_{}.fits.gz'.format(name,zbin[0],zbin[1])
            command = 'picca_export_coadd_zint_co.py --data {} --out {} --no-dmat --remove-shuffled-correlation {}'.format(zbin_D_files,out_file,zbin_R_files)
            retcode = call(command,shell=True)
    out_file = smtc_dir + '/xcf_exp_{}.fits.gz'.format(name)
    if coadd_only:
        coadd_only_out_file = smtc_dir + '/xcf_{}.fits.gz'.format(name)
    else:
        coadd_only_out_file = None
    if coadd_only:
        coadd_only_randoms_out_file = smtc_dir + '/xcf_R_{}.fits.gz'.format(name)
    else:
        coadd_only_randoms_out_file = None
    command='picca_export_coadd_zint.py --data {} --out {} --no-dmat --remove-shuffled-correlation {} --coadd-out {} --coadd-out-shuffled {}'.format(D_files,out_file,R_files,coadd_only_out_file,coadd_only_randoms_out_file)
    retcode = call(command,shell=True)
    """

    return