qilisdk.speqtrum.speqtrum_models
Attributes
Type alias for a callable that extracts a typed result from an |
Classes
Base Pydantic model for all SpeQtrum API data structures. |
|
Placeholder model for the login request payload. |
|
Represents the structure of the login response: |
|
Enumeration of possible device statuses reported by the SpeQtrum API. |
|
Enumeration of hardware device types available in SpeQtrum. |
|
Description of a quantum device registered in SpeQtrum. |
|
Discriminator for the type of functional or experiment being executed. |
|
Payload model wrapping a |
|
Payload model wrapping an |
|
Payload model wrapping a |
|
Payload model wrapping a |
|
Payload model wrapping a |
|
Payload model wrapping a |
|
Payload model wrapping a |
|
Payload model wrapping a |
|
Top-level execution payload sent to the SpeQtrum |
|
Deserialized execution result returned by the SpeQtrum API. |
|
Strongly typed reference to a submitted SpeQtrum job. |
|
Enumeration of possible job lifecycle states. |
|
Enumeration of job categories used by the SpeQtrum scheduler. |
|
Handle/reference you normally get back immediately after POST /execute. |
|
Light-weight representation suitable for 'list jobs' and polling |
|
Full representation returned by GET /jobs/{id} when payload/result/logs |
|
JobDetail subclass that exposes a strongly typed get_results method. |
Module Contents
- class SpeQtrumModel(/, **data: Any)[source]
Bases:
pydantic.BaseModelBase Pydantic model for all SpeQtrum API data structures.
Configures alias resolution and arbitrary-type support used throughout the SpeQtrum payload and response models.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config[source]
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class LoginPayload(/, **data: Any)[source]
Bases:
pydantic.BaseModelPlaceholder model for the login request payload.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class Token(/, **data: Any)[source]
Bases:
SpeQtrumModelRepresents the structure of the login response: { “accessToken”: “…”, “expiresIn”: 123456789, “issuedAt”: “123456789”, “refreshToken”: “…”, “tokenType”: “bearer” }
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- access_token: str = None[source]
- expires_in: int = None[source]
- issued_at: int = None[source]
- refresh_token: str = None[source]
- token_type: str = None[source]
- class DeviceStatus[source]
Bases:
str,enum.EnumEnumeration of possible device statuses reported by the SpeQtrum API.
Initialize self. See help(type(self)) for accurate signature.
- ONLINE = 'online'[source]
- MAINTENANCE = 'maintenance'[source]
- OFFLINE = 'offline'[source]
- class DeviceType[source]
Bases:
str,enum.EnumEnumeration of hardware device types available in SpeQtrum.
Initialize self. See help(type(self)) for accurate signature.
- QPU_ANALOG = 'qpu.analog'[source]
- QPU_DIGITAL = 'qpu.digital'[source]
- SIMULATOR = 'simulator'[source]
- class Device(/, **data: Any)[source]
Bases:
SpeQtrumModelDescription of a quantum device registered in SpeQtrum.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- code: str = None[source]
- nqubits: int = None[source]
- name: str = None[source]
- description: str = None[source]
- type: DeviceType = None[source]
- status: DeviceStatus = None[source]
- class ExecuteType[source]
Bases:
str,enum.EnumDiscriminator for the type of functional or experiment being executed.
Initialize self. See help(type(self)) for accurate signature.
- DIGITAL_PROPAGATION = 'digital_propagation'[source]
- ANALOG_EVOLUTION = 'analog_evolution'[source]
- QUANTUM_RESERVOIR = 'quantum_reservoir'[source]
- VARIATIONAL_PROGRAM = 'variational_program'[source]
- RABI_EXPERIMENT = 'rabi_experiment'[source]
- T1_EXPERIMENT = 't1_experiment'[source]
- T2_EXPERIMENT = 't2_experiment'[source]
- TWO_TONES_EXPERIMENT = 'two_tones_experiment'[source]
- class DigitalPropagationPayload(/, **data: Any)[source]
Bases:
SpeQtrumModelPayload model wrapping a
DigitalPropagationand its readout methods for API submission.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- digital_propagation: qilisdk.functionals.DigitalPropagation = None[source]
- readout: qilisdk.readout.Readout = None[source]
- class AnalogEvolutionPayload(/, **data: Any)[source]
Bases:
SpeQtrumModelPayload model wrapping an
AnalogEvolutionand its readout methods for API submission.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- analog_evolution: qilisdk.functionals.AnalogEvolution = None[source]
- readout: qilisdk.readout.Readout = None[source]
- class QuantumReservoirPayload(/, **data: Any)[source]
Bases:
SpeQtrumModelPayload model wrapping a
QuantumReservoirand its readout methods for API submission.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- quantum_reservoir: qilisdk.functionals.QuantumReservoir = None[source]
- readout: qilisdk.readout.Readout = None[source]
- class VariationalProgramPayload(/, **data: Any)[source]
Bases:
SpeQtrumModelPayload model wrapping a
VariationalProgramand its readout methods for API submission.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- variational_program: qilisdk.functionals.VariationalProgram = None[source]
- readout: qilisdk.readout.Readout = None[source]
- class RabiExperimentPayload(/, **data: Any)[source]
Bases:
SpeQtrumModelPayload model wrapping a
RabiExperimentfor API submission.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- rabi_experiment: qilisdk.experiments.RabiExperiment = None[source]
- class T1ExperimentPayload(/, **data: Any)[source]
Bases:
SpeQtrumModelPayload model wrapping a
T1Experimentfor API submission.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- t1_experiment: qilisdk.experiments.T1Experiment = None[source]
- class T2ExperimentPayload(/, **data: Any)[source]
Bases:
SpeQtrumModelPayload model wrapping a
T2Experimentfor API submission.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- t2_experiment: qilisdk.experiments.T2Experiment = None[source]
- class TwoTonesExperimentPayload(/, **data: Any)[source]
Bases:
SpeQtrumModelPayload model wrapping a
TwoTonesExperimentfor API submission.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- two_tones_experiment: qilisdk.experiments.TwoTonesExperiment = None[source]
- class ExecutePayload(/, **data: Any)[source]
Bases:
SpeQtrumModelTop-level execution payload sent to the SpeQtrum
/executeendpoint.Exactly one of the optional payload fields should be populated, matching the discriminator stored in
type.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- type: ExecuteType = None[source]
- digital_propagation_payload: DigitalPropagationPayload | None = None[source]
- analog_evolution_payload: AnalogEvolutionPayload | None = None[source]
- quantum_reservoir_payload: QuantumReservoirPayload | None = None[source]
- variational_program_payload: VariationalProgramPayload | None = None[source]
- rabi_experiment_payload: RabiExperimentPayload | None = None[source]
- t1_experiment_payload: T1ExperimentPayload | None = None[source]
- t2_experiment_payload: T2ExperimentPayload | None = None[source]
- two_tones_experiment_payload: TwoTonesExperimentPayload | None = None[source]
- class ExecuteResult(/, **data: Any)[source]
Bases:
SpeQtrumModelDeserialized execution result returned by the SpeQtrum API.
The
typediscriminator indicates which result field is populated. Use the corresponding accessor (e.g.functional_result,variational_program_result) to retrieve the typed payload.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- type: ExecuteType = None[source]
- functional_result: qilisdk.functionals.FunctionalResult | None = None[source]
- variational_program_result: qilisdk.functionals.VariationalProgramResult | None = None[source]
- rabi_experiment_result: qilisdk.experiments.RabiExperimentResult | None = None[source]
- t1_experiment_result: qilisdk.experiments.T1ExperimentResult | None = None[source]
- t2_experiment_result: qilisdk.experiments.T2ExperimentResult | None = None[source]
- two_tones_experiment_result: qilisdk.experiments.TwoTonesExperimentResult | None = None[source]
- TFunctionalResult_co[source]
- TVariationalInnerResult[source]
- ResultExtractor[source]
Type alias for a callable that extracts a typed result from an
ExecuteResult.
- class JobHandle(/, **data: Any)[source]
Bases:
SpeQtrumModel,Generic[TFunctionalResult_co]Strongly typed reference to a submitted SpeQtrum job.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- id: int[source]
- execute_type: ExecuteType[source]
- extractor: ResultExtractor[TFunctionalResult_co] = None[source]
- classmethod functional(job_id: int) JobHandle[qilisdk.functionals.FunctionalResult][source]
Create a handle for a
DigitalPropagationorAnalogEvolutionjob.- Parameters:
job_id (
int) – Numeric identifier returned by the SpeQtrum service.- Returns:
A handle whose result type is
FunctionalResult.- Return type:
- classmethod variational_program(job_id: int) JobHandle[qilisdk.functionals.VariationalProgramResult][source]
- classmethod variational_program(job_id: int, *, result_type: type[TVariationalInnerResult]) JobHandle[VariationalProgramResult[TVariationalInnerResult]]
Create a variational-program handle for an existing job identifier.
- Parameters:
job_id – Numeric identifier returned by the SpeQtrum service.
result_type – Optional functional result type expected within the variational program payload. When provided the returned handle enforces that the optimiser output matches this type.
- Returns:
A handle whose
get_resultsinvocation yields aVariationalProgramResultpreserving the requested inner result type when supplied.- Return type:
- classmethod rabi_experiment(job_id: int) JobHandle[qilisdk.experiments.RabiExperimentResult][source]
Create a handle for a Rabi experiment job.
- Parameters:
job_id (
int) – Numeric identifier returned by the SpeQtrum service.- Returns:
A handle whose result type is
RabiExperimentResult.- Return type:
- classmethod t1_experiment(job_id: int) JobHandle[qilisdk.experiments.T1ExperimentResult][source]
Create a handle for a T1 experiment job.
- Parameters:
job_id (
int) – Numeric identifier returned by the SpeQtrum service.- Returns:
A handle whose result type is
T1ExperimentResult.- Return type:
- classmethod t2_experiment(job_id: int) JobHandle[qilisdk.experiments.T2ExperimentResult][source]
Create a handle for a T2 experiment job.
- Parameters:
job_id (
int) – Numeric identifier returned by the SpeQtrum service.- Returns:
A handle whose result type is
T2ExperimentResult.- Return type:
- classmethod two_tones_experiment(job_id: int) JobHandle[qilisdk.experiments.TwoTonesExperimentResult][source]
Create a handle for a Two-Tones experiment job.
- Parameters:
job_id (
int) – Numeric identifier returned by the SpeQtrum service.- Returns:
A handle whose result type is
TwoTonesExperimentResult.- Return type:
- bind(detail: JobDetail) TypedJobDetail[TFunctionalResult_co][source]
Attach this handle’s typing information to a concrete job detail.
- Parameters:
detail – Un-typed job detail payload returned by the SpeQtrum API.
- Returns:
Wrapper exposing
get_resultswith the typing captured when the handle was created.- Return type:
- class JobStatus[source]
Bases:
str,enum.EnumEnumeration of possible job lifecycle states.
Initialize self. See help(type(self)) for accurate signature.
- PENDING = 'pending'[source]
Job has been queued but not yet validated
- VALIDATING = 'validating'[source]
Job has been validated and is queued for execution
- QUEUED = 'queued'[source]
Job is being executed on the device
- RUNNING = 'running'[source]
Job finished successfully
- COMPLETED = 'completed'[source]
Job failed due to an error
- ERROR = 'error'[source]
Job was cancelled by the user or system
- CANCELLED = 'cancelled'[source]
Job failed due to timeout
- TIMEOUT = 'timeout'[source]
- class JobType[source]
Bases:
str,enum.EnumEnumeration of job categories used by the SpeQtrum scheduler.
Initialize self. See help(type(self)) for accurate signature.
- DIGITAL = 'digital'[source]
- PULSE = 'pulse'[source]
- ANALOG = 'analog'[source]
- VARIATIONAL = 'variational'[source]
- class JobId(/, **data: Any)[source]
Bases:
SpeQtrumModelHandle/reference you normally get back immediately after POST /execute.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- id: int = None[source]
- class JobInfo(/, **data: Any)[source]
Bases:
JobIdLight-weight representation suitable for ‘list jobs’ and polling when you do not need logs or results.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- name: str = None[source]
- description: str = None[source]
- device_id: int = None[source]
- created_at: pydantic.AwareDatetime = None[source]
- updated_at: pydantic.AwareDatetime | None = None[source]
- completed_at: pydantic.AwareDatetime | None = None[source]
- class JobDetail(/, **data: Any)[source]
Bases:
JobInfoFull representation returned by GET /jobs/{id} when payload/result/logs are requested.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- payload: ExecutePayload | None = None[source]
- result: ExecuteResult | None = None[source]
- logs: str | None = None[source]
- error: str | None = None[source]
- error_logs: str | None = None[source]
- class TypedJobDetail(/, **data: Any)[source]
Bases:
JobDetail,Generic[TFunctionalResult_co]JobDetail subclass that exposes a strongly typed get_results method.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- expected_type: ExecuteType = None[source]
- extractor: ResultExtractor[TFunctionalResult_co] = None[source]
- get_results() TFunctionalResult_co[source]
Return the strongly typed execution result.
- Returns:
Result payload associated with the completed job, respecting the type information carried by the originating
JobHandle.- Return type:
ResultT_co
- Raises:
RuntimeError – If SpeQtrum has not populated the result payload or the execute type disagrees with the handle.