Calibration

class qililab.Calibration

Bases: object

A class to manage calibration data.

Attributes Summary

yaml_tag

Methods Summary

add_block(name, block)

Add a block.

add_inter_crosstalk(full_crosstalk_matrix)

Function to save the inter qubit crosstalk results iteration.

add_intra_crosstalk(flux_offsets, ...)

Function to save the intra qubit crosstalk results iteration.

add_waveform(bus, name, waveform)

Add a waveform or IQPair for the specified bus.

add_weights(bus, name, weights)

Add a weight for the specified bus.

get_block(name)

Retrieve the block with the given name.

get_waveform(bus, name)

Retrieve waveform for the bus.

get_weights(bus, name)

Retrieve weights for the bus.

has_block(name)

Check if there is a block with the given name.

has_waveform(bus, name)

Check if there is an associated waveform for the bus.

has_weights(bus, name)

Check if there are associated weights for the bus.

remove_history_step([idx])

Function to remove an iteration inside the crosstalk history in case the user wants to remove a specific faulty calibration.

Attributes Documentation

yaml_tag = '!Calibration'

Methods Documentation

add_block(name, block)

Add a block.

Parameters:
  • name (str) – The name of the block to add.

  • block (Block) – The block to add.

add_inter_crosstalk(full_crosstalk_matrix)

Function to save the inter qubit crosstalk results iteration. The full crosstalk matrix is stored raw inside crosstalk_history and crosstalk_matrix.matrix after a transformation.

The transformation used for crosstalk_matrix.matrix is the following:

\[offset_{new} = \prod_{i=n}^{0} M_{i} · M_{old}\]

where n is the number of iterations registered and M_i is the Full Matrix for the given i iteration. The resulting crosstalk matrix will be the matrix product of all registered full matrices and the original crosstalk matrix.

Parameters:

full_crosstalk_matrix (dict[str, dict[str, float]]) – Full crosstalk matrix result from inter qubit fitting.

Raises:

ValueError – If no crosstalk has been given to calibration file.

add_intra_crosstalk(flux_offsets, block_diag_xt_matrix)

Function to save the intra qubit crosstalk results iteration. The offsets is stored inside crosstalk_history and crosstalk_matrix.flux_offsets after a transformation. The Diagonal matrix is stored raw inside crosstalk_history and crosstalk_matrix.matrix after a transformation.

The transformations that are used to update crosstalk_matrix.flux_offsets and crosstalk_matrix.matrix are the following:

\[offset_{new} = M_{diag block} · offset_{old} + offset_{result}\]

and

\[M_{updated} = M_{diag block} · M_{old}\]

given the Diagonal Block Matrix and Offset Result as inputs. The updated crosstalk matrix will be a diagonal block until the inter-qubit crosstalk is added.

Parameters:
  • flux_offsets (dict[str, float]) – Crosstalk offsets fitted with intra qubit data.

  • block_diag_xt_matrix (dict[str, dict[str, float]]) – Diagonal crosstalk matrix result from intra qubit fitting.

Raises:

ValueError – If no crosstalk has been given to calibration file.

add_waveform(bus, name, waveform)

Add a waveform or IQPair for the specified bus.

Parameters:
  • bus (str) – The bus to which the operation will be added.

  • operation (str) – The name of the operation to add.

  • waveform (Waveform | IQPair) – The waveform or IQPair instance representing the operation.

add_weights(bus, name, weights)

Add a weight for the specified bus.

Parameters:
  • bus (str) – The bus to which the operation will be added.

  • operation (str) – The name of the operation to add.

  • waveform (Waveform | IQPair) – The waveform or IQPair instance representing the operation.

get_block(name)

Retrieve the block with the given name.

Parameters:

name (str) – The name of the block to retrieve.

Raises:

KeyError – If the block does not exist.

Returns:

The block with the given name.

Return type:

Block

get_waveform(bus, name)

Retrieve waveform for the bus.

Parameters:
  • bus (str) – The bus to check for the waveform.

  • name (str) – The name of the operation to retrieve.

Raises:

KeyError – If the waveform does not exist for the bus.

Returns:

The waveform associated with the bus.

Return type:

Waveform | IQPair

get_weights(bus, name)

Retrieve weights for the bus.

Parameters:
  • bus (str) – The bus to check for the weights.

  • name (str) – The name of the weights to retrieve.

Raises:

KeyError – If the weights do not exist for the bus.

Returns:

The weights associated with the bus.

Return type:

IQPair

has_block(name)

Check if there is a block with the given name.

Parameters:

name (str) – The name of the block to check.

Returns:

True if there is a block with the given name, False otherwise.

Return type:

bool

has_waveform(bus, name)

Check if there is an associated waveform for the bus.

Parameters:
  • bus (str) – The bus to check for the waveform.

  • operation (str) – The name of the waveform to check.

Returns:

True if there is an associated waveform with the bus, False otherwise.

Return type:

bool

has_weights(bus, name)

Check if there are associated weights for the bus.

Parameters:
  • bus (str) – The bus to check for the weights.

  • operation (str) – The name of the weights to check.

Returns:

True if there are associated weights with the bus, False otherwise.

Return type:

bool

remove_history_step(idx=-1)

Function to remove an iteration inside the crosstalk history in case the user wants to remove a specific faulty calibration.

Parameters:

idx (int, optional) – Index number. Defaults to the last value of the list.

Raises:

ValueError – If no crosstalk history has been created.