Skip to content
Snippets Groups Projects

Add function to read digitizers signal description

Merged Laurent Mercadier requested to merge fadc-description into master
2 unresolved threads
@@ -24,6 +24,7 @@ __all__ = [
'get_laser_peaks',
'get_peaks',
'get_tim_peaks',
'digitizer_signal_description'
]
log = logging.getLogger(__name__)
@@ -986,6 +987,56 @@ def get_digitizer_peaks(run, mnemonics, digitizer, merge_with=None,
return ds
def digitizer_signal_description(run, digitizer=None):
"""
Check for the existence of signal description and return all corresponding
channels in a dictionnary.
Parameters
----------
proposal: int
The proposal number
runNB: int
The run number
digitizer: str or list of str (default=None)
Name of the digitizer: one in ['FastADC', FastADC2']
If None, all digitizers are used
Returns
-------
signal_description: dictionnary containing the signal description of
the digitizer channels.
Example
-------
import toolbox_scs as tb
run = tb.open_run(3481, 100)
signals = tb.digitizer_signal_description(run)
signals_fadc2 = tb.digitizer_signal_description(run, 'FastADC2')
"""
if digitizer not in [None, 'FastADC', 'FastADC2']:
raise ValueError('digitizer must be one in '
'["FastADC", "FastADC2"]')
if digitizer is None:
digitizer = ['FastADC', 'FastADC2']
else:
digitizer = [digitizer]
sources = {'FastADC': 'SCS_UTC1_MCP/ADC/1',
'FastADC2': 'SCS_UTC2_FADC/ADC/1'}
key = 'channel_0.signalDescription.value'
res = {}
for d in digitizer:
if key not in run.get_run_values(sources[d]):
raise ValueError('No signal description available for'
f'{d}: {sources[d]}')
for ch in range(10):
desc = run.get_run_value(sources[d],
f'channel_{ch}.signalDescription.value')
res[f'{d}_Ch{ch}'] = desc
return res
def calibrateTIM(data, rollingWindow=200, mcp=1, plot=False, use_apd=True, intstart=None,
intstop=None, bkgstart=None, bkgstop=None, t_offset=None, npulses_apd=None):
''' Calibrate TIM signal (Peak-integrated signal) to the slow ion signal of SCS_XGM
Loading