qcodes_contrib_drivers.drivers.SwabianInstruments package

Subpackages

Submodules

qcodes_contrib_drivers.drivers.SwabianInstruments.Swabian_Instruments_Time_Tagger module

QCoDeS driver for the Swabian Instruments Time Tagger series.

Since the Swabian Instruments Python driver is already excellent, this driver is mostly concerned with wrapping its object-oriented API into QCoDeS Instruments and Parameters. It is organized as follows:

  • The actual device driver is TimeTagger, which wraps the API TimeTagger:TimeTagger object.

  • Measurements and Virtual Channels are implemented as InstrumentChannels, which should dynamically be added and removed from the TimeTagger instrument’s corresponding ChannelList as needed. These channels own Parameters which may be required to be initialized to instantiate the API object of the TimeTagger library that actually controls the measurement.

  • If properly initialized, each QCoDeS instrument or channel has a cached api() property that gives access to the TimeTagger API object. The cache is automatically invalidated if a Parameter is changed that was used to instantiate the object (e.g., the binwidth).

  • TimeTaggerVirtualChannel and TimeTaggerMeasurement inherit from the abstract TimeTaggerModule, and subclasses are automatically registered. This is used to generate convenience methods in the TimeTagger instrument to add a new measurement or virtual channel to its corresponding channel list.

  • Measurements inherit common functionality from IteratorBase (formatted in snake_case).

  • The TimeTagger instrument has a submodule synchronized_measurements that wraps the API TimeTagger:SynchronizedMeasurements and allows for syncing multiple measurements using the same tagger.

  • Parameters in this driver are named according to their API counterparts. See the API documentation for their explanations.

Implementing new Measurement or VirtualChannel classes

As corresponding channel lists are automatically added to the main instrument driver, to implement new measurements or virtual channels from the TimeTagger API one simply needs to inherit from TimeTaggerMeasurement or TimeTaggerVirtualChannel, respectively. The subclasses should have a api() method decorated with cached_api_object(), which takes care of asserting all required parameters are initialized as well as invalidating the object if parameters changed. For the former, required parameters should be passed as argument to the decorator. For the latter, required parameters should be instances of ParameterWithSetSideEffect, with the side effect argument set_side_effect=self._invalidate_api. Note that, if parameter classes other than Parameter are required, one could dynamically modify them to include set side effects. For now and for legibility, only this class is provided.

class qcodes_contrib_drivers.drivers.SwabianInstruments.Swabian_Instruments_Time_Tagger.CoincidenceVirtualChannel(parent: InstrumentBase, name: str, api_tagger: tt.TimeTaggerBase | None = None, **kwargs: Any)[source]

Bases: TimeTaggerVirtualChannel

Implements API object TimeTagger:Coincidence – see the documentation there.

