toolbox_scs.detectors.bam_detectors

Beam Arrival Monitor related sub-routines

Copyright (2021) SCS Team.

(contributions preferrably comply with pep8 code structure guidelines.)

Module Contents

Functions

get_bam(run[, mnemonics, merge_with, bunchPattern, ...])

Load beam arrival monitor (BAM) data and align their pulse ID

get_bam_params(run[, mnemo_or_source])

Extract the run values of bamStatus[1-3] and bamError.

toolbox_scs.detectors.bam_detectors.get_bam(run, mnemonics=None, merge_with=None, bunchPattern='sase3', pulseIds=None)[source]

Load beam arrival monitor (BAM) data and align their pulse ID according to the bunch pattern. Sources can be loaded on the fly via the mnemonics argument, or processed from an existing data set (merge_with).

Parameters
  • run (extra_data.DataCollection) – DataCollection containing the bam data.

  • mnemonics (str or list of str) – mnemonics for BAM, e.g. “BAM1932M” or [“BAM414”, “BAM1932M”]. If None, defaults to “BAM1932M” in case no merge_with dataset is provided.

  • merge_with (xarray Dataset) – If provided, the resulting Dataset will be merged with this one. The BAM variables of merge_with (if any) will also be selected, aligned and merged.

  • bunchPattern (str) – ‘sase1’ or ‘sase3’ or ‘scs_ppl’, bunch pattern used to extract peaks. The pulse ID dimension will be named ‘sa1_pId’, ‘sa3_pId’ or ‘ol_pId’, respectively.

  • pulseIds (list, 1D array) – Pulse Ids. If None, they are automatically loaded.

Returns

merged with Dataset merge_with if provided.

Return type

xarray Dataset with pulse-resolved BAM variables aligned,

Example

>>> import toolbox_scs as tb
>>> run = tb.open_run(2711, 303)
>>> bam = tb.get_bam(run, 'BAM1932S')
toolbox_scs.detectors.bam_detectors.get_bam_params(run, mnemo_or_source='BAM1932S')[source]

Extract the run values of bamStatus[1-3] and bamError.

Parameters
  • run (extra_data.DataCollection) – DataCollection containing the bam data.

  • mnemo_or_source (str) – mnemonic of the BAM, e.g. ‘BAM414’, or source name, e.g. ‘SCS_ILH_LAS/DOOCS/BAM_414_B2.

Returns

params – dictionnary containing the extracted parameters.

Return type

dict

Note

The extracted parameters are run values, they do not reflect any possible change during the run.