aboutsummaryrefslogtreecommitdiffstats
path: root/astro/oskar
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-09-13 08:44:38 +0800
committerAaron LI <aly@aaronly.me>2017-09-13 08:44:38 +0800
commit4c6702d5ea1375e7524ce9182f734eb4f6485580 (patch)
tree86dd415ce8c2398d1d2f2321d04d3d96e6f2ba5e /astro/oskar
parent3d322b099ec2f62c112fe0328a634e5cc0223310 (diff)
downloadatoolbox-4c6702d5ea1375e7524ce9182f734eb4f6485580.tar.bz2
run_oskar.py: Print more information more beautiful
Diffstat (limited to 'astro/oskar')
-rwxr-xr-xastro/oskar/run_oskar.py30
1 files changed, 19 insertions, 11 deletions
diff --git a/astro/oskar/run_oskar.py b/astro/oskar/run_oskar.py
index 0eff069..8cbfab2 100755
--- a/astro/oskar/run_oskar.py
+++ b/astro/oskar/run_oskar.py
@@ -20,7 +20,8 @@ def run_oskar(configfile, model, freq, vis_oskar, vis_ms,
if vis_oskar is None and vis_ms is None:
raise ValueError("both 'vis_oskar' & 'vis_ms' are missing")
prog = "oskar_sim_interferometer"
- print("Update settings ...")
+
+ print("Update simulation settings ...")
for item, value in [
("sky/oskar_sky_model/file", model),
("telescope/input_directory", telescope),
@@ -29,7 +30,9 @@ def run_oskar(configfile, model, freq, vis_oskar, vis_ms,
("interferometer/ms_filename", vis_ms)]:
if value is not None:
subprocess.check_call([prog, "--set", configfile, item, value])
- print("Set '%s' -> '%s'" % (item, value))
+ print("Updated '%s' -> '%s'" % (item, value))
+
+ print("-------------------------------------------------------------")
print("Simulating %s @ %.2f [MHz] ..." % (model, freq))
cmd = [prog, configfile]
if dryrun:
@@ -39,7 +42,8 @@ def run_oskar(configfile, model, freq, vis_oskar, vis_ms,
t1 = time()
subprocess.check_call(cmd)
t2 = time()
- print("Elapsed time: %.1f [s]" % (t2-t1))
+ print("Elapsed time: %.1f [min]" % ((t2-t1)/60))
+ print("-------------------------------------------------------------")
def main():
@@ -80,14 +84,17 @@ def main():
if re.match(r"^(\s*$|\s*#)", line):
continue
freq, skyfile = line.strip().split()
- skymodels.append((float(freq), skyfile))
- print("Got sky model: %s @ %s [MHz]" % (skyfile, freq))
+ freq = float(freq)
+ skymodels.append((freq, skyfile))
+ print("Got sky model: %s @ %.2f [MHz]" % (skyfile, freq))
+
+ Nosm = len(skymodels)
+ print("Number of sky models: %d" % Nosm)
- for freq, skyfile in skymodels:
- print(">>>")
- print(">>> Frequency: %.2f [MHz]" % freq)
- print(">>> Sky model: %s" % skyfile)
- print(">>>")
+ for i, (freq, skyfile) in enumerate(skymodels):
+ print("=============================================================")
+ print("[%d/%d] %s @ %.2f [MHz]" % (i+1, Nosm, skyfile, freq))
+ print("-------------------------------------------------------------")
basename = os.path.splitext(os.path.basename(skyfile))[0]
if args.no_vis_oskar:
vis_oskar = ""
@@ -106,7 +113,8 @@ def main():
dryrun=args.dryrun)
t2 = time()
- print("Total elapsed time: %.1f [s]" % (t2-t1))
+ print("=============================================================")
+ print("Total elapsed time: %.1f [min]" % ((t2-t1)/60))
if __name__ == "__main__":