diff --git a/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb b/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb index dd69492abc5ebed0e57e2647df5b5ffd8a1e2749..8043f4a2199709fc832cf03a1ea898da292bc501 100644 --- a/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb +++ b/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb @@ -337,12 +337,11 @@ "# print(f\"Will process a total of {total_files} files ({total_file_size:.02f} GB).\")\n", "\n", "# TODO: Remove all of this nonsense with Extra-data.\n", - "inp = [None] * 3 * len(modules)\n", + "inp = []\n", "for gain_index, (gain, qm_file_map) in enumerate(gain_mapped_files.items()):\n", - " gain_input = []\n", + " selected_inp = None\n", " for module_index in modules:\n", " max_n_imgs = 0\n", - " inp_idx = gain_index * len(modules) + module_index\n", " qm = module_index_to_qm(module_index)\n", " if qm not in qm_file_map:\n", " print(f\"Did not find files for {qm}\")\n", @@ -355,15 +354,16 @@ " with h5py.File(filename, \"r\") as fin:\n", " n_imgs = fin[h5path.format(module_index)+\"/trainId\"].shape[0]\n", " if n_imgs != 0 and n_imgs > max_n_imgs:\n", - " inp[inp_idx] = (filename, module_index, gain_index)\n", + " selected_inp = (filename, module_index, gain_index)\n", " max_n_imgs = n_imgs\n", - " print(f\"Process {inp[inp_idx][0]} for {qm}\")\n", - " if inp[inp_idx] is None:\n", + " print(f\"Process {selected_inp[0]} for {qm}\")\n", + " inp.append(selected_inp)\n", + " if selected_inp is None:\n", " raise ValueError(\n", " \"No images to process for run: \"\n", " f\"{[v for v in offset_runs.values()][gain_index]}\"\n", " )\n", - "inp = [x for x in inp if x is not None]\n", + "\n", "total_files = len(inp)" ] },