mqt.ionshuttler.linear.field_profile

Site-dependent field values associated with a Linear architecture.

Module Contents

class FieldProfile[source]

Store the scalar field assigned to each hardware site.

Unspecified sites receive default_field. Values retain their supplied scale; this class does not perform RMS normalization. The compiler stores the profile for downstream analysis but does not use it during search.

num_sites: int
site_field: tuple[tuple[int, float], ...]
default_field: float = 1.0
__post_init__() → None[source]

Fill unspecified sites and store the profile in site order.

Raises:

ValueError – If the number of sites or a site index is invalid.

field_at(site: int) → float[source]

Return the field at one site.

Parameters:

site – Zero-based architecture site.

Returns:

The configured field value.

Raises:

ValueError – If site lies outside the architecture.

classmethod from_dict(data: object, num_sites: int | None = None) → FieldProfile[source]

Construct a profile from structured or site-to-value mapping data.

Parameters:
  • data – JSON-style field-profile mapping.

  • num_sites – Architecture size for structured mappings.

Returns:

A complete field profile covering every site.

Raises:

ValueError – If the mapping has an invalid shape or lacks a required size.

classmethod from_json(raw: str, num_sites: int | None = None) → FieldProfile[source]

Deserialize a field profile from JSON.

Parameters:
  • raw – Serialized JSON object.

  • num_sites – Architecture size for structured mappings.

Returns:

A complete field profile covering every site.

classmethod load(filename: str | Path, num_sites: int | None = None) → FieldProfile[source]

Load a field profile from a UTF-8 JSON file.

Parameters:
  • filename – File to read.

  • num_sites – Architecture size for structured mappings.

Returns:

A complete field profile covering every site.

to_dict() → dict[str, object][source]

Return JSON-compatible profile metadata.

to_json() → str[source]

Serialize the profile as JSON.

Returns:

The serialized profile object.