Skip to content

Job API

This page shows the Job API used with the OPX1000 with QOP 3.x, it is currently not supported by the OPX+. The equivalent OPX+ API can be found here.

qm.api.v2.job_api.job_api.JobApi

JobApi(
    connection_details: ConnectionDetails,
    job_id: str,
    capabilities: ServerCapabilities,
)

cancel

cancel() -> None

Cancels the job

execution_report

execution_report() -> ExecutionReport

Get runtime errors report for this job. See Runtime errors.

RETURNS DESCRIPTION
ExecutionReport

An object holding the errors that this job generated.

get_compilation_config

get_compilation_config() -> FullQuaConfig
RETURNS DESCRIPTION
FullQuaConfig

The config with which this job was compiled

get_element_correction

get_element_correction(
    element: str,
) -> Tuple[float, float, float, float]

Gets the correction matrix for correcting gain and phase imbalances of an IQ mixer associated with an element.

PARAMETER DESCRIPTION
element

The name of the element to update the correction for

TYPE: str

RETURNS DESCRIPTION
Tuple[float, float, float, float]

The current correction matrix

get_errors

get_errors() -> List[ExecutionError]

Returns:

 A list of all errors in the execution report

get_input_dc_offset_by_element

get_input_dc_offset_by_element(
    element: str, output: str
) -> float

Get the current DC offset of the OPX analog input channel associated with an element.

PARAMETER DESCRIPTION
element

the name of the element to get the correction for

TYPE: str

output

the output key name as appears in the element config under 'outputs'.

TYPE: str

RETURNS DESCRIPTION
float

The offset, in volts

get_intermediate_frequency

get_intermediate_frequency(element: str) -> float

Gets the intermediate frequency of the element

PARAMETER DESCRIPTION
element

The name of the element whose intermediate frequency will be updated

TYPE: str

RETURNS DESCRIPTION
float

The intermediate frequency of the given element

TYPE: float

get_io1_value

get_io1_value(
    as_type: None = ...,
) -> GetIoValuesResponseGetIoValuesResponseSuccessIoValuesData
get_io1_value(as_type: Type[bool]) -> bool
get_io1_value(as_type: Type[int]) -> int
get_io1_value(
    as_type: Union[Type[float], Type[fixed]],
) -> float
get_io1_value(
    as_type: Optional[IoValueTypes] = None,
) -> Union[
    bool,
    int,
    float,
    GetIoValuesResponseGetIoValuesResponseSuccessIoValuesData,
]

Gets the data stored in IO1

Data will be presented as the type given. If no type was given, it'll have three fields: int_value, double_value, & boolean_value

PARAMETER DESCRIPTION
as_type

The type of IO1

TYPE: Optional[IoValueTypes] DEFAULT: None

Returns: IO1

get_io2_value

get_io2_value(
    as_type: None = ...,
) -> GetIoValuesResponseGetIoValuesResponseSuccessIoValuesData
get_io2_value(as_type: Type[bool]) -> bool
get_io2_value(as_type: Type[int]) -> int
get_io2_value(
    as_type: Union[Type[float], Type[fixed]],
) -> float
get_io2_value(
    as_type: Optional[IoValueTypes] = None,
) -> Union[
    bool,
    int,
    float,
    GetIoValuesResponseGetIoValuesResponseSuccessIoValuesData,
]

