diff --git a/notebooks/Jungfrau/Jungfrau_Create_Fit_Spectra_Histos_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_Create_Fit_Spectra_Histos_NBC.ipynb index 1237125254b43127718af77532bb10011d45ad23..fb4223353843a985ce284afa08b952ef9e502cc0 100644 --- a/notebooks/Jungfrau/Jungfrau_Create_Fit_Spectra_Histos_NBC.ipynb +++ b/notebooks/Jungfrau/Jungfrau_Create_Fit_Spectra_Histos_NBC.ipynb @@ -26,8 +26,8 @@ "sensor_size = [512, 1024] # size of the array in the 'row' and 'col' dimensions\n", "chunked_trains = 1000 # Number of trains per chunk.\n", "gains = [0, 1, 2] # gain bit values\n", - "karabo_id = 'SPB_IRDA_JF4M' # karabo prefix of Jungfrau devices\n", - "karabo_da = ['JNGFR01']\n", + "karabo_id = \"SPB_IRDA_JF4M\" # karabo prefix of Jungfrau devices\n", + "karabo_da = [\"\"]\n", "creation_time = '' # To overwrite the measured creation_time. Required Format: YYYY-MM-DD HR:MN:SC e.g. \"2022-06-28 13:00:00\"\n", "bias_voltage = -1 # bias voltage - Set to -1 to derive from CONTROL file.\n", "integration_time = -1. # integration time - Set to -1 to derive from CONTROL file.\n", @@ -54,8 +54,22 @@ "\n", "rebin = 1\n", "# parameters for the peak finder\n", - "n_sigma = 5. # n of sigma abov pedestal threshold\n", - "ratio = 0.99 # ratio of the next peak amplitude in the peak_finder" + "n_sigma = 5. # n of sigma above pedestal threshold\n", + "ratio = 0.99 # ratio of the next peak amplitude in the peak_finder\n", + "\n", + "\n", + "def find_das(in_folder, runs, karabo_da):\n", + " run = runs[0]\n", + " if (karabo_da is not None) and karabo_da != [\"\"]:\n", + " return karabo_da\n", + " from pathlib import Path\n", + " import re\n", + " karabo_da = set()\n", + " for file in Path(in_folder, f'r{run:04d}').iterdir():\n", + " da = re.search(r'JNGFR\\d{2}', file.name)\n", + " if da:\n", + " karabo_da.add(da.group())\n", + " return sorted(karabo_da)" ] }, { diff --git a/notebooks/Jungfrau/Jungfrau_Create_Gain_maps_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_Create_Gain_maps_NBC.ipynb index 8f57f66cc85bd20f2b8adffa08df656299a22fed..60c8592e791833c828cb3b5d518841475957ec9b 100755 --- a/notebooks/Jungfrau/Jungfrau_Create_Gain_maps_NBC.ipynb +++ b/notebooks/Jungfrau/Jungfrau_Create_Gain_maps_NBC.ipynb @@ -60,7 +60,21 @@ "\n", "# CALCAT API parameters\n", "cal_db_interface = \"tcp://max-exfl-cal-001:8020\" # the database interface to use\n", - "cal_db_timeout = 180000" + "cal_db_timeout = 180000\n", + "\n", + "\n", + "def find_das(in_folder, runs, karabo_da):\n", + " run = runs[0]\n", + " if (karabo_da is not None) and karabo_da != [\"\"]:\n", + " return karabo_da\n", + " from pathlib import Path\n", + " import re\n", + " karabo_da = set()\n", + " for file in Path(in_folder, f'r{run:04d}').iterdir():\n", + " da = re.search(r'JNGFR\\d{2}', file.name)\n", + " if da:\n", + " karabo_da.add(da.group())\n", + " return sorted(karabo_da)" ] }, { diff --git a/src/xfel_calibrate/notebooks.py b/src/xfel_calibrate/notebooks.py index 644bb6b910e5007b62bce8fd543142c47f02ad30..6e66d250c39375a32be73e37a2301b18e80bd092 100644 --- a/src/xfel_calibrate/notebooks.py +++ b/src/xfel_calibrate/notebooks.py @@ -209,6 +209,7 @@ notebooks = { "dep_notebooks": [ "notebooks/Jungfrau/Jungfrau_gain_Spectra_Fit_Summary_NBC.ipynb"], "concurrency": {"parameter": "karabo_da", + "use function": "find_das", "default concurrency": list(range(8)), "cluster cores": 4}, }, @@ -218,6 +219,7 @@ notebooks = { "dep_notebooks": [ "notebooks/Jungfrau/Jungfrau_gain_map_Summary_NBC.ipynb"], "concurrency": {"parameter": "karabo_da", + "use function": "find_das", "default concurrency": list(range(8)), "cluster cores": 4}, },