Skip to content

Commit 0eca889

Browse files
committed
Add XtdfPulses
1 parent eee5ad9 commit 0eca889

3 files changed

Lines changed: 33 additions & 5 deletions

File tree

docs/components/pulse-patterns.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66

77
::: extra.components.MachinePulses
88

9+
::: extra.components.XtdfPulses
10+
911
::: extra.components.DldPulses

src/extra/components/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22
from .scantool import Scantool # noqa
33
from .pulses import XrayPulses, OpticalLaserPulses, MachinePulses, \
4-
PumpProbePulses, DldPulses # noqa
4+
PumpProbePulses, XtdfPulses, AgipdPulses, LpdPulses, DsscPulses, \
5+
DldPulses # noqa
56
from .scan import Scan # noqa
67
from .xgm import XGM # noqa
78
from .dld import DelayLineDetector # noqa

src/extra/components/pulses.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,14 +1509,39 @@ def pulse_mask(self, labelled=True, field=None):
15091509

15101510

15111511
class XtdfPulses(PulsePattern):
1512-
def __init__(self, xtdf_source, include_cells=True,
1513-
ppt_anchor: int | PulsePattern | None = None,
1514-
first_lit_cell=0):
1512+
"""An interface to pulses from XTDF sources.
1513+
1514+
The custom fast MHz detectors used at European XFEL send their data
1515+
via the XFEL Train Data Format (XTDF), which contains information
1516+
about the pulse pattern recorded by these detectors.
1517+
1518+
This component exposes this information via the pulse pattern
1519+
interface. As XTDF detectors generally enumerate pulses
1520+
independently, it also allows to correlate its pulse ID with those
1521+
obtained from other global sources, e.g. the machine information
1522+
from [XrayPulses][extra.components.Xraypulses].
1523+
1524+
Args:
1525+
detector (SourceData): Instrument source of an XTDF source.
1526+
ppt_anchor (int or PulsePattern, optional): Constant offset to
1527+
add to XTDF pulse IDs, or PulsePattern-based component to
1528+
correlate every train individually. No correlation is done
1529+
by default.
1530+
first_lit_cell (int, optional): Which cell coincides with the
1531+
first pulse from passed ppt_anchor, ignored unless a
1532+
PulsePattern component is passed.
1533+
include_cells (bool, optional): Whether to include cell IDs
1534+
in the pulse index generated by this component, True by
1535+
default.
1536+
"""
1537+
1538+
def __init__(self, xtdf_source, ppt_anchor=None, first_lit_cell=0,
1539+
include_cells=True):
15151540
super().__init__(xtdf_source, xtdf_source['image.pulseId'])
15161541

1517-
self._cell_key = xtdf_source['image.cellId'] if include_cells else None
15181542
self._ppt_anchor = ppt_anchor
15191543
self._first_lit_cell = first_lit_cell
1544+
self._cell_key = xtdf_source['image.cellId'] if include_cells else None
15201545

15211546
def __repr__(self):
15221547
return "<{} using {}>".format(type(self).__name__, self._source.source)

0 commit comments

Comments
 (0)