ASI TPX3 reference

class libertem_live.detectors.asi_tpx3.AsiTpx3Acquisition(conn: AsiTpx3DetectorConnection, hooks: Hooks | None = None, pending_aq: AsiTpx3PendingAcquisition | None = None, controller: AcquisitionController | None = None, nav_shape: tuple[int, ...] | None = None, frames_per_partition: int | None = None)[source]

Acquisition from a ASI TPX3 detector

Use libertem_live.api.LiveContext.make_acquisition() to instantiate this class!

Examples

>>> with ctx.make_connection('asi_tpx3').open(
...     data_port=TPX3_PORT,
... ) as conn:
...     pending_aq = conn.wait_for_acquisition(1.0)
...     aq = ctx.make_acquisition(
...         conn=conn,
...         pending_aq=pending_aq,
...     )
Parameters:
  • conn – An existing AsiDetectorConnection instance

  • nav_shape – The number of scan positions as a 2-tuple (height, width)

  • frames_per_partition – A tunable for configuring the feedback rate - more frames per partition means slower feedback, but less computational overhead. Might need to be tuned to adapt to the dwell time.

  • pending_aq – A pending acquisition in passive mode, obtained from AsiTpx3DetectorConnection.wait_for_acquisition().

  • hooks – Acquisition hooks to react to certain events

property dtype

The “native” data type (either one matching the data on disk, or one that is closest)

property shape

The shape of the DataSet, as it makes sense for the application domain (for example, 4D for pixelated STEM)

class libertem_live.detectors.asi_tpx3.AsiTpx3ConnectionBuilder[source]

Builder class that can construct AsiTpx3DetectorConnection instances.

Use the open() method to create a connection.

open(data_host: str = '127.0.0.1', data_port: int = 8283, buffer_size: int = 2048, bytes_per_chunk: int | None = None, chunks_per_stack: int = 24, huge_pages: bool = False) AsiTpx3DetectorConnection[source]

Connect to the ASI TPX3 detector software (Accos).

Parameters:
  • data_host – The hostname or IP address of the computer running Accos

  • data_port – The TCP port to connect to

  • buffer_size – The total receive buffer in MiB that is used to stream data to worker processes.

  • bytes_per_chunk – How large is each chunk, in bytes. Approximate value, as this can change depending on events per scan position

  • chunks_per_stack – How many chunks should we assemble to a chunk stack?

  • huge_pages

    Set to True to allocate shared memory in huge pages. This can improve performance by reducing the page fault cost. Currently only available on Linux. Enabling this requires reserving huge pages, either at system start, or before connecting.

    For example, to reserve 10000 huge pages, you can run:

    echo 10000 | sudo tee /proc/sys/vm/nr_hugepages

    See also the hugeadm utility, especially hugeadm --explain can be useful to check your configuration.

class libertem_live.detectors.asi_tpx3.AsiTpx3DetectorConnection(data_host: str, data_port: int, buffer_size: int = 2048, bytes_per_chunk: int | None = None, chunks_per_stack: int = 24, huge_pages: bool = False)[source]

Connection to the ASI TPX3 software.

Please see libertem_live.detectors.asi_tpx3.AsiTpx3ConnectionBuilder for a description of the parameters, and use libertem_live.api.LiveContext.make_connection() to create a connection.

close()[source]

Close the connection. It’s important to call this function once you don’t need the connection anymore, as an open connection might interfere with other software using the detector.

If possible, use this object as a context manager instead, using a with-statement.

wait_for_acquisition(timeout: float | None = None) PendingAcquisition | None[source]

Wait for at most timeout seconds for an acquisition to start. This does not perform any triggering itself and expects something external to arm and trigger the acquisition.

Once the detector is armed, this function returns a PendingAcquisition, which can be converted to a full Acquisition object using libertem_live.api.LiveContext.make_acquisition().

The function returns None on timeout.

Parameters:

timeout – Timeout in seconds. If None, wait indefinitely.

class libertem_live.detectors.asi_tpx3.AsiTpx3PendingAcquisition(acquisition_header)[source]
property nav_shape: tuple[int, ...]

The concrete nav_shape, if it is known by the detector

property nimages: int

The total number of images that are expected for this acquisition