jaqalpaq.run package
- jaqalpaq.run.run_jaqal_circuit(circuit, backend=None, force_sim=False, emulator_backend=None, **kwargs)
Execute a Jaqal
Circuitusing either an emulator or by communicating over IPC with another process.- Parameters:
circuit (Circuit) – The Jaqalpaq circuit to be run.
backend – The backend to perform the circuit simulation/emulation. Defaults to UnitarySerializedEmulator.
- Return type:
Note
Random seed is controlled by numpy.random.seed. Consider calling
numpy.random.seed(int(time.time()))
for random behavior.
- jaqalpaq.run.run_jaqal_file(fname, import_path=None, **kwargs)
Execute a Jaqal program in a file using either an emulator or by communicating over IPC with another process.
- Parameters:
fname (str) – The path to a Jaqal file to execute.
import_path (str) – The path to perform relative Jaqal imports from. Defaults to parent directory of the file.
- Return type:
Note
See
run_jaqal_circuit()for additional arguments
- jaqalpaq.run.run_jaqal_string(jaqal, import_path=None, **kwargs)
Execute a Jaqal string using either an emulator or by communicating over IPC with another process.
- Parameters:
jaqal (str) – The literal Jaqal program text.
import_path (str) – The path to perform relative Jaqal imports from. Defaults to the current directory.
- Return type:
Note
See
run_jaqal_circuit()for additional arguments
jaqalpaq.run.result subpackage
- class jaqalpaq.run.result.ExecutionResult(circuit, overrides, *, timestamp=None, **kwargs)
Captures the results of a Jaqal program’s execution, on hardware or an emulator.
- class accept_normalized_counts(*args, **kwargs)
- class accept_readouts(*args, **kwargs)
- by_subbatch()
- by_time()
- property readouts
An indexable, iterable view of
Readoutobjects, containing the time-ordered measurements and auxiliary data.
- subcircuits
- property subcircuits_loci
- class jaqalpaq.run.result.Readout(result, index, node)
Encapsulate the result of measurement of some number of qubits.
- property as_int
The measured result encoded as an integer, with qubit 0 represented by the least significant bit.
- property as_str
The measured result encoded as a string of qubit values.
- property index
The temporal index of this measurement in the parent circuit.
- property subcircuit
Return the associated prepare_all/measure_all block in the parent circuit.
- jaqalpaq.run.result.parse_jaqal_output_list(circuit, output, overrides=None)
Parse experimental output into an
ExecutionResultproviding collated and uncollated access to the output.- Parameters:
circuit (Circuit) – The circuit under consideration.
output (list[int or str]) – The measured qubit state, encoded as a string of 1s and 0s, or as an int with state of qubit 0 encoded as the least significant bit, and so on. For example, Measuring
100is encoded as 1, and001as 4.
- Returns:
The parsed output.
- Return type: