Skip to content

Timepix

extra.components.Timepix3 ¤

Timepix3(data, detector=None, pulses=None, **kwargs)

Interface to Timepix3 event data.

Timepix3 is an event-based pixel detectors, generating a stream of events of when and how long a singular pixel is detected. This component gives convenient pd.dataframe-based access to directly acquired raw pixel events, as well as centroided events available after automatic processing. These centroids attempt to group events in time and space that belong to the same particle impact to a single event.

The component can be initialized with either the raw data source, the virtual calibrated source containing the centroided results or both. Pulse pattern information are necessary in both cases to sort events into pulses, as they are originally recorded by train.

Parameters:

Name Type Description Default
data DataCollection

Data to access Timepix3 data from.

required
detector str or tuple

Name of the detector, which may be the domain (first part of the source name up to the first slash) or a tuple with the explicit raw and centroided source name. If omitted, an attempt is made to detect them automatically.

None
pulses PulsePattern

Pulse component to pull pulse information. If omitted, an XrayPulses object is constructed from the data.

None

spatial_bins staticmethod ¤

spatial_bins(min_pos=0, max_pos=255, bins_per_px=1)

Build suitable bin edges for Timepix position data.

The bins are centered around pixel position to avoid binning artifacts otherwise commonly appearing with Timepix data.

Parameters:

Name Type Description Default
min_pos int

Lower spatial boundary, 0 by default.

0
max_pos int

Upper spatial boundary, 255 by default.

255
bins_per_px int

Number of bins per pixel, 1 by default

1

Returns:

Name Type Description
bins ndarray

Spatial bin edges.

pixel_events ¤

pixel_events(pulse_dim='pulseId', toa_offset=0.0, timewalk_lut=None, out_of_pulse_events=False, extended_columns=False, parallel=None)

Get raw pixel events as dataframe.

Loads the original raw pixel events as a dataframe and sorts them into pulses using the initialized pulse pattern component.

By default, only events the pulse windows are included. The out_of_pulse_events arguments allows to extend this to events before the first and after the last pulse.

An event is considered part of a particular pulse when its time-of-arrival is between the beginning of that and the next pulse For the last pulse, the single largest spacing between pulses is chosen while in case of a single pulse in the entire train, all pulses will be assigned to it. The toa_offset argument denotes the time-of-arrival at the start of the first pulse of the train.

Parameters:

Name Type Description Default
pulse_dim pulseId or pulseIndex or pulseTime

Which pulse coordinates to use in the index, pulse ID by default.

'pulseId'
toa_offset float

Time-of-arrival offset applied by train in microseconds, 0.0 by default.

0.0
timewalk_lut ArrayLike or PathLike or None

Timewalk LUT to correct ToA or path to a file compatible with np.load, none by default.

None
out_of_pulse_events bool

Whether to include hits before the first pulse and after the last pulse in virtual pulses labelled -np.inf and np.inf, False by default. If enabled, the pulse index dimension will be forced to float.

False
extended_columns bool

Whether to include the original time-of-arrival, readout position and centroid labels for each pixel event, False by default. Labels require centroiding data processed after Feburary 2024 to be present.

False
parallel int or None

Nunmber of parallel processes to use, by default 10 or a quarter of all cores whichever is lower. Any non-positive value or 1 disable parallelization.

None

Returns:

Name Type Description
hits DataFrame

Raw detector hits.

centroid_events ¤

centroid_events(pulse_dim='pulseId', toa_offset=0.0, out_of_pulse_events=False, extended_columns=False, parallel=None)

Get centroided events as dataframe.

Loads the processed centroided pixel events as a dataframe and sorts them into pulses using the initialized pulse pattern component. The arguments and behaviour are analogous to pixel_events().

Parameters:

Name Type Description Default
pulse_dim pulseId or pulseIndex or pulseTime

Which pulse coordinates to use in the index, pulse ID by default.

'pulseId'
toa_offset float

Time-of-arrival offset applied by train in microseconds, 0.0 by default.

0.0
out_of_pulse_events bool

Whether to include centroids before the first pulse and after the last pulse in virtual pulses labelled -np.inf and np.inf, False by default. If enabled, the pulse index dimension will be forced to float.

False
extended_columns bool

Whether to include the average and maximal time-over-threshold as well as original time-of-arrival and labels for each centroid, False by default.

False
parallel int or None

Nunmber of parallel processes to use, by default 10 or a quarter of all cores whichever is lower. Any non-positive value or 1 disable parallelization.

None

Returns:

Name Type Description
centroids DataFrame

Centroids.