tpx4sc

TimePix4 socket control class for Spidr4 readout system.

Functions

tpx4_parse_stop_run(msg, _)

Classes

TPX4SC(*args, **kwargs)

SCPIInstrument implementation for Timepix4 readout via SPIDR4 system.

tpx4_parse_stop_run

icicle.tpx4sc.tpx4_parse_stop_run(msg, _)

TPX4SC

class icicle.tpx4sc.TPX4SC(*args, **kwargs)

Bases: SCPIInstrument

SCPIInstrument implementation for Timepix4 readout via SPIDR4 system.

Communicates with tpx4sc tool in Spidr4 tools package.

__init__(resource='ASRL30::INSTR', sim=False)
Parameters:

resource – VISA Resource address. See VISA docs for more info.

COM_RESET = ''

Instrument Reset SCPI command.

MEASURE_TYPES = {'BOT:BYTECOUNT': 'Number of bytes read out from bottom chip half', 'TOP:BYTECOUNT': 'Number of bytes read out from top chip half'}
class MeasureChannel(instrument, channel, measure_type, unit='')

Bases: MeasureChannel

MeasureChannel implementation for the tpx4sc.

property status
Returns:

Connection?

Return type:

int

property value

Performs measurement and returns value.

Returns:

measured value.

Return type:

float

SETTINGS = {'CONFIGURE': {'SET': 'configure', 'parser': <function catch_failure.<locals>._catch_failure>}, 'CONFIGURED': {'QUERY': 'is_configured', 'parser': <function string_bool.<locals>._string_bool>}, 'IDENTIFIER': {'QUERY': 'get_devid'}, 'MONITORING': {'QUERY': 'is_monitoring', 'parser': <function string_bool.<locals>._string_bool>}, 'QUIT': {'SET': '/q', 'parser': <function catch_failure.<locals>._catch_failure>}, 'RESTART_READOUT': {'SET': 'restart_readout', 'parser': <function catch_failure.<locals>._catch_failure>}, 'RUNNING': {'QUERY': 'is_running', 'parser': <function string_bool.<locals>._string_bool>}, 'START_MONITORING': {'SET': 'start_mon', 'parser': <function catch_failure.<locals>._catch_failure>}, 'START_RUN': {'SET': 'start_run {:d}', 'parser': <function TPX4SC.<lambda>>, 'verifier': <function is_integer.<locals>._is_integer>}, 'STOP_MONITORING': {'SET': 'stop_mon', 'parser': <function catch_failure.<locals>._catch_failure>}, 'STOP_RUN': {'SET': 'stop_run', 'parser': <function catch_failure.<locals>._catch_failure>}, 'THRESHOLD': {'QUERY': 'get_threshold', 'SET': 'set_threshold {:f}', 'parser': <function catch_failure.<locals>._catch_failure>, 'units': 'e', 'verifier': <function is_numeric.<locals>._is_numeric>}, 'USER_DATA': {'SET': 'user_data {:s}', 'parser': <function catch_failure.<locals>._catch_failure>}}

Settings dictionary with all Set/Query combinations.

SET_REQUIRES_READBACK = True

Every command must be sent as a query.

TIMEOUT = 3600000

Ethernet link timeout.

measure()

Measure data throughput in top and bottom chip halves.

Parameters:

no_lock – override acquire_lock (e.g. if lock already taken by function that measure-call is nested within).

Returns:

tuple (bottom_half_bytes_read, top_half_bytes_read).

query(setting, *params, **kwargs)

Query setting on instrument.

Parameters:
  • setting – key in class dictionary SETTINGS.

  • no_lock – override acquire_lock (e.g. if lock already taken by function that query-call is nested within).

  • attempts – how many retries to give query command.

Returns:

data returned by device for given query.

set(setting, *value, **kwargs)

Set setting on instrument to value, and read-back using equivalent query() if available.

Parameters:
  • setting – key in class dictionary SETTINGS.

  • value – target value for setting.

  • no_lock – override acquire_lock (e.g. if lock already taken by function that set_channel-call is nested within).

  • attempts – how many retries to give set command.

Returns:

read-back value if query() available, else whether number of bytes written during set() meets expectation

status()

Check status of tpx4sc.

Returns:

status string.

validate_channel(channel, raise_exception=True)

Check if an channel exists on this device. Only successful if channel == 1.

Parameters:

channel – Channel number to validate as an input