diff options
author | tlatorre <tlatorre@uchicago.edu> | 2019-05-24 17:27:50 -0400 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2019-05-24 17:27:50 -0400 |
commit | de22ebaf5cf3f3537b8cf987868b655b04b489d5 (patch) | |
tree | 6607930992d847f513144c39e29a3f434e198fb2 /utils | |
parent | 5501e48bf68cd2455767675fdde21afad7f73039 (diff) | |
download | sddm-de22ebaf5cf3f3537b8cf987868b655b04b489d5.tar.gz sddm-de22ebaf5cf3f3537b8cf987868b655b04b489d5.tar.bz2 sddm-de22ebaf5cf3f3537b8cf987868b655b04b489d5.zip |
add a script to concatenate output from grid jobs
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/cat-grid-jobs | 42 | ||||
-rwxr-xr-x | utils/submit-grid-jobs | 6 |
2 files changed, 47 insertions, 1 deletions
diff --git a/utils/cat-grid-jobs b/utils/cat-grid-jobs new file mode 100755 index 0000000..d43dfad --- /dev/null +++ b/utils/cat-grid-jobs @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# Copyright (c) 2019, Anthony Latorre <tlatorre at uchicago> +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program. If not, see <https://www.gnu.org/licenses/>. + +from __future__ import print_function, division +import yaml + +if __name__ == '__main__': + import argparse + import matplotlib.pyplot as plt + import numpy as np + + parser = argparse.ArgumentParser("plot fit results") + parser.add_argument("filenames", nargs='+', help="input files") + args = parser.parse_args() + + cat = [] + + for filename in args.filenames: + with open(filename) as f: + data = yaml.load(f.read()) + + if data is None: + continue + + for event in data['data']: + if event['ev'] is not None: + cat.append(event) + + print(yaml.dump({'data':cat},default_flow_style=False)) diff --git a/utils/submit-grid-jobs b/utils/submit-grid-jobs index 18c6e37..8aef916 100755 --- a/utils/submit-grid-jobs +++ b/utils/submit-grid-jobs @@ -110,10 +110,14 @@ if __name__ == '__main__': parser.add_argument("--dqxx-dir", type=str, help="dqxx directory", required=True) parser.add_argument("--min-nhit", type=int, help="minimum nhit to fit an event", default=100) parser.add_argument("--max-particles", type=int, help="maximum number of particles to fit for", default=3) + parser.add_argument("--skip-second-event", action='store_true', help="only fit the first event after a MAST bank", default=False) args = parser.parse_args() for filename in args.filenames: - output = check_output([join(args.dir,"zdab-cat"),filename]) + if args.skip_second_event: + output = check_output([join(args.dir,"zdab-cat"),"--skip-second-event",filename]) + else: + output = check_output([join(args.dir,"zdab-cat"),filename]) data = yaml.load(output) for i, event in enumerate(data['data']): |