diff --git a/notebooks/LPD/LPD_Correct_Fast.ipynb b/notebooks/LPD/LPD_Correct_Fast.ipynb index 39941d9634a0d317efcc200c94e83de361617c6f..73906ff0388a22ba6d74b71bb474fc17d8003081 100644 --- a/notebooks/LPD/LPD_Correct_Fast.ipynb +++ b/notebooks/LPD/LPD_Correct_Fast.ipynb @@ -27,7 +27,7 @@ "sequences = [-1] # Sequences to correct, use [-1] for all\n", "modules = [-1] # Modules indices to correct, use [-1] for all, only used when karabo_da is empty\n", "karabo_da = [''] # Data aggregators names to correct, use [''] for all\n", - "run = 10 # runs to process, required\n", + "run = 10 # run to process, required\n", "\n", "# Source parameters\n", "karabo_id = 'FXE_DET_LPD1M-1' # Karabo domain for detector.\n", @@ -35,7 +35,7 @@ "output_source = '' # Output fast data source, empty to use same as input.\n", "\n", "# CalCat parameters\n", - "creation_time = \"\" # The timestamp to use with Calibration DBe. Required Format: \"YYYY-MM-DD hh:mm:ss\" e.g. 2019-07-04 11:02:41\n", + "creation_time = \"\" # The timestamp to use with Calibration DB. Required Format: \"YYYY-MM-DD hh:mm:ss\" e.g. 2019-07-04 11:02:41\n", "cal_db_interface = '' # Not needed, compatibility with current webservice.\n", "cal_db_timeout = 0 # Not needed, compatbility with current webservice.\n", "cal_db_root = '/gpfs/exfel/d/cal/caldb_store'\n", @@ -108,7 +108,6 @@ "from cal_tools.tools import (\n", " CalibrationMetadata,\n", " calcat_creation_time,\n", - " get_dir_creation_date,\n", " write_compressed_frames,\n", " )\n", "from cal_tools.files import DataFile\n", diff --git a/notebooks/LPD/LPD_retrieve_constants_precorrection.ipynb b/notebooks/LPD/LPD_retrieve_constants_precorrection.ipynb index 0864b34ced7fe9b099fdc50c7e22359d9077d60c..21ffbfb4d987be1746abed7145aed2f43850c64b 100644 --- a/notebooks/LPD/LPD_retrieve_constants_precorrection.ipynb +++ b/notebooks/LPD/LPD_retrieve_constants_precorrection.ipynb @@ -21,19 +21,15 @@ "in_folder = \"/gpfs/exfel/exp/FXE/202201/p003073/raw/\" # the folder to read data from, required\n", "out_folder = \"/gpfs/exfel/data/scratch/ahmedk/test/remove/LPD_test\" # the folder to output to, required\n", "metadata_folder = '' # Directory containing calibration_metadata.yml when run by xfel-calibrate.\n", - "sequences = [-1] # Sequences to correct, use [-1] for all\n", "modules = [-1] # Modules indices to correct, use [-1] for all, only used when karabo_da is empty\n", "karabo_da = [''] # Data aggregators names to correct, use [''] for all\n", - "run = 10 # runs to process, required\n", + "run = 10 # run to process, required\n", "\n", "# Source parameters\n", "karabo_id = 'FXE_DET_LPD1M-1' # Karabo domain for detector.\n", - "input_source = '{karabo_id}/DET/{module_index}CH0:xtdf' # Input fast data source.\n", - "output_source = '' # Output fast data source, empty to use same as input.\n", "\n", "# CalCat parameters\n", - "creation_time = \"\" # The timestamp to use with Calibration DBe. Required Format: \"YYYY-MM-DD hh:mm:ss\" e.g. 2019-07-04 11:02:41\n", - "cal_db_root = '/gpfs/exfel/d/cal/caldb_store'\n", + "creation_time = \"\" # The timestamp to use with Calibration DB. Required Format: \"YYYY-MM-DD hh:mm:ss\" e.g. 2019-07-04 11:02:41\n", "\n", "# Operating conditions\n", "mem_cells = 512 # Memory cells, LPD constants are always taken with 512 cells.\n", @@ -51,25 +47,15 @@ "source": [ "from pathlib import Path\n", "from time import perf_counter\n", - "import gc\n", - "import re\n", "\n", "from calibration_client import CalibrationClient\n", "from calibration_client.modules import CalibrationConstantVersion\n", - "import extra_data as xd\n", - "import extra_geom as xg\n", - "import pasha as psh\n", - "\n", - "from extra_data.components import LPD1M\n", "\n", "from cal_tools.tools import (\n", " CalibrationMetadata,\n", " calcat_creation_time,\n", - " get_dir_creation_date,\n", " save_constant_metadata,\n", - " write_compressed_frames,\n", ")\n", - "from cal_tools.files import DataFile\n", "from cal_tools.restful_config import restful_config" ] }, @@ -79,16 +65,9 @@ "metadata": {}, "outputs": [], "source": [ - "file_re = re.compile(r'^RAW-R(\\d{4})-(\\w+\\d+)-S(\\d{5})$') # This should probably move to cal_tools\n", - "\n", - "run_folder = Path(in_folder) / f'r{run:04d}'\n", "out_folder = Path(out_folder)\n", "out_folder.mkdir(exist_ok=True)\n", "\n", - "output_source = output_source or input_source\n", - "\n", - "cal_db_root = Path(cal_db_root)\n", - "\n", "metadata = CalibrationMetadata(metadata_folder or out_folder)\n", "# Constant paths & timestamps are saved under retrieved-constants in calibration_metadata.yml\n", "retrieved_constants = metadata.setdefault(\"retrieved-constants\", {})\n", @@ -101,16 +80,7 @@ " if not modules or modules == [-1]:\n", " modules = list(range(16))\n", "\n", - " karabo_da = [f'LPD{i:02d}' for i in modules]\n", - " \n", - "# Pick all sequences or those selected.\n", - "if not sequences or sequences == [-1]:\n", - " do_sequence = lambda seq: True\n", - "else:\n", - " do_sequence = [int(x) for x in sequences].__contains__ \n", - " \n", - "# List of detector sources.\n", - "det_inp_sources = [input_source.format(karabo_id=karabo_id, module_index=int(da[-2:])) for da in karabo_da]" + " karabo_da = [f'LPD{i:02d}' for i in modules] " ] }, { @@ -163,10 +133,16 @@ "illuminated_condition += [\n", " dict(parameter_id=3, value=photon_energy), # Source energy\n", " dict(parameter_id=25, value=category) # category\n", - "]\n", - "\n", + "]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ "const_data = {}\n", - "const_load_mp = psh.ProcessContext(num_workers=24)\n", "\n", "print('Querying calibration database', end='', flush=True)\n", "start = perf_counter()\n",