diff options
author | Aaron LI <aaronly.me@outlook.com> | 2016-07-13 11:47:31 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2016-07-13 11:47:31 +0800 |
commit | d5896c15cbdc06a641ea21a6d59cb7750830a2de (patch) | |
tree | ece49642cf525e88500159e4c9d83cc2c561067b /make_sbpdeproj_config.py | |
parent | 088d8bb533371ee41eb7fa9c41d7efe8ac0ce3c1 (diff) | |
download | cexcess-d5896c15cbdc06a641ea21a6d59cb7750830a2de.tar.bz2 |
Add make_overdensity_config.py and make_sbpdeproj_config.py
Diffstat (limited to 'make_sbpdeproj_config.py')
-rwxr-xr-x | make_sbpdeproj_config.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/make_sbpdeproj_config.py b/make_sbpdeproj_config.py new file mode 100755 index 0000000..ab4844f --- /dev/null +++ b/make_sbpdeproj_config.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +# +# Make the configuration file for `deproject_sbp.py` +# +# Aaron LI +# Created: 2016-07-13 +# Updated: 2016-07-13 +# + +import glob +import argparse + +from info import get_redshift + + +sample_config = """ +## Configuration file for `deproject_sbp.py` + +# redshift of the object (for pixel to distance conversion) +redshift = %(redshift).6f + +## SBP extrapolation +# cut radius from which the SBP is fitted for extrapolation, +# specified by the ratio w.r.t sbpfit rc (default: 1.2 * rc) +sbpexp_rignore_ratio = 1.2 +# or directly specify the ignorance radius (override above) (unit: pixel) +#sbpexp_rignore = <RIGNORE> +# cut radius to which stop the extrapolation (unit: kpc) +sbpexp_rcut = 3000 +""" + + +def make_config(info): + cfg_data = { + "redshift": get_redshift(info), + } + cfg = sample_config % cfg_data + return cfg + + +def main(): + parser = argparse.ArgumentParser( + description="Make the config for 'deproject_sbp.py'") + parser.add_argument("-j", "--json", dest="json", required=False, + help="the *_INFO.json file " + + "(default: find ../*_INFO.json)") + parser.add_argument("outfile", nargs="?", default="sbpdeproj.conf", + help="filename of the output config " + + "(default: sbpdeproj.conf)") + args = parser.parse_args() + + # default "*_INFO.json" + info_json = glob.glob("../*_INFO.json")[0] + if args.json: + info_json = args.json + + config = make_config(info_json) + open(args.outfile, "w").write(config) + + +if __name__ == "__main__": + main() |