class Pipe

class scTDC.Pipe(typestr, par, parent)

This class handles various types of data received from scTDC library pipes, such as

  • 1D, 2D, 3D histograms from DLD (detected particle) events

  • statistics data at the end of measurements

  • time histograms from stand-alone TDCs.

Instantiation of this class should only happen through calls to the add_XYZ_pipe functions from the Device class. Use methods of this class to access the data produced by the Pipe.

__init__(typestr, par, parent)

Constructs a Pipe object. Creates the data buffer and opens the pipe in the scTDC library for the parent Device.

Parameters
is_open()

Query whether the pipe is active / open.

Returns

True, if the pipe is active in the scTDC library (if so, the library writes to the data buffer during measurements and increments histogram entries on incoming events).

Return type

bool

reopen(force=False)

Open a pipe with previous parameters, if not currently open.

Parameters

force (bool, optional) – set this to True, if the pipe has not been explicitly closed, but the device was deinitialized, causing an implicit destruction of the pipe (implicit desctruction only happens through low-level API calls, whereas Device.deinitialize will close all pipe objects and delete references to them), defaults to False

Returns

None if nothing to do, (0, “”) on success, (error code, message) on failure

Return type

None | (int, str)

close()

Close the pipe such that no events are sorted into the data buffer anymore. The data buffer remains unchanged. In that sense, closing acts more like setting the pipe inactive the pipe can be reopened later. The data buffer can only be garbage-collected after deleting the pipe object via the parent device and discarding all other references to the Pipe object.

Returns

(0, “”) if success, (error code, message) on failure

Return type

(int, str)

get_buffer_view()

For 1D, 2D, 3D pipes, get a numpy array of the data buffer, constructed without copying. As a consequence, changes to the data buffer, made by the scTDC library after getting the buffer view, will be visible to the numpy array returned from this function. The indexing is in Fortran order, i.e. x, y, time. If the pipe is a statistics pipe, get the statistics_t object which may be modified subsequently by the scTDC.

Returns

a view of the static data buffer

Return type

numpy.ndarray | statistics_t

get_buffer_copy()

For 1D, 2D, 3D pipes, get a numpy array of a copy of the data buffer. The indexing is in Fortran order, i.e. x, y, time. If the pipe is a statistics pipe, return a copy of the statistics_t object.

Returns

a copy of the data buffer

Return type

numpy.ndarray | statistics_t

clear()

Set all voxels of the data buffer to zero