Quantum Machine API¶
qm.QuantumMachine
¶
QuantumMachine
¶
manager: None
property
¶
Returns the Quantum Machines Manager
queue: QmQueue
property
¶
Returns the queue for the Quantum Machine
close
¶
Closes the quantum machine.
RETURNS | DESCRIPTION |
---|---|
bool
|
|
bool
|
otherwise. |
compile
¶
Compiles a QUA program to be executed later. The returned program_id
can then be directly added to the queue. For a detailed explanation
see Precompile Jobs.
PARAMETER | DESCRIPTION |
---|---|
program |
A QUA program
TYPE:
|
compiler_options |
Optional arguments for compilation
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
a program_id str |
execute
¶
Executes a program and returns an job object to keep track of execution and get results.
Note
Calling execute will halt any currently running program and clear the current queue. If you want to add a job to the queue, use qm.queue.add()
PARAMETER | DESCRIPTION |
---|---|
program |
A QUA
TYPE:
|
duration_limit |
This parameter is ignored as it is obsolete
TYPE:
|
data_limit |
This parameter is ignored as it is obsolete
TYPE:
|
force_execution |
This parameter is ignored as it is obsolete
TYPE:
|
dry_run |
This parameter is ignored as it is obsolete
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
RunningQmJob
|
A |
get_config
¶
Gets the current config of the qm
RETURNS | DESCRIPTION |
---|---|
DictQuaConfig
|
A dictionary with the qm's config |
get_digital_buffer
¶
Gets the buffer for digital input of the element
PARAMETER | DESCRIPTION |
---|---|
element |
the name of the element to get the buffer for
TYPE:
|
digital_input |
the digital input name as appears in the element's config
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
int
|
the buffer |
get_digital_delay
¶
Gets the delay of the digital input of the element
PARAMETER | DESCRIPTION |
---|---|
element |
the name of the element to get the delay for
TYPE:
|
digital_input |
the digital input name as appears in the element's config
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
int
|
the delay |
get_input_dc_offset_by_element
¶
Get the current DC offset of the OPX analog input channel associated with a element.
PARAMETER | DESCRIPTION |
---|---|
element |
the name of the element to get the correction for
TYPE:
|
output |
the output key name as appears in the element config under 'outputs'.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
float
|
the offset, in normalized output units |
get_io1_value
¶
Gets the data stored in IO1
No inference is made on type.
RETURNS | DESCRIPTION |
---|---|
Dict[str, Value]
|
A dictionary with data stored in |
Dict[str, Value]
|
three format: |
get_io2_value
¶
Gets the data stored in IO2
No inference is made on type.
RETURNS | DESCRIPTION |
---|---|
Dict[str, Value]
|
A dictionary with data from the second IO register. (Data is |
Dict[str, Value]
|
in all three format: |
get_io_values
¶
Gets the data stored in both IO1
and IO2
No inference is made on type.
RETURNS | DESCRIPTION |
---|---|
List[Dict[str, Value]]
|
A list that contains dictionaries with data from the IO |
List[Dict[str, Value]]
|
registers. (Data is in all three format: |
List[Dict[str, Value]]
|
and |
get_output_dc_offset_by_element
¶
Get the current DC offset of the OPX analog output channel associated with a element.
PARAMETER | DESCRIPTION |
---|---|
element |
the name of the element to get the correction for
TYPE:
|
iq_input |
the port name as appears in the element config. Options:
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
float
|
the offset, in normalized output units |
get_running_job
¶
Gets the currently running job. Returns None if there isn't one.
get_smearing
¶
Gets the smearing associated with a measurement element.
This is a broadening of the raw results acquisition window, to account for dispersive broadening in the measurement elements (readout resonators etc.) The acquisition window will be broadened by this amount on both sides.
PARAMETER | DESCRIPTION |
---|---|
element |
the name of the element to get smearing for
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
int
|
the smearing, in nesc. |
get_time_of_flight
¶
Gets the time of flight, associated with a measurement element.
This is the amount of time between the beginning of a measurement pulse applied to element and the time that the data is available to the controller for demodulation or streaming.
PARAMETER | DESCRIPTION |
---|---|
element |
the name of the element to get time of flight for
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
int
|
the time of flight, in nsec |
list_controllers
¶
Gets a list with the defined controllers in this qm
RETURNS | DESCRIPTION |
---|---|
Tuple[str, ...]
|
The names of the controllers configured in this qm |
save_config_to_file
¶
Saves the qm current config to a file
PARAMETER | DESCRIPTION |
---|---|
filename |
The name of the file where the config will be saved
TYPE:
|
set_digital_buffer
¶
Sets the buffer for digital input of the element
PARAMETER | DESCRIPTION |
---|---|
element |
the name of the element to update buffer for
TYPE:
|
digital_input |
the digital input name as appears in the element's config
TYPE:
|
buffer |
the buffer value to set to, in nsec. Range: 0 to (255 - delay) / 2, in steps of 1
TYPE:
|
set_digital_delay
¶
Sets the delay of the digital input of the element
PARAMETER | DESCRIPTION |
---|---|
element |
the name of the element to update delay for
TYPE:
|
digital_input |
the digital input name as appears in the element's config
TYPE:
|
delay |
the delay value to set to, in nsec. Range: 0 to 255 - 2 * buffer, in steps of 1
TYPE:
|
set_input_dc_offset_by_element
¶
set the current DC offset of the OPX analog input channel associated with a element.
PARAMETER | DESCRIPTION |
---|---|
element |
the name of the element to update the correction for
TYPE:
|
output |
the output key name as appears in the element config under 'outputs'.
TYPE:
|
offset |
the dc value to set to, in normalized input units. Ranges from -0.5 to 0.5 - 2^-16 in steps of 2^-16.
TYPE:
|
Note
If the sum of the DC offset and the largest waveform data-point exceed the normalized unit range specified above, DAC output overflow will occur and the output will be corrupted.
set_intermediate_frequency
¶
Sets the intermediate frequency of the element
PARAMETER | DESCRIPTION |
---|---|
element |
the name of the element whose intermediate frequency will be updated
TYPE:
|
freq |
the intermediate frequency to set to the given element
TYPE:
|
set_io1_value
¶
Sets the value of IO1
.
This can be used later inside a QUA program as a QUA variable IO1
without declaration.
The type of QUA variable is inferred from the python type passed to value_1
, according to the following rule:
int -> int float -> fixed bool -> bool
PARAMETER | DESCRIPTION |
---|---|
value_1 |
the value to be placed in
TYPE:
|
set_io2_value
¶
Sets the value of IO1
.
This can be used later inside a QUA program as a QUA variable IO2
without declaration.
The type of QUA variable is inferred from the python type passed to value_2
,
according to the following rule:
int -> int float -> fixed bool -> bool
PARAMETER | DESCRIPTION |
---|---|
value_2 |
the value to be placed in
TYPE:
|
set_io_values
¶
Sets the values of IO1
and IO2
This can be used later inside a QUA program as a QUA variable IO1
, IO2
without declaration.
The type of QUA variable is inferred from the python type passed to value_1
, value_2
,
according to the following rule:
int -> int float -> fixed bool -> bool
PARAMETER | DESCRIPTION |
---|---|
value_1 |
the value to be
placed in
TYPE:
|
value_2 |
the value to be
placed in
TYPE:
|
set_mixer_correction
¶
Sets the correction matrix for correcting gain and phase imbalances of an IQ mixer for the supplied intermediate frequency and LO frequency.
PARAMETER | DESCRIPTION |
---|---|
mixer |
the name of the mixer, as defined in the configuration
TYPE:
|
intermediate_frequency |
the intermediate frequency for which to apply the correction matrix
TYPE:
|
lo_frequency |
the LO frequency for which to apply the correction matrix
TYPE:
|
values |
tuple is of the form (v00, v01, v10, v11) where the matrix is | v00 v01 | | v10 v11 |
TYPE:
|
Note
Currently, the OPX does not support multiple mixer calibration entries. This function will accept IF & LO frequencies written in the config file, and will update the correction matrix for all the elements with the given mixer/frequencies combination when the program started.
It’s not recommended to use this method while a job is running. To change the calibration values for a running job, use job.set_element_correction
set_output_dc_offset_by_element
¶
Set the current DC offset of the OPX analog output channel associated with a element.
PARAMETER | DESCRIPTION |
---|---|
element |
the name of the element to update the correction for
TYPE:
|
input |
the input name as appears in the element config. Options:
TYPE:
|
offset |
The dc value to set to, in normalized output units. Ranges from -0.5 to 0.5 - 2^-16 in steps of 2^-16.
TYPE:
|
Examples:
qm.set_output_dc_offset_by_element('flux', 'single', 0.1)
qm.set_output_dc_offset_by_element('qubit', 'I', -0.01)
qm.set_output_dc_offset_by_element('qubit', ('I', 'Q'), (-0.01, 0.05))
Note
If the sum of the DC offset and the largest waveform data-point exceed the normalized unit range specified above, DAC output overflow will occur and the output will be corrupted.
set_output_filter_by_element
¶
Sets the intermediate frequency of the element
PARAMETER | DESCRIPTION |
---|---|
element |
the name of the element whose ports filters will be updated
TYPE:
|
input |
the input name as appears in the element config. Options:
TYPE:
|
feedforward |
the values for the feedforward filter
TYPE:
|
feedback |
the values for the feedback filter
TYPE:
|
simulate
¶
Simulate the outputs of a deterministic QUA program.
Equivalent to execute()
with simulate=SimulationConfig
(see example).
Note
A simulated job does not support calling QuantumMachine API functions.
The following example shows a simple execution of the simulator, where the associated config object is omitted for brevity.
Example
PARAMETER | DESCRIPTION |
---|---|
program |
A QUA
TYPE:
|
simulate |
A
TYPE:
|
kwargs |
additional parameteres to pass to execute
|
RETURNS | DESCRIPTION |
---|---|
SimulatedJob
|
a |