topqad_sdk.library package
Submodules
topqad_sdk.library.circuit_library module
- class topqad_sdk.library.circuit_library.CircuitLibrary[source]
Bases:
object
Base class for managing circuits in the TopQAD pipeline.
Provides methods to access example circuits, retrieve and list circuits for persistent reuse and lookup.
- _client
Instance of HTTPClient for managing HTTP requests.
- Type:
HTTPClient
- _logger
Logger instance for logging operations.
- Type:
logging.Logger
- _example_circuits
List of example circuit names.
- Type:
list
- property example_circuits: list[Circuit]
Returns a list of example circuits.
- Returns:
A list of example circuits.
- Return type:
list[Circuit]
- get_circuit(circuit_id: str) Circuit [source]
Retrieves a circuit by its ID.
- Parameters:
circuit_id (str) – The ID of the circuit.
- Returns:
The response containing circuit details.
- Return type:
Circuit
- Raises:
TopQADError – If the retrieval fails.
- list_examples() list [source]
Fetches and updates the list of all available example circuits.
- Returns:
A list of example circuits.
- Return type:
list
- Raises:
TopQADError – If the request to list examples fails.
- property service_url
Returns the URL for the CircuitLibrary.
topqad_sdk.library.hardware_parameter_library module
- class topqad_sdk.library.hardware_parameter_library.HardwareParameters(**kwargs)[source]
Bases:
object
HardwareParameters class.
Provides default hardware parameters, allows user customization via keyword arguments, supports loading configuration from a dictionary or JSON file, and can serialize the configuration into a dictionary for pipeline input.
- _params
The current hardware parameters.
- Type:
HardwareParameterModel
- property as_dict: dict[str, Any]
Return the parameters as a dictionary.
- Returns:
A dictionary representation of the current hardware parameters.
- Return type:
dict[str, Any]
- load_from_dict(params: dict)[source]
Override current parameters using a dictionary.
- Parameters:
params (dict) – A dictionary containing hardware parameters to override
settings. (the current)
- Raises:
TopQADValueError – If the provided dictionary does not match the expected
parameter names or types. –
- load_from_json_file(file_path: str)[source]
Override current parameters using a JSON file.
- Parameters:
file_path (str) – Path to the JSON file containing hardware parameters.
- Raises:
FileNotFoundError – If the specified file does not exist.
json.JSONDecodeError – If the file content is not valid JSON.
TopQADValueError – If the JSON content does not match the expected parameter
names or types. –
- load_from_json_string(json_str: str)[source]
Override current parameters using a JSON string.
- Parameters:
json_str (str) – JSON string containing hardware parameters.
- Raises:
json.JSONDecodeError – If the string is not valid JSON.
TopQADValueError – If the JSON content does not match the expected parameter
names or types. –