From ce2389009c00e8ffc5f3f34185d66fb956b1d22a Mon Sep 17 00:00:00 2001 From: Philipp Schmidt <philipp.schmidt@xfel.eu> Date: Wed, 15 Nov 2023 10:42:34 +0100 Subject: [PATCH] Deprecate notebook parameter whether to save datasets, now always enabled --- .../REMI/REMI_Digitize_and_Transform.ipynb | 85 ++++++++----------- 1 file changed, 37 insertions(+), 48 deletions(-) diff --git a/notebooks/REMI/REMI_Digitize_and_Transform.ipynb b/notebooks/REMI/REMI_Digitize_and_Transform.ipynb index c6aa4f03f..b188101e9 100644 --- a/notebooks/REMI/REMI_Digitize_and_Transform.ipynb +++ b/notebooks/REMI/REMI_Digitize_and_Transform.ipynb @@ -13,12 +13,6 @@ "\n", "calib_config_path = '/gpfs/exfel/exp/SQS/202101/p002535/usr/config_board2+4.yaml' # Path to correction and transform configuration\n", "\n", - "# These parameters are required by xfel-calibrate but ignored in this notebook.\n", - "cycle = '' # Proposal cycle, currently not used.\n", - "cal_db_timeout = 0 # Calibration DB timeout, currently not used.\n", - "cal_db_interface = 'foo' # Calibration DB interface, currently not used.\n", - "karabo_da = 'bar' # Karabo data aggregator name, currently not used\n", - "\n", "# Output parameters.\n", "karabo_id = 'SQS_REMI_DLD6' # Karabo device ID root for virtual output device.\n", "proposal = '' # Proposal, leave empty for auto detection based on in_folder\n", @@ -26,11 +20,6 @@ "out_seq_len = 5000 # Number of trains per sequence file in output.\n", "det_device_id = '{karabo_id}/DET/{det_name}' # Karabo device ID for virtual output device.\n", "det_output_key = 'output' # Pipeline name for fast data output.\n", - "save_raw_triggers = True # Whether to save trigger position in files.\n", - "save_raw_edges = True # Whether to save digitized edge positions in files.\n", - "save_raw_amplitudes = True # Whether to save analog pulse amplitudes in files.\n", - "save_rec_signals = True # Whether to save reconstructed signals (u1-w2, mcp) in files.\n", - "save_rec_hits = True # Whether to save reoncstructed hits (x,y,t,m) in files.\n", "chunks_triggers = [500] # HDF chunk size for triggers.\n", "chunks_edges = [500, 7, 50] # HDF chunk size for edges.\n", "chunks_amplitudes = [500, 7, 50] # HDF chunk size for amplitudes.\n", @@ -65,7 +54,19 @@ "mp_find_triggers = 0.5 # Parallelization for finding triggers.\n", "mp_find_edges = 0.5 # Parallelization for digitizing analog signal.\n", "mt_avg_trace = 2 # Parallelization for trace averaging.\n", - "mp_rec_hits = 1.0 # Parallelization for hit reconstruction." + "mp_rec_hits = 1.0 # Parallelization for hit reconstruction.\n", + "\n", + "# DEPRECATED AND IGNORED\n", + "# Left for compatibility with webservice or legacy configuration.\n", + "cycle = '' # Proposal cycle, passed by webservice but not used.\n", + "karabo_da = 'bar' # Karabo data aggregator name, passed by webservice but not used\n", + "cal_db_timeout = 0 # Calibration DB timeout, passed by webservice but not used.\n", + "cal_db_interface = 'foo' # Calibration DB interface, passed by webservice but not used.\n", + "save_raw_triggers = True # Whether to save trigger position in files, ignored and always enabled.\n", + "save_raw_edges = True # Whether to save digitized edge positions in files, ignored and always enabled.\n", + "save_raw_amplitudes = True # Whether to save analog pulse amplitudes in files, ignored and always enabled.\n", + "save_rec_signals = True # Whether to save reconstructed signals (u1-w2, mcp) in files, ignored and always enabled.\n", + "save_rec_hits = True # Whether to save reoncstructed hits (x,y,t,m) in files, ignored and always enabled." ] }, { @@ -1328,17 +1329,10 @@ "\n", "control_sources = [det_device_id.format(karabo_id=karabo_id, det_name=det_name.upper())\n", " for det_name in remi['detector']]\n", - "\n", - "channels = []\n", - "if save_raw_triggers or save_raw_edges:\n", - " channels.append('raw')\n", - "if save_rec_signals or save_rec_hits:\n", - " channels.append('rec')\n", - " \n", "instrument_channels = [\n", " f'{device_id}:{det_output_key}/{channel}'\n", " for device_id in control_sources\n", - " for channel in channels\n", + " for channel in ['raw', 'rec']\n", "]" ] }, @@ -1378,38 +1372,33 @@ " \n", " cur_data = det_data[det_name]\n", " \n", - " if save_raw_triggers:\n", - " cur_fast_data.create_key('raw.triggers', triggers[pulse_mask],\n", - " maxshape=(None,) + triggers.shape[1:],\n", - " chunks=tuple(chunks_triggers), **dataset_kwargs)\n", + " cur_fast_data.create_key('raw.triggers', triggers[pulse_mask],\n", + " maxshape=(None,) + triggers.shape[1:],\n", + " chunks=tuple(chunks_triggers), **dataset_kwargs)\n", " \n", - " if save_raw_edges:\n", - " cur_fast_data.create_key('raw.edges', cur_data['edges'][pulse_mask],\n", - " maxshape=(None,) + cur_data['edges'].shape[1:],\n", - " chunks=tuple(chunks_edges if chunks_edges[-1] <= cur_max_hits\n", - " else chunks_edges[:-1] + [cur_max_hits]),\n", - " **dataset_kwargs)\n", + " cur_fast_data.create_key('raw.edges', cur_data['edges'][pulse_mask],\n", + " maxshape=(None,) + cur_data['edges'].shape[1:],\n", + " chunks=tuple(chunks_edges if chunks_edges[-1] <= cur_max_hits\n", + " else chunks_edges[:-1] + [cur_max_hits]),\n", + " **dataset_kwargs)\n", " \n", - " if save_raw_amplitudes:\n", - " cur_fast_data.create_key('raw.amplitudes', cur_data['amplitudes'][pulse_mask],\n", - " maxshape=(None,) + cur_data['amplitudes'].shape[1:],\n", - " chunks=tuple(chunks_amplitudes if chunks_amplitudes[-1] <= cur_max_hits\n", - " else chunks_amplitudes[:-1] + [cur_max_hits]),\n", - " **dataset_kwargs)\n", + " cur_fast_data.create_key('raw.amplitudes', cur_data['amplitudes'][pulse_mask],\n", + " maxshape=(None,) + cur_data['amplitudes'].shape[1:],\n", + " chunks=tuple(chunks_amplitudes if chunks_amplitudes[-1] <= cur_max_hits\n", + " else chunks_amplitudes[:-1] + [cur_max_hits]),\n", + " **dataset_kwargs)\n", " \n", - " if save_rec_signals:\n", - " cur_fast_data.create_key('rec.signals', cur_data['signals'][pulse_mask],\n", - " maxshape=(None,) + cur_data['signals'].shape[1:],\n", - " chunks=tuple(chunks_signals if chunks_signals[-1] <= cur_max_hits\n", - " else chunks_signals[:-1] + [cur_max_hits]),\n", - " **dataset_kwargs)\n", + " cur_fast_data.create_key('rec.signals', cur_data['signals'][pulse_mask],\n", + " maxshape=(None,) + cur_data['signals'].shape[1:],\n", + " chunks=tuple(chunks_signals if chunks_signals[-1] <= cur_max_hits\n", + " else chunks_signals[:-1] + [cur_max_hits]),\n", + " **dataset_kwargs)\n", " \n", - " if save_rec_hits:\n", - " cur_fast_data.create_key('rec.hits', cur_data['hits'][pulse_mask],\n", - " maxshape=(None,) + hits.shape[1:],\n", - " chunks=tuple(chunks_hits if chunks_hits[-1] <= cur_max_hits\n", - " else chunks_hits[:-1] + [cur_max_hits]),\n", - " **dataset_kwargs)\n", + " cur_fast_data.create_key('rec.hits', cur_data['hits'][pulse_mask],\n", + " maxshape=(None,) + hits.shape[1:],\n", + " chunks=tuple(chunks_hits if chunks_hits[-1] <= cur_max_hits\n", + " else chunks_hits[:-1] + [cur_max_hits]),\n", + " **dataset_kwargs)\n", " \n", " cur_fast_data.create_index(raw=pulse_counts[train_mask], rec=pulse_counts[train_mask])\n", " \n", -- GitLab