aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2020-05-12 14:01:47 -0500
committertlatorre <tlatorre@uchicago.edu>2020-05-12 14:01:47 -0500
commit28777814e8c2341d3f1349c7df988fb9316134c7 (patch)
tree064d39c121a248138f57a8280a4284a720b2af3d
parent764bf1b496de0d3d3a22b988a0634ea68434bb26 (diff)
downloadsddm-28777814e8c2341d3f1349c7df988fb9316134c7.tar.gz
sddm-28777814e8c2341d3f1349c7df988fb9316134c7.tar.bz2
sddm-28777814e8c2341d3f1349c7df988fb9316134c7.zip
add a read_hdf() method that doesn't require pytables
-rw-r--r--utils/sddm/__init__.py11
-rwxr-xr-xutils/submit-grid-jobs8
2 files changed, 17 insertions, 2 deletions
diff --git a/utils/sddm/__init__.py b/utils/sddm/__init__.py
index 1f926df..d3a1be4 100644
--- a/utils/sddm/__init__.py
+++ b/utils/sddm/__init__.py
@@ -2,6 +2,8 @@ from __future__ import print_function, division
import sys
from itertools import izip_longest
import os
+import h5py
+import pandas as pd
IDP_E_MINUS = 20
IDP_MU_MINUS = 22
@@ -172,3 +174,12 @@ def setup_matplotlib(save=False):
# Make the defalt font bigger
matplotlib.rcParams['font.size'] = 12
+
+def read_hdf(filename, df):
+ """
+ Similar to pd.read_hdf() but doesn't require pytables. I'm adding this
+ function since the open science grid login nodes don't have pytables.
+ """
+ with h5py.File(filename) as f:
+ data = f[df][:]
+ return pd.DataFrame.from_records(data)
diff --git a/utils/submit-grid-jobs b/utils/submit-grid-jobs
index d4b1ae2..70bc4f9 100755
--- a/utils/submit-grid-jobs
+++ b/utils/submit-grid-jobs
@@ -439,6 +439,7 @@ if __name__ == '__main__':
from sddm.plot_energy import prompt_event, gtid_sort, unwrap_50_mhz_clock
import pandas as pd
from sddm.dc import DC_MUON, DC_JUNK, DC_CRATE_ISOTROPY, DC_QVNHIT, DC_NECK, DC_FLASHER, DC_ESUM, DC_OWL, DC_OWL_TRIGGER, DC_FTS, DC_ITC, DC_BREAKDOWN
+ from sddm import read_hdf
parser = argparse.ArgumentParser("submit grid jobs", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("filenames", nargs='*', help="input files")
@@ -550,8 +551,11 @@ if __name__ == '__main__':
else:
check_call([zdab_cat,filename,"-o",output.name],stderr=f)
- ev = pd.read_hdf(output.name, "ev")
- rhdr = pd.read_hdf(output.name, "rhdr")
+ ev = read_hdf(output.name, "ev")
+ rhdr = read_hdf(output.name, "rhdr")
+
+ if len(ev) == 0:
+ continue
if len(ev) and not args.reprocess and int(ev.iloc[0]['run']) in unique_runs:
head, tail = split(filename)