Gets the data stored in `IO12

Data will be presented as the type given. If no type was given, it'll have three fields: int_value, double_value, & boolean_value

PARAMETER DESCRIPTION
as_type

The type of IO2

TYPE: Optional[IoValueTypes] DEFAULT: None

Returns: IO2

get_io_values

get_io_values(
    *, io1_type: None = ..., io2_type: None = ...
) -> Tuple[
    GetIoValuesResponseGetIoValuesResponseSuccessIoValuesData,
    GetIoValuesResponseGetIoValuesResponseSuccessIoValuesData,
]
get_io_values(
    *, io1_type: Type[bool], io2_type: None = ...
) -> Tuple[
    bool,
    GetIoValuesResponseGetIoValuesResponseSuccessIoValuesData,
]
get_io_values(
    *, io1_type: Type[int], io2_type: None = ...
) -> Tuple[
    int,
    GetIoValuesResponseGetIoValuesResponseSuccessIoValuesData,
]
get_io_values(
    *,
    io1_type: Union[Type[float], Type[fixed]],
    io2_type: None = ...
) -> Tuple[
    float,
    GetIoValuesResponseGetIoValuesResponseSuccessIoValuesData,
]
get_io_values(
    *, io1_type: None = ..., io2_type: Type[bool]
) -> Tuple[
    GetIoValuesResponseGetIoValuesResponseSuccessIoValuesData,
    bool,
]
get_io_values(
    *, io1_type: Type[bool], io2_type: Type[bool]
) -> Tuple[bool, bool]
get_io_values(
    *, io1_type: Type[int], io2_type: Type[bool]
) -> Tuple[int, bool]
get_io_values(
    *,
    io1_type: Union[Type[float], Type[fixed]],
    io2_type: Type[bool]
) -> Tuple[float, bool]
get_io_values(
    *, io1_type: None = ..., io2_type: Type[int]
) -> Tuple[
    GetIoValuesResponseGetIoValuesResponseSuccessIoValuesData,
    int,
]
get_io_values(
    *, io1_type: Type[bool], io2_type: Type[int]
) -> Tuple[bool, int]
get_io_values(
    *, io1_type: Type[int], io2_type: Type[int]
) -> Tuple[int, int]
get_io_values(
    *,
    io1_type: Union[Type[float], Type[fixed]],
    io2_type: Type[int]
) -> Tuple[float, int]
get_io_values(
    *,
    io1_type: None = ...,
    io2_type: Union[Type[float], Type[fixed]]
) -> Tuple[
    GetIoValuesResponseGetIoValuesResponseSuccessIoValuesData,
    float,
]
get_io_values(
    *,
    io1_type: Type[bool],
    io2_type: Union[Type[float], Type[fixed]]
) -> Tuple[bool, float]
get_io_values(
    *,
    io1_type: Type[int],
    io2_type: Union[Type[float], Type[fixed]]
) -> Tuple[int, float]
get_io_values(
    *,
    io1_type: Union[Type[float], Type[fixed]],
    io2_type: Union[Type[float], Type[fixed]]
) -> Tuple[float, float]
get_io_values(
    *,
    io1_type: Optional[IoValueTypes] = None,
    io2_type: Optional[IoValueTypes] = None
) -> Tuple[
    Union[
        bool,
        int,
        float,
        GetIoValuesResponseGetIoValuesResponseSuccessIoValuesData,
    ],
    Union[
        bool,
        int,
        float,
        GetIoValuesResponseGetIoValuesResponseSuccessIoValuesData,
    ],
]

Gets the data stored in IO1 & IO2

Data will be presented as the type given. If no type was given, it'll have three fields: int_value, double_value, & boolean_value Args: io1_type: The type of IO1 io2_type: The type of IO1 Returns: A tuple of (IO1, IO2)

get_job_id

get_job_id() -> str
RETURNS DESCRIPTION
str

The job's ID

get_output_dc_offset_by_element

get_output_dc_offset_by_element(
    element: str,
    iq_input: Optional[Literal["I", "Q", "single"]] = None,
) -> float

Get the current DC offset of the OPX analog output channel associated with an element.

PARAMETER DESCRIPTION
element

The name of the element to get the correction for

TYPE: str

iq_input

The port name as appears in the element config. Options:

'single' for an element with a single input

'I' or 'Q' for an element with mixer inputs

TYPE: Optional[Literal['I', 'Q', 'single']] DEFAULT: None

RETURNS DESCRIPTION
float

The offset, in volts

get_output_digital_buffer

get_output_digital_buffer(
    element: str, digital_input: str
) -> int

Gets the buffer for digital input of the element

PARAMETER DESCRIPTION
element

The name of the element to get the buffer for

TYPE: str

digital_input

The digital input name as appears in the element's config

TYPE: str

RETURNS DESCRIPTION
int

The buffer

get_output_digital_delay

get_output_digital_delay(
    element: str, digital_input: str
) -> int

Gets the delay of the digital input of the element

PARAMETER DESCRIPTION
element

The name of the element to get the delay for

TYPE: str

digital_input

The digital input name as appears in the element's config

TYPE: str

RETURNS DESCRIPTION
int

The delay

get_status

get_status() -> JobStatus

Returns the status of the job, one of the following strings:

  • In queue - Program is in the queue
  • Running - Program is currently running
  • Processing - Program done but data processing is ongoing
  • Done - Program and data processing done
  • Canceled - Program was canceled before it was done
  • Error - Program encountered an error

Returns:

 The job status

is_finished

is_finished() -> bool

Returns:

 `True` if the job will no longer run (Has reached "Completed", "Canceled" or "Error").

is_paused

is_paused() -> bool

Returns:

 `True` if the job was paused from QUA.

is_running

is_running() -> bool

Returns:

 `True` if the job is currently running

push_to_input_stream

push_to_input_stream(
    stream_name: str, data: List[Union[bool, int, float]]
) -> None

Push data to the input stream declared in the QUA program. The data is then ready to be read by the program using the advance input stream QUA statement. The type of QUA variable is inferred from the python type passed to data according to the following rule:

int -> int float -> fixed bool -> bool

When sending a list (into a QUA array), all data must be of the same type.

Multiple data entries can be pushed before the data is read by the program.

See Input streams for more information.

PARAMETER DESCRIPTION
stream_name

The input stream name the data is to be pushed to.

TYPE: str

data

The data to be pushed. The data's size & type must match the size & type of the input stream.

TYPE: List[Union[bool, int, float]]

resume

resume() -> None

Resumes a program that was halted using the pause statement

set_converter_frequency

set_converter_frequency(
    element: str,
    frequency_hz: float,
    update_component: Literal[
        "upconverter", "downconverter", "both"
    ] = "both",
) -> None

Set the upconverter frequency or downconverter frequency of the microwave input of the element

PARAMETER DESCRIPTION
element

The name of the element to update the correction for

TYPE: str

frequency_hz

The frequency to set to the given element

TYPE: float

update_component

The component to update the frequency for: "upconverter", "downconverter", or "both"

TYPE: str DEFAULT: 'both'

set_element_correction

set_element_correction(
    element: str,
    correction: Tuple[float, float, float, float],
) -> None

Sets the correction matrix for correcting gain and phase imbalances of an IQ mixer associated with an element.

Values will be rounded to an accuracy of \(2^{-16}\). Valid values for the correction values are between \(-2\) and \((2 - 2^{-16})\).

Warning - the correction matrix can increase the output voltage which might result in an overflow.

PARAMETER DESCRIPTION
element

The name of the element to update the correction for

TYPE: str

correction

Tuple is of the form (v00, v01, v10, v11) where the matrix is \(\begin{pmatrix} v_{00} & v_{01} \\ v_{10} & v_{11}\end{pmatrix}\)

TYPE: tuple

set_input_dc_offset_by_element

set_input_dc_offset_by_element(
    element: str, output: str, offset: float
) -> None

Set the current DC offset of the OPX analog input channel associated with an element.

PARAMETER DESCRIPTION
element

the name of the element to update the correction for

TYPE: str

output

the output key name as appears in the element config under 'outputs'.

TYPE: str

offset

the dc value to set to, in volts. Ranges from -0.5 to 0.5 - 2^-16 in steps of 2^-16.

TYPE: float

Note

If the sum of the DC offset and the largest waveform data-point exceed the range, DAC output overflow will occur and the output will be corrupted.

set_intermediate_frequency

set_intermediate_frequency(
    element: str, freq: float
) -> None

Sets the intermediate frequency of the element

PARAMETER DESCRIPTION
element

The name of the element whose intermediate frequency will be updated

TYPE: str

freq

The intermediate frequency to set to the given element

TYPE: float

set_io1_value

set_io1_value(value: Optional[NumpySupportedValue]) -> None

Sets the values of IO1.

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 according to the following rule:

int -> int float -> fixed bool -> bool

PARAMETER DESCRIPTION
value

The value to be placed in IO1

TYPE: Optional[NumpySupportedValue]

set_io2_value

set_io2_value(value: Optional[NumpySupportedValue]) -> None

Sets the values of 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 according to the following rule:

int -> int float -> fixed bool -> bool

PARAMETER DESCRIPTION
value

The value to be placed in IO2

TYPE: Optional[NumpySupportedValue]

set_io_values

set_io_values(
    io1: Optional[NumpySupportedValue] = None,
    io2: Optional[NumpySupportedValue] = None,
) -> None

Sets the values of IO1 & `IO2. If only one is given, then the value of the second will remain unchanged.

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 according to the following rule:

