Deprecated code suggestions#
See also
Download the notebook: deprecated.ipynb
Target |
Depr |
Remv |
Alternatives |
---|---|---|---|
|
0.20.1 |
0.22 |
|
|
0.20.1 |
0.22 |
|
|
0.20.1 |
0.22 |
See Removed |
|
0.20.1 |
0.22 |
See Removed |
|
0.20.1 |
0.22 |
See Removed |
|
0.20.1 |
0.22 |
|
|
0.20.1 |
0.22 |
|
|
0.20.1 |
0.22 |
|
|
0.20.1 |
0.22 |
|
|
0.20.1 |
0.22 |
|
|
0.20.1 |
0.22 |
|
|
0.19.0 |
0.22 |
See Other |
|
0.18 |
0.21 |
|
|
0.18 |
0.22 |
|
|
0.18 |
0.22 |
|
|
0.18 |
0.22 |
|
|
0.18 |
0.23 |
|
|
0.18 |
0.21 |
Replaced by |
|
0.17 |
0.18 |
|
|
0.15 |
- |
See plot_kwargs parameter in ScheduleBase.plot_pulse_diagram() |
|
0.15 |
0.18 |
See repetitions parameter in ScheduleGettable.process_acquired_data() |
|
0.13 |
0.18 |
|
Qblox |
0.13 |
0.18 |
|
Qblox |
0.13 |
0.17 |
|
|
0.12 |
0.15 |
|
0.10 |
0.13 |
See acq_channel |
|
|
0.10 |
0.13 |
|
The |
0.9 |
0.15 |
- |
Old Qblox hardware configuration |
0.8 |
0.13 |
|
|
0.7 |
0.13 |
|
|
0.6 |
0.13 |
See add_pulse_information_transmon() => compile_circuit_to_device() |
|
0.6 |
0.9 |
|
|
0.6 |
0.9 |
As of quantify-scheduler==0.10.0
, deprecation warnings are shown by default (as FutureWarning
).
Changed in 0.22.0#
Removed#
:class:
~quantify_scheduler.operations.ShiftClockPhase
, :class:~quantify_scheduler.operations.SetClockFrequency
and :class:~quantify_scheduler.operations.VoltageOffset
no longer accept theduration
parameter and are set internally to 0 seconds.determine_absolute_timing
was removed from the public interface. Please use :class:~quantify_scheduler.SerialCompiler
or :class:~quantify_scheduler.ScheduleGettable
instead.
Moved#
In the hardware config, the settings
latency_correction
anddistortion_correction
should now be defined insideHardwareOptions
.StitchedPulse
,convert_to_numerical_pulse
,StitchedPulseBuilder
,staircase_pulse
,long_square_pulse
andlong_ramp_pulse
have moved to the Qblox backend:
old location |
new location |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Renamed#
DistortionCorrection
andNumericalWeightedIntegrationComplex
have a new name:
old name |
new name |
---|---|
|
|
|
|
Other#
When interpolating waveforms, a call to
interpolated_complex_waveform
is made, which accepts key word arguments that will be passed toscipy.interpolate.interp1d
. The two argumentsbounds_error
andfill_value
are now fixed toFalse
and"extrapolate"
and cannot be changed.
Changed in 0.21.0#
New control flow interface#
This is an example for the loop control flow. For other control flow types, please use the respective operation classes in the same way.
# Old way:
from quantify_scheduler.operations.control_flow_library import Loop
schedule_with_loop = Schedule("Schedule with loop")
subschedule = Schedule("Subschedule")
subschedule.add(X("q0"))
schedule_with_loop.add(subschedule, control_flow=Loop(3))
# New way:
from quantify_scheduler.operations.control_flow_library import LoopOperation
from quantify_scheduler.operations.gate_library import X
schedule_with_loop = Schedule("Schedule with loop")
subschedule = Schedule("Subschedule")
subschedule.add(X("q0"))
loop_operation = LoopOperation(body=subschedule, repetitions=3)
schedule_with_loop.add(loop_operation)
DistortionCorrection => SoftwareDistortionCorrection#
To prepare for distortion corrections performed by hardware, distortion corrections will now come in two flavors: SoftwareDistortionCorrection
and HardwareDistortionCorrection
.
In the hardware configuration, the following needs to be replaced:
hardware_configuration = {
...
hardware_options : {
...
distortion_corrections = {
- "q0:fl-cl0.baseband": DistortionCorrection(
+ "q0:fl-cl0.baseband": SoftwareDistortionCorrection(
filter_func="scipy.signal.lfilter",
input_var_name="x",
kwargs={
"b": [0, 0.25, 0.5],
"a": [1]
},
clipping_values=[-2.5, 2.5]
)
}
}
}
Older#
qcompile() => SerialCompiler#
The qcompile()
, device_compile()
and hardware_compile()
compilation functions have been replaced by the SerialCompiler
. For step-by-step guides on how to perform compilation to the device level and hardware, please see Compiling to Hardware and Operations and Qubits. A brief example is shown below.
# Old way:
from quantify_scheduler.compilation import qcompile
compiled_schedule = qcompile(sched, device_cfg, hardware_cfg)
from quantify_scheduler.backends.graph_compilation import SerialCompiler
quantum_device.hardware_config(hardware_cfg)
compiler = SerialCompiler(name="compiler")
compiled_schedule = compiler.compile(
schedule=sched, config=quantum_device.generate_compilation_config()
)
ScheduleGettable.generate_diagnostics_report()#
In version 0.17, the ScheduleGettable.generate_diagnostics_report
method received a major update. This method should no longer be called directly. Instead, the experiment should be run via the ScheduleGettable.initialize_and_get_with_report()
method, which executes the experiment and generates a diagnostics report for debugging.
plot_kwargs parameter in ScheduleBase.plot_pulse_diagram()#
In version 0.15, the plot_kwargs
parameter of the ScheduleBase.plot_pulse_diagram()
method was replaced by variable keyword arguments (**kwargs
). This means that the dictionary provided to plot_kwargs
can be unpacked and passed to the method directly. For example,
schedule.plot_pulse_diagram(plot_kwargs={"x_range": (201e-6, 201.5e-6)})
can now be written as
compiled_schedule.plot_pulse_diagram(x_range=(201e-6, 201.5e-6))
repetitions parameter in ScheduleGettable.process_acquired_data()#
In version 0.15, the repetitions
parameter of the ScheduleGettable.process_acquired_data
method was deprecated. This parameter has no effect, and can simply be omitted. The Repetitions section of Tutorial: ScheduleGettable contains more information on how to set the number of repetitions in an experiment.
t parameter in NumericalSeparatedWeightedIntegration#
Note
This class was renamed from NumericalWeightedIntegrationComplex
in quantify-scheduler 0.18.1.
In version 0.13.0, the t
parameter in the NumericalSeparatedWeightedIntegration
initializer was replaced by the weights_sampling_rate
parameter, which takes a sampling rate in Hz.
This means that creating a class instance as
NumericalSeparatedWeightedIntegration(
weights_a=[0.1, 0.2, 0.3],
weight_b=[0.4, 0.5, 0.6],
t=[0.0, 1e-9, 2e-9],
port="some_port",
clock="some_clock",
# other args
)
should now be done as
from quantify_scheduler.operations.acquisition_library import NumericalSeparatedWeightedIntegration
NumericalSeparatedWeightedIntegration(
weights_a=[0.1, 0.2, 0.3],
weights_b=[0.4, 0.5, 0.6],
weights_sampling_rate=1e9,
port="some_port",
clock="some_clock",
# other args
)
NumericalSeparatedWeightedIntegration(weights_a=[0.1, 0.2, 0.3], weights_b=[0.4, 0.5, 0.6], weights_sampling_rate=999999999.9999999, port='some_port', clock='some_clock', interpolation='linear', acq_channel=0, acq_index=0, bin_mode='append', phase=0, t0=0)
Circuit diagrams and pulse diagrams#
The functions to plot circuit and pulse diagrams have moved to a private module in version 0.12.0.
Instead, to plot circuit and pulse diagrams, call, directly on the schedule, plot_circuit_diagram()
and plot_pulse_diagram()
.
For example, the line
pulse_diagram_plotly(schedule)
pulse_diagram_matplotlib(schedule)
should now be written as
compiled_schedule.plot_pulse_diagram(plot_backend="plotly")
compiled_schedule.plot_pulse_diagram(plot_backend="mpl")
More examples can be found in the Schedules and Pulses and Operations and Qubits tutorials.
acq_channel#
In the Measure
and CRCount
classes, the acq_channel
parameter has been removed from the initializers. For gate-level operations, the acquisition channel can be set in the DeviceElement
subclasses, such as BasicTransmonElement
, instead.
add_pulse_information_transmon() => compile_circuit_to_device()#
The compilation step add_pulse_information_transmon
has been replaced by compile_circuit_to_device
. For steps on how to add device configuration to your compilation steps, please see Operations and Qubits.
Qblox Hardware Configuration#
In quantify-scheduler 0.8.0, the schema for the Qblox hardware configuration was revised. From version 0.13.0, old hardware configurations will no longer be automatically converted. Below is a summary of the changes.
seqx
=>portclock_configs
latency_correction
=> standalone/top-levellatency_corrections
line_gain_db
removed
Warning
The helper function convert_hw_config_to_portclock_configs_spec
has been removed in version 0.18.0.
depr_hardware_cfg = {
"backend": "quantify_scheduler.backends.qblox_backend.hardware_compile",
"cluster": {
"ref": "internal",
"instrument_type": "Cluster",
"cluster_module1": {
"instrument_type": "QRM_RF",
"complex_output_0": {
"line_gain_db": 0,
"seq0": {
"port": "q6:res",
"clock": "q6.ro",
"latency_correction": 4e-9,
},
"seq1": {
"port": "q1:res",
"clock": "q1.ro",
},
},
},
},
}
correct_hardware_cfg = {
"backend": "quantify_scheduler.backends.qblox_backend.hardware_compile",
"cluster": {
"ref": "internal",
"instrument_type": "Cluster",
"cluster_module1": {
"instrument_type": "QRM_RF",
"complex_output_0": {
"portclock_configs": [
{
"port": "q6:res",
"clock": "q6.ro"
},
{
"port": "q1:res",
"clock": "q1.ro"
}
]
}
}
},
"latency_corrections": {
"q6:res-q6.ro": 4e-09
}
}
TransmonElement => BasicTransmonElement#
In quantify-scheduler 0.7.0, the BasicTransmonElement
class was added and replaced the TransmonElement
class.
Show code cell content
from qcodes import Instrument
Instrument.close_all()
# Before:
# from quantify_scheduler.device_under_test.transmon_element import TransmonElement
# transmon = TransmonElement("transmon")
# print(f"{transmon.name}: {list(transmon.parameters.keys())}")
# After:
from quantify_scheduler.device_under_test.transmon_element import BasicTransmonElement
basic = BasicTransmonElement("basic")
print(f"{basic.name}: {list(basic.parameters.keys()) + list(basic.submodules.keys())}")
for submodule_name, submodule in basic.submodules.items():
print(f"{basic.name}.{submodule_name}: {list(submodule.parameters.keys())}")
basic: ['IDN', 'reset', 'rxy', 'measure', 'pulse_compensation', 'ports', 'clock_freqs']
basic.reset: ['duration']
basic.rxy: ['amp180', 'motzoi', 'duration']
basic.measure: ['pulse_type', 'pulse_amp', 'pulse_duration', 'acq_channel', 'acq_delay', 'integration_time', 'reset_clock_phase', 'acq_weights_a', 'acq_weights_b', 'acq_weights_sampling_rate', 'acq_weight_type', 'acq_rotation', 'acq_threshold', 'num_points']
basic.pulse_compensation: ['max_compensation_amp', 'time_grid', 'sampling_rate']
basic.ports: ['microwave', 'flux', 'readout']
basic.clock_freqs: ['f01', 'f12', 'readout']
The block below shows how the attributes of the TransmonElement
(transmon
) are converted to attributes of the BasicTransmonElement
(basic
).
transmon.IDN => basic.IDN
transmon.instrument_coordinator => None
transmon.init_duration => basic.reset.duration
transmon.mw_amp180 => basic.rxy.amp180
transmon.mw_motzoi => basic.rxy.motzoi
transmon.mw_pulse_duration => basic.rxy.duration
transmon.mw_ef_amp180 => None
transmon.mw_port => basic.ports.microwave
transmon.fl_port => basic.ports.flux
transmon.ro_port => basic.ports.readout
transmon.mw_01_clock => no longer settable, always "basic.01"
transmon.mw_12_clock => no longer settable, always "basic.12"
transmon.ro_clock => no longer settable, always "basic.ro"
transmon.freq_01 => basic.clock_freqs.f01
transmon.freq_12 => basic.clock_freqs.f12
transmon.ro_freq => basic.clock_freqs.readout
transmon.ro_pulse_amp => basic.measure.pulse_amp
transmon.ro_pulse_duration => basic.measure.pulse_duration
transmon.ro_pulse_type => basic.measure.pulse_type
transmon.ro_pulse_delay => via: schedule.add(..., rel_time=...)
transmon.ro_acq_channel => basic.measure.acq_channel
transmon.ro_acq_delay => basic.measure.acq_delay
transmon.ro_acq_integration_time => basic.measure.integration_time
transmon.spec_pulse_duration => via: schedule.add(SpectroscopyOperation("basic")), not implemented for BasicTransmonElement, see BasicElectronicNVElement.spectroscopy_operation
transmon.spec_pulse_frequency => via: schedule.add(SpectroscopyOperation("basic")), not implemented for BasicTransmonElement, see BasicElectronicNVElement.spectroscopy_operation
transmon.spec_pulse_amp => via: schedule.add(SpectroscopyOperation("basic")), not implemented for BasicTransmonElement, see BasicElectronicNVElement.spectroscopy_operation
transmon.spec_pulse_clock => via: schedule.add(SpectroscopyOperation("basic")), not implemented for BasicTransmonElement, see BasicElectronicNVElement.spectroscopy_operation
transmon.acquisition => via: schedule.add(Measure("basic", acq_protocol=...))
transmon.ro_acq_weight_type => basic.measure.acq_weight_type
schedule.add(Measure("transmon", acq_channel=...)) => basic.measure.acq_channel
Both classes will generate the same device configuration.
import pprint
# device_config_transmon = transmon.generate_device_config().model_dump()
# pprint.pprint(device_config_transmon)
device_config_basic_transmon = basic.generate_device_config().model_dump()
pprint.pprint(device_config_basic_transmon)
{'clocks': {'basic.01': nan, 'basic.12': nan, 'basic.ro': nan},
'compilation_passes': [{'compilation_func': 'quantify_scheduler.backends.circuit_to_device.compile_circuit_to_device_with_config_validation',
'name': 'circuit_to_device'},
{'compilation_func': 'quantify_scheduler.backends.circuit_to_device.set_pulse_and_acquisition_clock',
'name': 'set_pulse_and_acquisition_clock'},
{'compilation_func': 'quantify_scheduler.pulse_compensation.process_compensation_pulses',
'name': 'process_compensation_pulses'},
{'compilation_func': 'quantify_scheduler.compilation._determine_absolute_timing',
'name': 'determine_absolute_timing'}],
'edges': {},
'elements': {'basic': {'H': {'factory_func': 'quantify_scheduler.operations.composite_factories.hadamard_as_y90z',
'factory_kwargs': {'qubit': 'basic'},
'gate_info_factory_kwargs': None},
'Rxy': {'factory_func': 'quantify_scheduler.operations.pulse_factories.rxy_drag_pulse',
'factory_kwargs': {'amp180': nan,
'clock': 'basic.01',
'duration': 2e-08,
'motzoi': 0,
'port': 'basic:mw',
'reference_magnitude': None},
'gate_info_factory_kwargs': ['theta', 'phi']},
'Rz': {'factory_func': 'quantify_scheduler.operations.pulse_factories.phase_shift',
'factory_kwargs': {'clock': 'basic.01'},
'gate_info_factory_kwargs': ['theta']},
'measure': {'factory_func': 'quantify_scheduler.operations.measurement_factories.dispersive_measurement_transmon',
'factory_kwargs': {'acq_channel': 0,
'acq_delay': 0,
'acq_duration': 1e-06,
'acq_protocol_default': 'SSBIntegrationComplex',
'acq_rotation': 0,
'acq_threshold': 0,
'acq_weights_a': array([], dtype=float64),
'acq_weights_b': array([], dtype=float64),
'acq_weights_sampling_rate': 1000000000.0,
'clock': 'basic.ro',
'freq': None,
'num_points': 1,
'port': 'basic:res',
'pulse_amp': 0.25,
'pulse_duration': 3e-07,
'pulse_type': 'SquarePulse',
'reference_magnitude': None,
'reset_clock_phase': True},
'gate_info_factory_kwargs': ['acq_channel_override',
'acq_index',
'bin_mode',
'acq_protocol',
'feedback_trigger_label']},
'pulse_compensation': {'factory_func': None,
'factory_kwargs': {'clock': 'basic.01',
'max_compensation_amp': nan,
'port': 'basic:mw',
'sampling_rate': nan,
'time_grid': nan},
'gate_info_factory_kwargs': None},
'reset': {'factory_func': 'quantify_scheduler.operations.pulse_library.IdlePulse',
'factory_kwargs': {'duration': 0.0002},
'gate_info_factory_kwargs': None}}},
'scheduling_strategy': 'asap'}
Instruction-generated pulses (Qblox only)#
Instead of using the instruction_generated_pulses_enabled: True
field in the port-clock configuration for generating long square and staircase pulses, you can now create long square, staircase and ramp waveforms (that would otherwise not fit in memory), by creating these operations with the following helper functions.
from quantify_scheduler.backends.qblox.operations import (
long_ramp_pulse,
long_square_pulse,
staircase_pulse,
)
ramp_pulse = long_ramp_pulse(amp=0.5, duration=1e-3, port="q0:mw")
square_pulse = long_square_pulse(amp=0.5, duration=1e-3, port="q0:mw")
staircase_pulse = staircase_pulse(
start_amp=0.0, final_amp=1.0, num_steps=20, duration=1e-4, port="q0:mw"
)
More complex long waveforms can now also be created, see section Long waveform support.