summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-07-13 11:47:31 +0800
committerAaron LI <aaronly.me@outlook.com>2016-07-13 11:47:31 +0800
commitd5896c15cbdc06a641ea21a6d59cb7750830a2de (patch)
treeece49642cf525e88500159e4c9d83cc2c561067b
parent088d8bb533371ee41eb7fa9c41d7efe8ac0ce3c1 (diff)
downloadcexcess-d5896c15cbdc06a641ea21a6d59cb7750830a2de.tar.bz2
Add make_overdensity_config.py and make_sbpdeproj_config.py
-rwxr-xr-xmake_overdensity_config.py53
-rwxr-xr-xmake_sbpdeproj_config.py62
2 files changed, 115 insertions, 0 deletions
diff --git a/make_overdensity_config.py b/make_overdensity_config.py
new file mode 100755
index 0000000..7ff0a2f
--- /dev/null
+++ b/make_overdensity_config.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python3
+#
+# Make the configuration file for `calc_overdensity.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 `calc_overdensity.py`
+
+# redshift of the source (critical density)
+redshift = %(redshift).6f
+"""
+
+
+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 'calc_overdensity.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="overdensity.conf",
+ help="filename of the output overdensity config " +
+ "(default: overdensity.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()
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()