diff options
author | Aaron LI <aaronly.me@outlook.com> | 2017-02-14 23:55:57 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2017-02-17 01:16:46 +0800 |
commit | dcc755d679a70fb2dfd16140cd35961109a127fc (patch) | |
tree | 0fd09751d637d3902f491da2e0e982d013b59577 /scripts | |
parent | 513a63eaa53acf469e1234c4c0ae879bfb3fbf9f (diff) | |
download | chandra-acis-analysis-dcc755d679a70fb2dfd16140cd35961109a127fc.tar.bz2 |
Add get_manifest() and get_results() functions
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/manifest.py | 17 | ||||
-rwxr-xr-x | scripts/results.py | 17 |
2 files changed, 34 insertions, 0 deletions
diff --git a/scripts/manifest.py b/scripts/manifest.py index 74e737e..37bcda4 100755 --- a/scripts/manifest.py +++ b/scripts/manifest.py @@ -219,6 +219,23 @@ def find_manifest(filename="manifest.yaml"): raise FileNotFoundError("cannot found manifest file: %s" % filename) +def get_manifest(filename="manifest.yaml"): + """ + Find the manifest file and return the Manifest instance of it. + + Parameters + ---------- + filename : str, optional + Filename of the manifest file (default: ``manifest.yaml``) + + Returns + ------- + manifest : `~Manifest` + Manifest instance of the found manifest file. + """ + return Manifest(find_manifest(filename)) + + def cmd_show(args, manifest): """ Default sub-command "show": Show manifest contents. diff --git a/scripts/results.py b/scripts/results.py index 7536e2f..1bf504e 100755 --- a/scripts/results.py +++ b/scripts/results.py @@ -13,6 +13,23 @@ Manage the analysis results in YAML format. import manifest +def get_results(filename="results.yaml"): + """ + Find the results file and return the Manifest instance of it. + + Parameters + ---------- + filename : str, optional + Filename of the results file (default: ``results.yaml``) + + Returns + ------- + results : `~Manifest` + Manifest instance (i.e., results) of the found results file. + """ + return manifest.get_manifest(filename) + + def main(description="Manage the analysis results (YAML format)", default_file="results.yaml"): manifest.main(description=description, default_file=default_file) |