diff --git a/cal_tools/cal_tools/agipdlib.py b/cal_tools/cal_tools/agipdlib.py index bafdbe3aeccd4e29474f3fc7e1c760dd66b0d2df..6268fcfe61afa58ad81476d219afba244a94cf19 100644 --- a/cal_tools/cal_tools/agipdlib.py +++ b/cal_tools/cal_tools/agipdlib.py @@ -51,7 +51,7 @@ def get_acq_rate(slow_paths: Tuple[str, str], # Attempt to look for acquisition rate in slow data slow_data_file, karabo_id_control = slow_paths slow_data_file = Path(slow_data_file) - if slow_data_file.exists(): + if slow_data_file.is_file(): slow_data_path = f'CONTROL/{karabo_id_control}/MDL/FPGA_COMP/bunchStructure/repetitionRate/value' # noqa with h5py.File(slow_data_file, "r") as fin: if slow_data_path in fin: @@ -60,7 +60,7 @@ def get_acq_rate(slow_paths: Tuple[str, str], # Compute acquisition rate from fast data fast_data_file, karabo_id, module = fast_paths fast_data_file = Path(fast_data_file) - if fast_data_file.exists(): + if fast_data_file.is_file(): fast_data_path = f'INSTRUMENT/{karabo_id}/DET/{module}CH0:xtdf/image/pulseId' # noqa with h5py.File(fast_data_file) as fin: if fast_data_path in fin: diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb index d7803821cf31e4baf5ecc115a3851ea8ff2b361d..5296ecc33fade39c8cf48bda9928f644e4820a4d 100644 --- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb +++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb @@ -313,7 +313,7 @@ "\n", "# Evaluate aquisition rate\n", "if acq_rate == 0:\n", - " acq_rate = get_acq_rate(filename, karabo_id, channel)\n", + " acq_rate = get_acq_rate(('', '') (filename, karabo_id, channel))\n", "else:\n", " acq_rate = None\n", "\n", diff --git a/notebooks/AGIPD/AGIPD_Retrieve_Constants_Precorrection.ipynb b/notebooks/AGIPD/AGIPD_Retrieve_Constants_Precorrection.ipynb index 8f3df25d24065fb556f678d4e27dc4618fa06532..99ec430f2501c08a683c02b3415ff3652b14fb6b 100644 --- a/notebooks/AGIPD/AGIPD_Retrieve_Constants_Precorrection.ipynb +++ b/notebooks/AGIPD/AGIPD_Retrieve_Constants_Precorrection.ipynb @@ -271,7 +271,7 @@ " break\n", "\n", " if acq_rate == 0.:\n", - " acq_rate = get_acq_rate(f, karabo_id, idx)\n", + " acq_rate = get_acq_rate(('', ''), (f, karabo_id, idx))\n", " else:\n", " acq_rate = None\n", "\n", diff --git a/notebooks/AGIPD/Characterize_AGIPD_Gain_FlatFields_NBC.ipynb b/notebooks/AGIPD/Characterize_AGIPD_Gain_FlatFields_NBC.ipynb index 9f4a3351b56b1857bd6f79465aa94b5249a03bd5..9775a0772ec61ad65ede00b4b3c18d719b27d18b 100644 --- a/notebooks/AGIPD/Characterize_AGIPD_Gain_FlatFields_NBC.ipynb +++ b/notebooks/AGIPD/Characterize_AGIPD_Gain_FlatFields_NBC.ipynb @@ -189,7 +189,7 @@ "channel = 0\n", "fname = fbase.format(runs[0], runs[0].upper(), channel, sequences[0])\n", "if acqrate == 0.:\n", - " acqrate = get_acq_rate(fname, loc, channel)\n", + " acqrate = get_acq_rate(('', ''), (fname, loc, channel))\n", " \n", "\n", "if mem_cells == 0:\n", diff --git a/notebooks/AGIPD/Chracterize_AGIPD_Gain_PC_NBC.ipynb b/notebooks/AGIPD/Chracterize_AGIPD_Gain_PC_NBC.ipynb index 2542e9d5032e6a8475472d62753879a9106a62fe..69ca41eb47d3fdccfcc7d782346e32104e4b1373 100644 --- a/notebooks/AGIPD/Chracterize_AGIPD_Gain_PC_NBC.ipynb +++ b/notebooks/AGIPD/Chracterize_AGIPD_Gain_PC_NBC.ipynb @@ -159,7 +159,7 @@ " print('Reading ',fname)\n", " \n", " if acq_rate == 0.:\n", - " acq_rate = get_acq_rate(fname, loc, channel)\n", + " acq_rate = get_acq_rate(('', ''), (fname, loc, channel))\n", " print(\"Acquisition rate set from file: {} MHz\".format(acq_rate))\n", "\n", " if mem_cells == 0:\n", diff --git a/notebooks/AGIPD/playground/AGIPD_SingleM_test_Dark.ipynb b/notebooks/AGIPD/playground/AGIPD_SingleM_test_Dark.ipynb index 551f5f98a568931bcc44e659bcf9d141b406e3a0..93b63f2cfede86004ca42f67f6f812c8f4795802 100644 --- a/notebooks/AGIPD/playground/AGIPD_SingleM_test_Dark.ipynb +++ b/notebooks/AGIPD/playground/AGIPD_SingleM_test_Dark.ipynb @@ -260,7 +260,7 @@ " cells = get_num_cells(filename, loc, channel)\n", " \n", " if acq_rate == 0.:\n", - " acq_rate = get_acq_rate(filename, loc, channel)\n", + " acq_rate = get_acq_rate(('', ''), (filename, loc, channel))\n", " \n", " thresholds_offset, thresholds_offset_sigma, thresholds_noise, thresholds_noise_sigma = bp_thresh \n", " thresholds_offset_hard = thresholds_offset[gg]\n",