CrosstalkMatrix

class qililab.CrosstalkMatrix

Bases: object

A class to represent a crosstalk matrix where each index corresponds to a bus.

Attributes Summary

yaml_tag

Methods Summary

flux_to_bias(flux)

Converts target flux values to hardware bias values using linear inversion.

from_array(buses, matrix_array)

Creates crosstalk matrix from an array and corresponding set of buses.

from_buses(buses)

Creates a CrosstalkMatrix with all possible associations set to 1.0.

inverse()

Returns the inverse version of the crosstalk matrix (as a bus dictionary).

set_offset(offset)

Modifies the offset based on the given bus and offset value

set_resistances(resistances)

Modifies the resistances dictionary based on the given bus and resistance value.

to_array()

Returns the np.array representation of the crosstalk matrix.

Attributes Documentation

yaml_tag = '!CrosstalkMatrix'

Methods Documentation

flux_to_bias(flux)

Converts target flux values to hardware bias values using linear inversion.

Applies the inverse of the crosstalk matrix to the flux vector, accounting for flux offsets. Both scalar and array inputs are supported — array inputs are processed element-wise, enabling sweep-based use cases.

Parameters:

flux (dict[str, float | np.ndarray]) – Target flux values keyed by bus name. Values can be scalars or numpy arrays of the same length.

Returns:

Hardware bias values keyed by bus name.

Return type:

dict[str, float | np.ndarray]

classmethod from_array(buses, matrix_array)

Creates crosstalk matrix from an array and corresponding set of buses. For a set of buses [bus1,bus2,…,busN] the corresponding matrix should have the same indices for rows and columns i.e. for the set of buses [bus1,bus2,…,busN], matrix[0,0] will be the coefficient for bus1[bus1], matrix[0,1] will be bus1[bus2], etc.

Parameters:
  • buses (list[str]) – ordered list of buses for the crosstalk matrix

  • matrix_array (np.ndarray) – crosstalk matrix numpy array

Returns:

CrosstalkMatrix: An instance of CrosstalkMatrix

Return type:

CrosstalkMatrix

classmethod from_buses(buses)

Creates a CrosstalkMatrix with all possible associations set to 1.0.

Parameters:

buses (Sequence[str]) – A sequence of bus names.

Returns:

An instance of CrosstalkMatrix with all associations set to 1.0.

Return type:

CrosstalkMatrix

inverse()

Returns the inverse version of the crosstalk matrix (as a bus dictionary).

Returns:

inverse crosstalk matrix

Return type:

CrosstalkMatrix

set_offset(offset)

Modifies the offset based on the given bus and offset value

Parameters:

offset (dict[str, float]) – dictionary containing the buses of the offsets to be added or modified and the value of said offsets

set_resistances(resistances)

Modifies the resistances dictionary based on the given bus and resistance value.

Parameters:

resistances (dict[str, float]) – dictionary containing the resistances for each bus to be added or modified and the value of said resistance

to_array()

Returns the np.array representation of the crosstalk matrix.

Returns:

crosstalk matrix as a numpy array.

Return type:

np.ndarray