Skip to content

Results are limited to Quantum Evolution Kernel v0.2.9

Product news
You are reading Quantum Evolution Kernel v0.2.9, an older version of this documentation. Go to the latest version (v0.3.4)

qek.data.processed_data

module
qek.data.processed_data

Loading, saving, manipulation or processed data.

Classes

  • ProcessedData — Data on a single graph obtained from the Quantum Device.

Functions

  • dist_excitation — Calculates the distribution of excitation energies from a dictionary of bitstrings to their respective counts.

  • save_dataset — Saves a dataset to a JSON file.

  • load_dataset — Loads a dataset from a JSON file.

class
ProcessedData (sequence: pl.Sequence, state_dict: dict[str, int | np.int64], target: int | None)

Data on a single graph obtained from the Quantum Device.

Attributes

  • register : pl.Register — The geometry of atoms on the Quantum Device, obtained by compiling the graph for execution on the Quantum Device.

  • pulse : pl.Pulse — The laser pulse, obtained by compiling the graph for execution on the Quantum Device.

  • state_dict : Final[dict[str, int]] — A dictionary {bitstring: number of instances} for this graph.

  • target : Final[int | None] — If specified, the machine-learning target, as a value 0 or 1.

Methods

classmethod
from_register (register: pl.Register, pulse: pl.Pulse, device: pl.devices.Device, state_dict: dict[str, int | np.int64], target: int | None) → ProcessedData

method
save_to_file (file_path: str) → None

method
dist_excitation (size: int | None = None) → np.ndarray

Return the distribution of excitations for this graph.

Parameters

  • size : int | None — If specified, truncate or pad the array to this size.

property
pulse : pl.Pulse

The laser pulse used to process this data.

property
register : pl.Register

The register to which the graph was compiled.

method
draw_pulse () → None

Draw the pulse on screen

method
draw_register () → None

Draw the register on screen

method
draw_excitation () → None

Draw an histogram for the excitation level on screen

dist_excitation (state_dict: dict[str, int], size: int | None = None) → np.ndarray

Calculates the distribution of excitation energies from a dictionary of bitstrings to their respective counts.

Parameters

  • size : int | None — If specified, only keep size energy distributions in the output. Otherwise, keep all values.

Returns

  • np.ndarray — A histogram of excitation energies. - index: an excitation level (i.e. a number of 1 bits in a bitstring) - value: normalized count of samples with this excitation level.

save_dataset (dataset: list[ProcessedData], file_path: str) → None

Saves a dataset to a JSON file.

Parameters

  • dataset : list[ProcessedData] — The dataset to be saved, containing RegisterData instances.

  • file_path : str — The path where the dataset will be saved as a JSON file.

Returns

  • None — None

load_dataset (file_path: str) → list[ProcessedData]

Loads a dataset from a JSON file.

Parameters

  • file_path : str — The path to the JSON file containing the dataset.

Returns

  • list[ProcessedData] — A list of ProcessedData instances, corresponding to the data stored in the JSON file.