qat.purr.compiler.devices module
- class Calibratable(*args, **kwargs)
Bases:
object
Allows this object to be loaded as a calibrated object when we get pickled.
- get_calibration()
- static load_calibration(calibration_string)
- static load_calibration_from_file(file_path)
Looks for this calibration in the passed-in directory or the default calibration save location.
- save_calibration_to_file(file_path, use_cwd=False)
Saves calibration to passed-in file path. use_cwd appends the working directory to any non-absolute path, otherwise it’ll search for common calibration config folders before defaulting to the one in source code.
- class ChannelType(value)
Bases:
Enum
An enumeration.
- acquire = 6
- cross_resonance = 4
- cross_resonance_cancellation = 5
- drive = 1
- freq_shift = 7
- macq = 8
- measure = 2
- second_state = 3
- class CyclicRefPickler(unpicklable=True, make_refs=True, max_depth=None, backend=None, keys=False, warn=False, max_iter=None, numeric_keys=False, use_decimal=False, use_base85=False, fail_safe=None, include_properties=False, handle_readonly=False, original_object=None)
Bases:
Pickler
Adds reference ID to each object that requires it, for use when re-pickling and generating accurate circular references.
- ref_field = 'py/obj_ref_id'
- class CyclicRefUnpickler(backend=None, keys=False, safe=True, v1_decode=False, on_missing='ignore', handle_readonly=False)
Bases:
Unpickler
Makes sure cyclic references are picked up correctly. Objects need to be pickled with CyclicRefPickler otherwise the tags required for this more precise detection won’t exist.
- reset()
Replace _objs with our own dictionary upon every reset. This is called from the constructor.
- class FakeList
Bases:
dict
This is a patch-up object because originally the reference-counting mechanism for jsonpickle used incrementing ID’s and relied upon the graph to be deterministic.
This isn’t the case in some situations, so we want to be able to match up object reference by their memory pointer instead. But we don’t really want a list a few billion elements long for many reasons.
This simply exposes the methods and functionality jsonpickle relies upon in the list, while also allowing us to use very large ints as lookup targets.
- append(val)
Appends a value on to the dictionary with key=length.
- class FreqShiftPulseChannel(id_, physical_channel, frequency=0.0, bias=0j, scale=1 + 0j, amp=0.0, active=True, fixed_if=False, **kwargs)
Bases:
PulseChannel
- class PhysicalBaseband(id_, frequency, if_frequency=250000000.0)
Bases:
QuantumComponent
,Calibratable
- class PhysicalChannel(id_, sample_time, baseband, block_size=None, phase_offset=0.0, imbalance=1.0, acquire_allowed=False, pulse_channel_min_frequency=0.0, pulse_channel_max_frequency=inf)
Bases:
QuantumComponent
,Calibratable
- property baseband_frequency
- property baseband_if_frequency
- property block_time
- create_freq_shift_pulse_channel(id_, frequency=0.0, bias=0j, scale=1 + 0j, amp=0.0, imbalance=None, phase_offset=None, active=True, fixed_if=False)
- create_pulse_channel(id_, frequency=0.0, bias=0j, scale=1 + 0j, fixed_if=False, imbalance=None, phase_offset=None)
- class PulseChannel(id_, physical_channel, frequency=0.0, bias=0j, scale=1 + 0j, fixed_if=False, imbalance=None, phase_offset=None, **kwargs)
Bases:
QuantumComponent
,Calibratable
Models a pulse channel on a particular device.
- property acquire_allowed
- property baseband_frequency
- property baseband_if_frequency
- property block_size
- property block_time
- full_id()
- property max_frequency
- property min_frequency
- partial_id()
- property physical_channel_id
- property sample_time
- class PulseChannelView(pulse_channel, channel_type, auxiliary_devices=None)
Bases:
PulseChannel
Each quantum device will have a unique view of a PulseChannel, which this class helps encapsulate. For example, a PulseChannel may be the driving channel for one qubit but to another qubit the same PulseChannel might be driving its second state. We need to be able to share pulse channel instances with different usages in this particular case.
Functionally this acts as an opaque wrapper to PulseChannel, forwarding all calls to the wrapped object.
pulse_channel: The PulseChannel this device is viewing. channel_type: How this devices intends the PulseChannel to be used. auxiliary_devices: Any extra devices this PulseChannel could be effecting except
the current one. For example in cross resonance pulses.
- class PulseShapeType(value)
Bases:
Enum
An enumeration.
- BLACKMAN = 'blackman'
- COS = 'cos'
- EXTRA_SOFT_SQUARE = 'extra_soft_square'
- GAUSSIAN = 'gaussian'
- GAUSSIAN_DRAG = 'gaussian_drag'
- GAUSSIAN_SQUARE = 'gaussian_square'
- GAUSSIAN_ZERO_EDGE = 'gaussian_zero_edge'
- ROUNDED_SQUARE = 'rounded_square'
- SECH = 'sech'
- SETUP_HOLD = 'setup_hold'
- SIN = 'sin'
- SOFTER_GAUSSIAN = 'softer_gaussian'
- SOFTER_SQUARE = 'softer_square'
- SOFT_SQUARE = 'soft_square'
- SQUARE = 'square'
- class QuantumComponent(id_, *args, **kwargs)
Bases:
object
Base class for any logical object which can act as a target of a quantum action - a Qubit or various channels for a simple example.
- full_id()
- class QuantumDevice(id_, physical_channel, measure_device=None)
Bases:
QuantumComponent
,Calibratable
A physical device whose main form of operation involves pulse channels.
- PTType = +PTType
- add_pulse_channel(pulse_channel, channel_type, auxiliary_devices=None)
- create_pulse_channel(channel_type, frequency=0.0, bias=0j, scale=1 + 0j, amp=0.0, active=True, fixed_if=False, auxiliary_devices=None, id_=None, imbalance=None, phase_offset=None)
- get_auxiliary_devices(pulse_channel)
- get_default_pulse_channel()
- get_pulse_channel(channel_type=None, auxiliary_devices=None)
- Return type:
PTType
- multi_device_pulse_channel_types = (cross_resonance, cross_resonance_cancellation)
- class Qubit(index, resonator, physical_channel, coupled_qubits=None, drive_amp=1.0, id_=None)
Bases:
QuantumDevice
Class modelling our superconducting qubit and holds all information relating to them.
- add_coupled_qubit(qubit)
- get_acquire_channel()
- Return type:
- get_all_channels()
Returns all channels associated with this qubit, including resonator channel and other auxiliary devices that act as if they are on this object.
- get_cross_resonance_cancellation_channel(linked_qubits)
- Return type:
- get_cross_resonance_channel(linked_qubits)
- Return type:
- get_drive_channel()
- get_freq_shift_channel()
- Return type:
- get_measure_channel()
- Return type:
- get_second_state_channel()
- Return type:
- class QubitCoupling(direction, quality=1)
Bases:
Calibratable
Direction of coupling stated in a tuple: (4,5) means we have a 4 -> 5 coupling. Quality is the quality-level of the coupling.
- class Resonator(id_, physical_channel, measure_device=None)
Bases:
QuantumDevice
Models a resonator on a chip. Can be connected to multiple qubits.
- get_acquire_channel()
- Return type:
- get_measure_channel()
- Return type:
- add_cross_resonance(qubit_one, qubit_two)
Adds cross-resonance couplings and channels between these two qubits.
- build_qubit(index, resonator, physical_channel, drive_freq, second_state_freq=None, measure_amp=1.0, fixed_drive_if=False, qubit_id=None)
Helper method tp build a qubit with assumed default values on the channels. Modelled after the live hardware.
- build_resonator(resonator_id, resonator_channel, *args, measure_fixed_if=False, acquire_fixed_if=False, **kwargs)
Helper method to build a resonator with default channels.