The bunch pattern table is an array of 2700 values per train (the maximum number of pulses at 4.5 MHz provided by the machine) and contains information on how the pulses are distributed among SASE 1, 2, 3, and the various lasers at European XFEL. The data stored in the bunch pattern table (mnemonic bunchPatternTable) can be extracted using the wrappers to the euxfel_bunch_pattern package as follows:

import toolbox_scs as tb

proposalNB = 2953
runNB = 507

run, ds = tb.load(proposalNB, runNB, "bunchPatternTable")
ppl_mask = tb.is_ppl(ds["bunchPatternTable"])

ppl_mask is a boolean DataArray of dimensions trainId x 2700, where True values indicate where a laser pulse from the PP laser was triggered.

Note

The position of the PP laser pulses with respect to that of the SASE 3 pulses is arbitrary. The PP laser pattern always starts at pulse Id 0, while that of SASE 3 can vary, depending on the machine parameters. One can use the ToolBox function align_ol_to_fel_pId() to shift the PP laser pulse Ids to match those of SASE 3.

From this mask, one can obtain the number of pulses per train by summing along the ‘pulse_slot’ dimension:

ppl_npulses = ppl_mask.sum(dim='pulse_slot')

There is also the function get_sase_pId() that can be used to directly extract the pulse Ids of a particular location:

ppl_pId = tb.get_sase_pId(run, loc='scs_ppl')

This provides a list of the pulse Ids used during a run but does not track changes of number of pulses. For this, the mnemonic npulses_laser can be loaded to get the number of pulses in each trainId and the mnemonic laser can be loaded to get the pulse Ids of the scs_ppl in each trainId:

run, ds = tb.load(proposalNB, runNB, ['laser', 'npulses_laser'])