int -> int float -> fixed bool -> bool

PARAMETER DESCRIPTION
io1

The value to be placed in IO1

TYPE: Optional[NumpySupportedValue] DEFAULT: None

io2

The value to be placed in IO2

TYPE: Optional[NumpySupportedValue] DEFAULT: None

set_output_dc_offset_by_element

set_output_dc_offset_by_element(
    element: str,
    input: Union[
        Tuple[Literal["I", "Q"], Literal["I", "Q"]],
        List[Literal["I", "Q"]],
    ],
    offset: Union[Tuple[float, float], List[float]],
) -> None
set_output_dc_offset_by_element(
    element: str,
    input: Literal["single", "I", "Q"],
    offset: float,
) -> None
set_output_dc_offset_by_element(
    element: str,
    input: Union[
        Literal["single", "I", "Q"],
        Tuple[Literal["I", "Q"], Literal["I", "Q"]],
        List[Literal["I", "Q"]],
    ],
    offset: Union[float, Tuple[float, float], List[float]],
) -> None

Set the current DC offset of the OPX analog output channel associated with an element.

PARAMETER DESCRIPTION
element

the name of the element to update the correction for

TYPE: str

input

the input name as appears in the element config. Options:

'single' for an element with a single input

'I' or 'Q' or a tuple ('I', 'Q') for an element with mixer inputs

