示例#1
0
文件: xshear.py 项目: vargatn/xpipe
parser.add_argument("--ichunk", type=int, default=0)


if __name__ == '__main__':
    args = parser.parse_args()
    paths.update_params(args.params)

    xpath = parbins.get_dpath(paths.params, paths.dirpaths) + "/" +\
            paths.params["tag"] + "_xconfig.cfg"
    xwrap.write_xconf(xpath)

    flist, flist_jk, rlist, rlist_jk = parbins.get_file_lists(paths.params, paths.dirpaths)

    if not args.noclust:
        _alist = np.concatenate(flist_jk)
        alist = selector.partition(_alist, args.nchunk)[args.ichunk]

        clust_infos = xwrap.create_infodict(alist, head=args.head,
                                            pairs=args.nopairs, src_bins=paths.params["source_bins_to_use"],
                                            xconfig=xpath)
        xwrap.multi_xrun(clust_infos, nprocess=paths.params['nprocess'])


    if not args.norands:
        _blist = np.concatenate(rlist_jk)
        blist = selector.partition(_blist, args.nchunk)[args.ichunk]
        rands_infos = xwrap.create_infodict(blist, head=args.head,
                                            pairs=args.nopairs, src_bins=paths.params["source_bins_to_use"],
                                            xconfig=xpath)
        xwrap.multi_xrun(rands_infos, nprocess=paths.params['nprocess'])
示例#2
0
        seed_master=paths.params["seeds"]['shear_seed_master'])

    seeds_to_use = seed_rots
    if args.nchunk is not None and args.ichunk is not None:
        seeds_to_use = sl.partition(seed_rots, args.nchunk)
        seeds_to_use = seeds_to_use[args.ichunk]

    flist, flist_jk, rlist, rlist_jk = parbins.get_file_lists(
        paths.params, paths.dirpaths)

    xinroot = paths.dirpaths["xin"] + "/" + paths.params["tag"] + "/"
    cpos = read_pos(flist, xinroot)
    rpos = read_pos(rlist, xinroot)

    for s, seed in enumerate(seeds_to_use):
        clust_infos = xwrap.create_infodict(flist, seed=seed, rotate=True)
        rands_infos = xwrap.create_infodict(rlist, seed=seed, rotate=True)
        for i, (cinfo, rinfo) in enumerate(zip(clust_infos, rands_infos)):

            # postprocessing clusters
            clust_file = cinfo["outfile"]

            bin_tag = "_qbin" + clust_file.split("/")[-1].split(
                "qbin")[1].split("_")[0]
            jkname = paths.dirpaths["xin"] + "/" + paths.params["tag"] + "/" + paths.params["tag"] +\
                     "_jkcens" + bin_tag + ".dat"

            centers = np.loadtxt(jkname)
            ncens = len(centers)
            clust_labels = parbins.assign_jk_labels(cpos[i][:, 0],
                                                    cpos[i][:, 1], centers)[-1]
示例#3
0
            paths.params["tag"] + "_xconfig.cfg"

    flist, flist_jk, rlist, rlist_jk = parbins.get_file_lists(
        paths.params, paths.dirpaths)

    if args.metachunk == 0 or args.runall:
        print(xpath)
        xwrap.write_custom_xconf(xpath,
                                 xsettings=xwrap.get_main_source_settings())

        if not args.noclust:
            _alist = np.concatenate(flist_jk)
            alist = selector.partition(_alist, args.nchunk)[args.ichunk]
            clust_infos = xwrap.create_infodict(
                alist,
                head=args.head,
                pairs=args.nopairs,
                src_bins=paths.params["source_bins_to_use"],
                xconfig=xpath)

            xwrap.multi_xrun(clust_infos, nprocess=paths.params['nprocess'])

        if not args.norands:
            _blist = np.concatenate(rlist_jk)
            blist = selector.partition(_blist, args.nchunk)[args.ichunk]
            rands_infos = xwrap.create_infodict(
                blist,
                head=args.head,
                pairs=args.nopairs,
                src_bins=paths.params["source_bins_to_use"],
                xconfig=xpath)
            xwrap.multi_xrun(rands_infos, nprocess=paths.params['nprocess'])
示例#4
0

if __name__ == '__main__':
    args = parser.parse_args()
    paths.update_params(args.params)

    ccont = xwrap.get_calib_cont()

    clusts = []
    rands = []
    subtrs = []
    flist, flist_jk, rlist, rlist_jk = parbins.get_file_lists(paths.params, paths.dirpaths)
    for i, clust_name in enumerate(flist_jk):
        print("processing bin", i)

        clust_infos = xwrap.create_infodict(clust_name)
        clust_files = [info["outfile"] for info in clust_infos]

        bin_tag = clust_files[0].split("_" + paths.params["lens_prefix"])[1].split("_patch")[0]

        # metanames = None
        # if not args.nometa:
        #     metanames = xwrap.get_metanames(clust_files)
        clust = shearops.process_profile(clust_files, ismeta=args.nometa)

        resroot = paths.dirpaths["results"] + "/" +\
                  paths.params["tag"] + "/" + paths.params["tag"] + "_" + paths.params["lens_prefix"] + bin_tag
        write_profile(clust, resroot)

        ccont = xwrap.append_scrit_inv(ccont, clust)