photons.equipment.idq_time_controller module

Time Controller from ID Quantique.

class photons.equipment.idq_time_controller.Clock(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

INTERNAL = 'INTERNAL'
EXTERNAL = 'EXTERNAL'
INT = 'INTERNAL'
EXT = 'EXTERNAL'
class photons.equipment.idq_time_controller.Coupling(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

AC = 'AC'
DC = 'DC'
class photons.equipment.idq_time_controller.Edge(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

RISING = 'RISING'
FALLING = 'FALLING'
class photons.equipment.idq_time_controller.Mode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

ACCUMULATE = 'ACCUM'
ACCUM = 'ACCUM'
CYCLE = 'CYCLE'
NIM = 'NIM'
TTL = 'TTL'
HIGH_SPEED = 'LOWRES'
HIGH_RESOLUTION = 'HIRES'
LOW_SPEED = 'HIRES'
LOW_RESOLUTION = 'LOWRES'
FAST = 'LOWRES'
SLOW = 'HIRES'
class photons.equipment.idq_time_controller.ResyncPolicy(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

AUTO = 'AUTO'
MANUAL = 'MANUAL'
class photons.equipment.idq_time_controller.Select(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

LOOP = 'LOOP'
OUTPUT = 'OUTPUT'
SHAPED = 'SHAPED'
UNSHAPED = 'UNSHAPED'
class photons.equipment.idq_time_controller.DelaySettings(address, value)[source]

Bases: object

address: str
value: float
to_json()[source]

Return the settings as a JSON serializable object.

Return type:

dict[str, str | float]

class photons.equipment.idq_time_controller.DeviceSettings(clock, mode)[source]

Bases: object

clock: Clock
mode: Mode
to_json()[source]

Return the settings as a JSON serializable object.

Return type:

dict[str, str]

class photons.equipment.idq_time_controller.Histogram(hist1, hist2, hist3, hist4)[source]

Bases: object

hist1: ndarray
hist2: ndarray
hist3: ndarray
hist4: ndarray
to_json()[source]

Return the histogram data as a JSON serializable object.

Return type:

dict[str, list]

class photons.equipment.idq_time_controller.HistogramSettings(channel, ref, stop, enabler, minimum, maximum, bin_count, bin_width)[source]

Bases: object

channel: int
ref: str
stop: str
enabler: str
minimum: float
maximum: float
bin_count: int
bin_width: float
to_json()[source]

Return the settings as a JSON serializable object.

Return type:

dict[str, str | int | float]

class photons.equipment.idq_time_controller.InputSettings(channel, coupling, edge, enabled, delay, duration, mode, resync_policy, select, threshold)[source]

Bases: object

channel: int
coupling: Coupling
edge: Edge
enabled: bool
delay: float
duration: float
mode: Mode
resync_policy: ResyncPolicy
select: Select
threshold: float
to_json()[source]

Return the settings as a JSON serializable object.

Return type:

dict[str, str | bool | int | float]

class photons.equipment.idq_time_controller.StartSettings(coupling, edge, enabled, delay, duration, mode, select, threshold)[source]

Bases: object

coupling: Coupling
edge: Edge
enabled: bool
delay: float
duration: float
mode: Mode
select: Select
threshold: float
to_json()[source]

Return the settings as a JSON serializable object.

Return type:

dict[str, str | bool | float]

class photons.equipment.idq_time_controller.IDQTimeController(record, **kwargs)[source]

Bases: BaseEquipment

Time Controller from ID Quantique.

Parameters:
  • record (EquipmentRecord) – The equipment record.

  • **kwargs – Keyword arguments. Can be specified as attributes of an XML element in a configuration file (with the tag of the element equal to the alias of record).

class Clock(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

INTERNAL = 'INTERNAL'
EXTERNAL = 'EXTERNAL'
INT = 'INTERNAL'
EXT = 'EXTERNAL'
class Coupling(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

AC = 'AC'
DC = 'DC'
class Edge(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

RISING = 'RISING'
FALLING = 'FALLING'
class Mode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

ACCUMULATE = 'ACCUM'
ACCUM = 'ACCUM'
CYCLE = 'CYCLE'
NIM = 'NIM'
TTL = 'TTL'
HIGH_SPEED = 'LOWRES'
HIGH_RESOLUTION = 'HIRES'
LOW_SPEED = 'HIRES'
LOW_RESOLUTION = 'LOWRES'
FAST = 'LOWRES'
SLOW = 'HIRES'
class ResyncPolicy(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

AUTO = 'AUTO'
MANUAL = 'MANUAL'
class Select(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

LOOP = 'LOOP'
OUTPUT = 'OUTPUT'
SHAPED = 'SHAPED'
UNSHAPED = 'UNSHAPED'
connection: ConnectionZeroMQ
counts_changed: SignalInstance
clear_high_resolution_error(channel)[source]

Clear the high-resolution error for an input channel.

Parameters:

channel (int) – The input channel number (1, 2, 3 or 4).

Return type:

None

configure_delay(*, block, address, value=0)[source]

Configure the settings for a DELAY block.

Parameters:
  • block (int) – The DELAY block number (1 through 8).

  • address (int | str | None) – The address to link the DELAY to. Can be an INPUT channel number (e.g., 1 or ‘INPUT1’), ‘START’ or None.

  • value (float) – The delay value, in seconds.

Return type:

DelaySettings

Returns:

The DELAY settings that were read from the device after the settings were written.

configure_device(*, clock, mode)[source]

Configure the DEVICE settings.

Parameters:
  • clock (Clock | str) – Use the internal or external clock.

  • mode (Mode | str) – The resolution mode (high speed or high resolution).

Return type:

DeviceSettings

Returns:

The DEVICE settings that were read from the device after the settings were written.

configure_histogram(*, channel, ref, stop=None, enabler='TSGE8', minimum=0, maximum=1e-06, bin_count=None, bin_width=1e-10)[source]

Configure a HISTOGRAM channel.

Parameters:
  • channel (int) – The HISTOGRAM channel number (1, 2, 3 or 4).

  • ref (int | str | None) – The INPUT channel number (0[START], 1, 2, 3 or 4) or the name of the reference channel (e.g., ‘TSCO5’)

  • stop (int | str | None) – The INPUT channel number (0[START], 1, 2, 3 or 4) or the name of the stop channel (e.g., ‘TSCO5’). If not specified, then the value of ref is used.

  • enabler (str) – The timestamp-generator block that determines when data acquisition begins and ends.

  • minimum (float) – Minimum time value, in seconds.

  • maximum (float) – Maximum time value, in seconds.

  • bin_count (int | None) – The number of time bins. If specified, then maximum is ignored. Must be between 1 and 16384.

  • bin_width (float) – The time-bin width, in seconds.

Return type:

HistogramSettings

Returns:

The HISTOGRAM settings that were read from the device after the settings were written.

configure_input(*, channel, coupling=Coupling.DC, delay=0, duration=1, edge=Edge.RISING, enabled=False, mode=Mode.CYCLE, resync_policy=ResyncPolicy.AUTO, select=Select.UNSHAPED, threshold=1)[source]

Configure an INPUT channel.

Parameters:
  • channel (int) – The input channel number (1, 2, 3 or 4).

  • coupling (Coupling | str) – Either AC or DC coupling.

  • delay (float) – The delay, in seconds, to add to the timestamp when an edge is detected. Must be between 0 and 1 second.

  • duration (float) – The number of seconds to count edges (integration time). Must be between 0.001 and 65.535 seconds.

  • edge (Edge | str) – The discriminator edge, either RISING or FALLING.

  • enabled (bool) – Whether the channel is enabled or disabled.

  • mode (Mode | str) – The counter mode (either CYCLE or ACCUMULATE).

  • resync_policy (ResyncPolicy | str) – The resync policy.

  • select (Select | str) – Select what feeds the INPUT block.

  • threshold (float) – The discriminator threshold value, in volts.

Return type:

InputSettings

Returns:

The INPUT settings that were read from the device after the settings were written.

configure_start(*, coupling=Coupling.DC, delay=0, edge=Edge.RISING, enabled=False, duration=1, mode=Mode.CYCLE, select=Select.UNSHAPED, threshold=1)[source]

Configure the START channel.

Parameters:
  • coupling (Coupling | str) – Either AC or DC coupling.

  • delay (float) – The delay, in seconds, to add to the timestamp when an edge is detected. Must be between 0 and 1 second.

  • edge (Edge | str) – The discriminator edge, either RISING or FALLING.

  • enabled (bool) – Whether the channel is enabled or disabled.

  • duration (float) – The number of seconds to count edges (integration time). Must be between 0.001 and 65.535 seconds.

  • mode (Mode | str) – The counter mode (either CYCLE or ACCUMULATE).

  • select (Select | str) – Select what feeds the START block.

  • threshold (float) – The discriminator threshold value, in volts.

Return type:

StartSettings

Returns:

The START settings that were read from the device after the settings were written.

count_edges(*, channel, allow_zero=False, nsamples=1)[source]

Count the number of edges per second.

Parameters:
  • channel (int) – The input channel number (e.g., 0[START], 1, 2, 3 or 4).

  • allow_zero (bool) – Whether to allow zero edges per second to be counted. Querying the COUNTER? value from the device immediately returns the value that is stored in the device’s memory. After resetting the device (i.e., the value returned by COUNTER? is 0) Python sleeps for duration seconds (see configure_input()) before querying COUNTER?. Since the computer clock and the device clock are not synced it is possible that COUNTER? is queried before the device writes a value to memory. If zero edges are detected and allow_zero is False then this method will block until at least 1 edge is detected.

  • nsamples (int) – The number of samples to acquire.

Return type:

Samples

Returns:

The number of edges per second.

has_high_resolution_error(channel)[source]

Check if an input channel has a high-resolution error.

Parameters:

channel (int) – The input channel number (1, 2, 3 or 4).

Return type:

bool

Returns:

Whether the specified channel has a high-resolution error.

load(config)[source]

Load a pre-defined configuration.

Parameters:

config (str) – The configuration to load (‘INIT’, ‘HISTO’, ‘COUNT’, or ‘BLANK’).

Return type:

None

recalibrate()[source]

Recalibrate the Time Controller.

Return type:

None

settings_delay(block)[source]

Get the settings of a DELAY block.

Parameters:

block (int) – The DELAY block number (1 through 8).

Return type:

DelaySettings

settings_device()[source]

Get the DEVICE settings.

Return type:

DeviceSettings

settings_histogram(channel)[source]

Get the settings of a HISTOGRAM channel.

Parameters:

channel (int) – The HISTOGRAM channel number (1, 2, 3 or 4).

Return type:

HistogramSettings

settings_input(channel)[source]

Get the settings of an INPUT channel.

Parameters:

channel (int) – The INPUT channel number (1, 2, 3 or 4).

Return type:

InputSettings

settings_start()[source]

Get the settings of the START channel.

Return type:

StartSettings

start_stop(*, clear=True, duration=30, enabler='TSGE8', min_events=0, timeout=None)[source]

Acquire a start-stop histogram of the duration between two edges.

Parameters:
  • clear (bool) – Whether to clear the histogram data before acquiring data.

  • duration (float) – The number of seconds to acquire data for.

  • enabler (str) – The timestamp-generator block that determines when data acquisition begins and ends.

  • min_events (Union[int, Sequence[int]]) – The minimum number of start-stop events, on each histogram channel, that must occur before returning to the calling program. If specified, then iteratively acquires data for duration seconds until the specified number of events has occurred.

  • timeout (float | None) – The maximum number of seconds to wait for min_events to occur. If a timeout occurs, the data that has been acquired is returned (an error is not raised).

Return type:

Histogram

Returns:

The histogram data.