From 10282566d6a9e17f77645c117e837f44841f2c4c Mon Sep 17 00:00:00 2001 From: Karim Ahmed <karim.ahmed@xfel.eu> Date: Tue, 24 Sep 2019 11:10:27 +0200 Subject: [PATCH] revert wrong changes from different branch --- cal_tools/cal_tools/agipdlib.py | 13 ++++--------- notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb | 5 +---- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/cal_tools/cal_tools/agipdlib.py b/cal_tools/cal_tools/agipdlib.py index b7281dd8d..455ee524d 100644 --- a/cal_tools/cal_tools/agipdlib.py +++ b/cal_tools/cal_tools/agipdlib.py @@ -15,8 +15,6 @@ def get_num_cells(fname, loc, module): with h5py.File(fname, "r") as f: cells = \ f["INSTRUMENT/{}/DET/{}CH0:xtdf/image/cellId".format(loc, module)][()] - if cells.shape[0] == 0: - return None maxcell = np.max(cells) options = [4, 32, 64, 76, 128, 176, 202, 250] dists = [abs(o - maxcell) for o in options] @@ -25,13 +23,10 @@ def get_num_cells(fname, loc, module): def get_acq_rate(fname, loc, module): with h5py.File(fname, "r") as f: - try: - pulses = \ - np.squeeze(f["INSTRUMENT/{}/DET/{}CH0:xtdf/image/pulseId".format( - loc, module)][:2]) - diff = pulses[1] - pulses[0] - except: - diff = 0 + pulses = \ + np.squeeze(f["INSTRUMENT/{}/DET/{}CH0:xtdf/image/pulseId".format( + loc, module)][:2]) + diff = pulses[1] - pulses[0] options = {8: 0.5, 4: 1.1, 2: 2.2, 1: 4.5} return options.get(diff, None) diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb index 76b200a11..23e304ff0 100644 --- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb +++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb @@ -414,10 +414,7 @@ " \n", " if max_cells == 0:\n", " max_cells = get_num_cells(filename, loc, channel)\n", - " if max_cells is None:\n", - " raise ValueError(\"No raw images found for {}\".format(qm))\n", - " else:\n", - " cells = np.arange(max_cells)\n", + " cells = np.arange(max_cells)\n", " \n", " if acq_rate == 0.:\n", " acq_rate = get_acq_rate(filename, loc, channel)\n", -- GitLab