api
channels = self.add_parameter( 'channels', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Channels', vals=vals.Sequence(vals.Ints()) )

List of channels on which coincidence will be detected in the virtual channel.

coincidence_window = self.add_parameter( 'coincidence_window', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Coincidence window', unit='ps', initial_value=1000, vals=vals.Numbers(min_value=1), set_parser=int )

Maximum time between all events for a coincidence.

timestamp = self.add_parameter( 'timestamp', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Timestamp', initial_value=tt.CoincidenceTimestamp.Last, vals=vals.Enum(*tt.CoincidenceTimestamp) )

Type of timestamp for virtual channel.

class qcodes_contrib_drivers.drivers.SwabianInstruments.Swabian_Instruments_Time_Tagger.CombinerVirtualChannel(parent: InstrumentBase, name: str, api_tagger: tt.TimeTaggerBase | None = None, **kwargs: Any)[source]

Bases: TimeTaggerVirtualChannel

Implements API object TimeTagger:Combiner – see the documentation there.

api
channels = self.add_parameter( 'channels', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Channels', vals=vals.Sequence(vals.Ints()) )

List of channels to be combined into a single virtual channel.

class qcodes_contrib_drivers.drivers.SwabianInstruments.Swabian_Instruments_Time_Tagger.CorrelationMeasurement(parent: InstrumentBase, name: str, api_tagger: tt.TimeTaggerBase | None = None, **kwargs: Any)[source]

Bases: TimeTaggerMeasurement

Implements API object TimeTagger:Correlation – see the documentation there.

api
binwidth = self.add_parameter( 'binwidth', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Binwidth', unit='ps', initial_value=1000, vals=vals.Numbers(min_value=1), set_parser=int )

Bin width in ps.

channels = self.add_parameter( 'channels', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Channels', vals=vals.MultiType(vals.Sequence(vals.Ints(), length=1), vals.Sequence(vals.Ints(), length=2)) )

Channel on which (stop) clicks are received and channel on which reference clicks (start) are received (when left empty or set to TimeTagger:CHANNEL_UNUSED -> an auto-correlation measurement is performed, which is the same as setting channel_1 = channel_2).

data = self.add_parameter( 'data', ParameterWithSetpoints, get_cmd=lambda: self.api.getData(), vals=vals.Arrays(shape=(self.n_bins.get_latest,), valid_types=(np.int32,)), setpoints=(self.time_bins,), label='Data', unit='cts', max_val_age=0.0 )

A one-dimensional array of size n_bins containing the histogram.

data_normalized = self.add_parameter( 'data_normalized', ParameterWithSetpoints, get_cmd=lambda: self.api.getDataNormalized(), vals=vals.Arrays(shape=(self.n_bins.get_latest,), valid_types=(np.float64,)), setpoints=(self.time_bins,), label='Normalized data', max_val_age=0.0 )

Data normalized by the binwidth and the average count rate.

n_bins = self.add_parameter( 'n_bins', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Number of bins', initial_value=1000, vals=vals.Numbers(min_value=1), set_parser=int )

The number of bins in the resulting histogram.

time_bins = self.add_parameter( 'time_bins', Parameter, label='Time bins', unit='ps', get_cmd=lambda: self.api.getIndex(), vals=vals.Arrays(shape=(self.n_bins.get_latest,), valid_types=(np.int64,)) )

A vector of size n_bins containing the time bins in ps.

class qcodes_contrib_drivers.drivers.SwabianInstruments.Swabian_Instruments_Time_Tagger.CountRateMeasurement(parent: InstrumentBase, name: str, api_tagger: tt.TimeTaggerBase | None = None, **kwargs: Any)[source]

Bases: TimeTaggerMeasurement

Implements API object TimeTagger:CountRate – see the documentation there.

api
channels = self.add_parameter( 'channels', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Channels', vals=vals.Sequence(vals.Ints()) )

Channels for which the average count rate is measured.

counts_total = self.add_parameter( 'counts_total', ParameterWithSetpoints, get_cmd=lambda: self.api.getCountsTotal(), vals=vals.Arrays(shape=(number_of_channels,), valid_types=(np.int32,)), setpoints=(self.__channels_proxy,), label='Total counts', max_val_age=0.0 )

The total number of events since the instantiation of this object.

data = self.add_parameter( 'data', ParameterWithSetpoints, get_cmd=lambda: self.api.getData(), vals=vals.Arrays(shape=(number_of_channels,), valid_types=(np.float64,)), setpoints=(self.__channels_proxy,), label='Data', unit='Hz', max_val_age=0.0 )

Average count rate in counts per second.

class qcodes_contrib_drivers.drivers.SwabianInstruments.Swabian_Instruments_Time_Tagger.CounterMeasurement(parent: InstrumentBase, name: str, api_tagger: tt.TimeTaggerBase | None = None, **kwargs: Any)[source]

Bases: TimeTaggerMeasurement

Implements API object TimeTagger:Counter – see the documentation there.

api
binwidth = self.add_parameter( 'binwidth', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Binwidth', unit='ps', initial_value=10 ** 9, vals=vals.Numbers(min_value=1), set_parser=int )

Bin width in ps.

channels = self.add_parameter( 'channels', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Channels', vals=vals.Sequence(vals.Ints()) )

Channels used for counting tags.

data = self.add_parameter( 'data', ParameterWithSetpoints, get_cmd=lambda: self.api.getData(self.rolling()), vals=vals.Arrays(shape=(number_of_channels, self.n_values.get_latest), valid_types=(np.int32,)), setpoints=(self.__channels_proxy, self.time_bins), label='Data', unit='cts', max_val_age=0.0 )

An array of size ‘number of channels’ by n_values containing the counts in each fully integrated bin.

data_normalized = self.add_parameter( 'data_normalized', ParameterWithSetpoints, get_cmd=lambda: self.api.getDataNormalized(self.rolling()), vals=vals.Arrays(shape=(number_of_channels, self.n_values.get_latest), valid_types=(np.float64,)), setpoints=(self.__channels_proxy, self.time_bins,), label='Normalized data', unit='Hz', max_val_age=0.0 )

Does the same as data but returns the count rate in Hz as a float.

Not integrated bins and bins in overflow mode are marked as NaN.

data_total_counts = self.add_parameter( 'data_total_counts', Parameter, label='Total number of events', get_cmd=lambda: self.api.getDataTotalCounts(), set_cmd=False, max_val_age=0.0, vals=vals.Arrays(shape=(number_of_channels,), valid_types=(np.uint64,)) )

Number of events per channel.

Returns total number of events per channel since the last call to clear(), including the currently integrating bin. This method works correctly even when the USB transfer rate or backend processing capabilities are exceeded.

n_values = self.add_parameter( 'n_values', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Number of bins', initial_value=1, vals=vals.Numbers(min_value=1), set_parser=int )

Number of bins.

rolling = self.add_parameter( 'rolling', Parameter, label='Rolling buffer', set_cmd=None, initial_value=True, vals=vals.Bool() )

Controls how the counter array is filled.

time_bins = self.add_parameter( 'time_bins', Parameter, label='Time bins', unit='ps', get_cmd=lambda: self.api.getIndex(), vals=vals.Arrays(shape=(self.n_values.get_latest,), valid_types=(np.int64,)) )

Returns the relative time of the bins in ps.

The first entry of the returned vector is always 0.

class qcodes_contrib_drivers.drivers.SwabianInstruments.Swabian_Instruments_Time_Tagger.HistogramLogBinsMeasurement(parent: InstrumentBase, name: str, api_tagger: tt.TimeTaggerBase | None = None, **kwargs: Any)[source]

Bases: TimeTaggerMeasurement

Implements API object TimeTagger:HistogramLogBins – see the documentation there.

api
click_channel = self.add_parameter( 'click_channel', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Click channel', vals=vals.Ints() )

Channel on which clicks are received.

click_gate = self.add_parameter( 'click_gate', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Evaluation gate for click channel', vals=vals.MultiType(vals.Enum(None), TypeValidator(tt.ChannelGate)) )

Optional evaluation gate for the click_channel.

counts = self.add_parameter( 'counts', ParameterWithSetpoints, get_cmd=lambda: self.api.getDataObject().getCounts(), vals=vals.Arrays(shape=(n_bins,), valid_types=(np.uint64,)), setpoints=(self.time_bins,), label='Counts', unit='cts', max_val_age=0.0 )

A one-dimensional array of size n_bins containing the histogram.

exp_start = self.add_parameter( 'exp_start', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Start exponent', vals=vals.Numbers(min_value=-12), set_parser=float )

Exponent 10^exp_start in seconds where the very first bin begins.

exp_stop = self.add_parameter( 'exp_stop', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Stop exponent', vals=vals.Numbers(min_value=-12), set_parser=float )

Exponent 10^exp_stop in seconds where the very last bin ends.

g2 = self.add_parameter( 'g2', ParameterWithSetpoints, get_cmd=lambda: self.api.getDataObject().getG2(), vals=vals.Arrays(shape=(n_bins,), valid_types=(np.float64,)), setpoints=(self.time_bins,), label=r'$g^{(2)}(\tau)$', max_val_age=0.0 )

The counts normalized by the binwidth of each bin and the average count rate.

n_bins = self.add_parameter( 'n_bins', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Number of bins', vals=vals.Numbers(min_value=1), set_parser=int )

The number of bins in the histogram.

start_channel = self.add_parameter( 'start_channel', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Start channel', vals=vals.Ints() )

Channel on which start clicks are received.

start_gate = self.add_parameter( 'start_gate', ParameterWithSetSideEffect, set_side_effect=self._invalidate_api, label='Evaluation gate for start channel', vals=vals.MultiType(vals.Enum(None), TypeValidator(tt.ChannelGate)) )

Optional evaluation gate for the start_channel.

time_bin_edges = self.add_parameter( 'time_bin_edges', Parameter, label='Time bin edges', unit='ps', get_cmd=lambda: self.api.getBinEdges(), vals=vals.Arrays(shape=(n_bin_edges,), valid_types=(np.int64,)) )

A vector of size n_bins+1 containing the bin edges in picoseconds.

time_bins = self.add_parameter( 'time_bins', DelegateParameter, source=self.time_bin_edges, label='Time bins', get_parser=lambda val: val[:-1] + np.diff(val) // 2, vals=vals.Arrays(shape=(n_bins,), valid_types=(np.int64,)), bind_to_instrument=True )

A vector of size n_bins containing the bin centers in picoseconds.

class qcodes_contrib_drivers.drivers.SwabianInstruments.Swabian_Instruments_Time_Tagger.TimeTagger(*args: Any, **kwargs: Any)[source]

Bases: TimeTaggerInstrumentBase, Instrument

QCoDeS driver for Time Tagger devices.

__init__(name: str, serial: str = '', **kwargs)[source]

Initialize a TimeTagger instrument.

Parameters:
  • name – The instrument name

  • serial – The device’s serial number. If left empty, the first available device is connected to.

close() None[source]

Irreversibly stop this instrument and free its resources.

Subclasses should override this if they have other specific resources to close.

get_idn() Dict[str, str | None][source]

Parse a standard VISA *IDN? response into an ID dict.

Even though this is the VISA standard, it applies to various other types as well, such as IPInstruments, so it is included here in the Instrument base class.

Override this if your instrument does not support *IDN? or returns a nonstandard IDN string. This string is supposed to be a comma-separated list of vendor, model, serial, and firmware, but semicolon and colon are also common separators so we accept them here as well.

Returns:

A dict containing vendor, model, serial, and firmware.

get_input_delay(channel: int) int[source]

Implements API object TimeTagger:TimeTaggerBase.getInputDelay() – see the documentation there.

get_test_signal(channel: int) bool[source]

Implements API object TimeTagger:TimeTagger.getTestSignal() – see the documentation there.

get_trigger_level(channel: int) float[source]

Implements API object TimeTagger:TimeTagger.getTriggerLevel() – see the documentation there.

remove_all_measurements()[source]

Remove all entries of TimeTaggerMeasurement instances from channel lists.

remove_all_virtual_channels()[source]

Remove all entries of TimeTaggerVirtualChannel instances from channel lists.

set_input_delay(channel: int, delay: int)[source]

Implements API object TimeTagger:TimeTaggerBase.setInputDelay() – see the documentation there.

set_test_signal(channels: list[int], state: bool)[source]

Implements API object TimeTagger:TimeTagger.setTestSignal() – see the documentation there.

set_trigger_level(channel: int, level: float)[source]

Implements API object TimeTagger:TimeTagger.setTriggerLevel() – see the documentation there.

property api: tt.TimeTaggerBase
property measurement_lists: list[ChannelList[_TimeTaggerMeasurementT]]

All submodules that implement a TimeTaggerMeasurement.

property virtual_channel_lists: list[ChannelList[_TimeTaggerVirtualChannelT]]

All submodules that implement a TimeTaggerVirtualChannel.

Module contents