Skip to content
Snippets Groups Projects
Commit 90c9a732 authored by Laurent Mercadier's avatar Laurent Mercadier
Browse files

introduce extract_fadc, extract_adq412, etc...

parent 3a956b5c
No related branches found
No related tags found
1 merge request!215Clean digitizers peak functions and add documentation
...@@ -40,12 +40,16 @@ def load(proposalNB=None, runNB=None, ...@@ -40,12 +40,16 @@ def load(proposalNB=None, runNB=None,
validate=False, validate=False,
subset=ed.by_index[:], subset=ed.by_index[:],
rois={}, rois={},
extract_tim=True, extract_adq412=True,
extract_laser=True, extract_fadc=True,
extract_xgm=True, extract_xgm=True,
extract_bam=True, extract_bam=True,
tim_bp='sase3', adq412_bp='sase3',
laser_bp='scs_ppl', fadc_bp='scs_ppl',
extract_tim=None,
extract_laser=None,
tim_bp=None,
laser_bp=None,
): ):
""" """
Load a run and extract the data. Output is an xarray with aligned Load a run and extract the data. Output is an xarray with aligned
...@@ -82,12 +86,12 @@ def load(proposalNB=None, runNB=None, ...@@ -82,12 +86,12 @@ def load(proposalNB=None, runNB=None,
'dim': ['ref_x', 'ref_y']}, 'dim': ['ref_x', 'ref_y']},
'sam': {'roi':by_index[1050:1210, 535:720], 'sam': {'roi':by_index[1050:1210, 535:720],
'dim': ['sam_x', 'sam_y']}}} 'dim': ['sam_x', 'sam_y']}}}
extract_tim: bool extract_adq412: bool
If True, extracts the peaks from TIM variables (e.g. 'MCP2raw', If True, extracts the peaks from ADQ412 variables (e.g. 'MCP2raw',
'MCP3apd') and aligns the pulse Id with the sase3 bunch pattern. 'MCP3apd') and aligns the pulse Id with the sase3 bunch pattern.
extract_laser: bool extract_fadc: bool
If True, extracts the peaks from FastADC variables (e.g. 'FastADC5raw', If True, extracts the peaks from FastADC variables (e.g. 'FastADC5raw',
'FastADC3peaks') and aligns the pulse Id with the PP laser bunch 'FastADC3peaks') and aligns the pulse Id according to the fadc_bp bunch
pattern. pattern.
extract_xgm: bool extract_xgm: bool
If True, extracts the values from XGM variables (e.g. 'SCS_SA3', If True, extracts the values from XGM variables (e.g. 'SCS_SA3',
...@@ -103,6 +107,12 @@ def load(proposalNB=None, runNB=None, ...@@ -103,6 +107,12 @@ def load(proposalNB=None, runNB=None,
bunch pattern used to extract the TIM pulses. bunch pattern used to extract the TIM pulses.
Ignored if extract_tim=False. Ignored if extract_tim=False.
DEPRECATED ARGUMENTS:
extract_tim: DEPRECATED. Use extract_adq412 instead.
extract_laser: DEPRECATED. Use extract fadc instead.
tim_bp: DEPRECATED. Use adq412_bp instead.
laser_bp: DEPRECATED. Use fadc_bp instead.
Returns Returns
------- -------
run, data: DataCollection, xarray.DataArray run, data: DataCollection, xarray.DataArray
...@@ -194,16 +204,26 @@ def load(proposalNB=None, runNB=None, ...@@ -194,16 +204,26 @@ def load(proposalNB=None, runNB=None,
data = xr.merge(data_arrays, join='inner') data = xr.merge(data_arrays, join='inner')
data.attrs['runFolder'] = runFolder data.attrs['runFolder'] = runFolder
tim = [k for k in run_mnemonics if 'MCP' in k and k in data] # backward compatibility with old-defined variables:
if extract_tim and len(tim) > 0: if extract_tim is not None:
data = tbdet.get_tim_peaks(run, mnemonics=tim, merge_with=data, extract_adq412 = extract_tim
bunchPattern=tim_bp) if extract_laser is not None:
extract_fadc = extract_laser
laser = [k for k in run_mnemonics if 'FastADC' in k and k in data] if tim_bp is not None:
if extract_laser and len(laser) > 0: adq412_bp = tim_bp
data = tbdet.get_laser_peaks(run, mnemonics=laser, merge_with=data, if laser_bp is not None:
bunchPattern=laser_bp) fadc_bp = laser_bp
adq412 = [k for k in run_mnemonics if 'MCP' in k and k in data]
if extract_adq412 and len(adq412) > 0:
data = tbdet.get_digitizer_peaks(run, mnemonics=adq412, merge_with=data,
bunchPattern=adq412_bp)
fadc = [k for k in run_mnemonics if 'FastADC' in k and k in data]
if extract_fadc and len(fadc) > 0:
data = tbdet.get_digitizer_peaks(run, mnemonics=fadc, merge_with=data,
bunchPattern=fadc_bp)
xgm = ['XTD10_XGM', 'XTD10_XGM_sigma', 'XTD10_SA3', 'XTD10_SA3_sigma', xgm = ['XTD10_XGM', 'XTD10_XGM_sigma', 'XTD10_SA3', 'XTD10_SA3_sigma',
'XTD10_SA1', 'XTD10_SA1_sigma', 'SCS_XGM', 'SCS_XGM_sigma', 'XTD10_SA1', 'XTD10_SA1_sigma', 'SCS_XGM', 'SCS_XGM_sigma',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment