diff --git a/cal_tools/cal_tools/agipdlib.py b/cal_tools/cal_tools/agipdlib.py index 598ab81be175bc6a2d62bb719a5a3be99ea3192d..f89f643fdd7c3d71ecd4c74e9825776bf1380b1f 100644 --- a/cal_tools/cal_tools/agipdlib.py +++ b/cal_tools/cal_tools/agipdlib.py @@ -840,10 +840,15 @@ class AgipdCorrections: # or with only simple pulse ranging. if pulse_step > 1 or \ allpulses[first_pulse] >= allpulses[last_pulse]: - can_calibrate = can_calibrate and np.isin(allpulses, cal_pulses) + can_calibrate = np.logical_and(can_calibrate, + np.isin(allpulses, cal_pulses)) else: - can_calibrate = can_calibrate and (allpulses <= np.min(cal_pulses)) # noqa - can_calibrate = can_calibrate and (allpulses >= np.max(cal_pulses)) # noqa + # Check interesection between array of booleans and + # array of pulses to calibrate. + can_calibrate = np.logical_and(can_calibrate, + (allpulses <= np.max(cal_pulses)), + (allpulses >= np.min(cal_pulses)) + ) return can_calibrate diff --git a/notebooks/DSSC/Characterize_DSSC_Darks_NBC.ipynb b/notebooks/DSSC/Characterize_DSSC_Darks_NBC.ipynb index 43d7d2437bda4400312d8ce0b4991f0473591a3a..fd8d225f55aa1930a85117115d098393989d5125 100644 --- a/notebooks/DSSC/Characterize_DSSC_Darks_NBC.ipynb +++ b/notebooks/DSSC/Characterize_DSSC_Darks_NBC.ipynb @@ -315,11 +315,14 @@ "all_cells = []\n", "checksums = {}\n", "\n", - "tGain, encodedGain, operatingFreq = get_dssc_ctrl_data(in_folder + f\"/r{:04d}/\".format(offset_runs[\"high\"]),\n", - " slow_data_pattern,\n", - " slow_data_aggregators,\n", - " offset_runs[\"high\"])\n", - "\n", + "try:\n", + " tGain, encodedGain, operatingFreq = get_dssc_ctrl_data(in_folder + \"/r{:04d}/\".format(offset_runs[\"high\"]),\n", + " slow_data_pattern,\n", + " slow_data_aggregators,\n", + " offset_runs[\"high\"])\n", + "except KeyError:\n", + " print(\"ERROR: Couldn't access slow data to read tGain, encodedGain, and operatingFreq \\n\")\n", + " \n", "for gain, mapped_files in gain_mapped_files.items():\n", " inp = []\n", " dones = []\n",