TYPE: Union[str, Tuple[str, str], List[str]]

offset

The dc value to set to, in volts. Ranges from -0.5 to 0.5 - 2^-16 in steps of 2^-16.

TYPE: Union[float, Tuple[float, float], List[float]]

Examples:

job.set_output_dc_offset_by_element('flux', 'single', 0.1)
job.set_output_dc_offset_by_element('qubit', 'I', -0.01)
job.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 range,
DAC output overflow will occur and the output will be corrupted.

set_output_digital_buffer

set_output_digital_buffer(
    element: str, digital_input: str, buffer: int
) -> None

Sets the buffer for digital input of the element

PARAMETER DESCRIPTION
element

The name of the element to update buffer for

TYPE: str

digital_input

the digital input name as appears in the element's config

TYPE: str

buffer

The buffer value to set to, in ns.

TYPE: int

set_output_digital_delay

set_output_digital_delay(
    element: str, digital_input: str, delay: int
) -> None

Sets the delay of the digital input of the element

PARAMETER DESCRIPTION
element

The name of the element to update delay for

TYPE: str

digital_input

The digital input name as appears in the element's config

TYPE: str

delay

The delay value to set to, in ns.

TYPE: int

update_oscillator_frequency

update_oscillator_frequency(
    element: str,
    frequency_hz: float,
    update_component: Literal[
        "upconverter", "downconverter", "both"
    ] = "both",
) -> None

Set the upconverter frequency or downconverter frequency of the microwave input of the element

PARAMETER DESCRIPTION
element

The name of the element to update the correction for

TYPE: str

frequency_hz

The frequency to set to the given element

TYPE: float

update_component

The component to update the frequency for: "upconverter", "downconverter", or "both"

TYPE: str DEFAULT: 'both'

wait_until

wait_until(
    state: Union[JobStatus, Collection[JobStatus]],
    timeout: float,
) -> None

Waits until a specific state is reached. If the job is already passed the given state, the function will immediately return. See get_status for a list of statuses.

If the state cannot be reached (e.g., waiting for “Done” but the job is “Canceled”) then an error is raised.

If the timeout time, has passed, an error is raised.

PARAMETER DESCRIPTION
state

The state to wait for

TYPE: Union[JobStatus, Collection[JobStatus]]

timeout

The timeout time, in seconds

TYPE: float

qm.api.v2.job_api.job_api.JobApiWithDeprecations

JobApiWithDeprecations(
    connection_details: ConnectionDetails,
    job_id: str,
    capabilities: ServerCapabilities,
)

status property

status: str

Returns the status of the job, one of the following strings: "unknown", "pending", "running", "completed", "canceled", "loading", "error"

halt

halt() -> bool

Halts the job on the opx

insert_input_stream

insert_input_stream(name: str, data: List[Value]) -> None

Deprecated - Please use job.push_to_input_stream.

push_to_input_stream

push_to_input_stream(name: str, data: List[Value]) -> None

Push data to the input stream declared in the QUA program. The data is then ready to be read by the program using the advance input stream QUA statement. The type of QUA variable is inferred from the python type passed to data according to the following rule:

int -> int float -> fixed bool -> bool

When sending a list (into a QUA array), all data must be of the same type.

Multiple data entries can be pushed before the data is read by the program.

See Input streams for more information.

PARAMETER DESCRIPTION
name

The input stream name the data is to be pushed to.

TYPE: str

data

The data to be pushed. The data's size & type must match the size & type of the input stream.

TYPE: List[Value]

wait_for_execution

wait_for_execution(
    timeout: Optional[float] = None,
) -> JobApi

Deprecated - This method is going to be removed, please use job.wait_until("Running").

Waits until the job has passed the "Running" state. If the timeout is reached, the function will raise an error. Args: timeout: The timeout time, in seconds Returns: The running job