# mqt.ionshuttler.linear.field_profile

Site-dependent field values associated with a Linear architecture.

## Module Contents

### *class* FieldProfile

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](https://docs.python.org/3/builtins/functions.html#int)*

#### site_field *: [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[int](https://docs.python.org/3/builtins/functions.html#int), [float](https://docs.python.org/3/builtins/functions.html#float)], ...]*

#### default_field *: [float](https://docs.python.org/3/builtins/functions.html#float)* *= 1.0*

#### \_\_post_init_\_() → [None](https://docs.python.org/3/builtins/constants.html#None)

Fill unspecified sites and store the profile in site order.

* **Raises:**
  [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If the number of sites or a site index is invalid.

#### field_at(site: [int](https://docs.python.org/3/builtins/functions.html#int)) → [float](https://docs.python.org/3/builtins/functions.html#float)

Return the field at one site.

* **Parameters:**
  **site** – Zero-based architecture site.
* **Returns:**
  The configured field value.
* **Raises:**
  [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If `site` lies outside the architecture.

#### *classmethod* from_dict(data: [object](https://docs.python.org/3/builtins/functions.html#object), num_sites: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [FieldProfile](#mqt.ionshuttler.linear.field_profile.FieldProfile)

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

* **Parameters:**
  * **data** – JSON-style field-profile mapping.
  * **num_sites** – LinearArchitecture size for structured mappings.
* **Returns:**
  A complete field profile covering every site.
* **Raises:**
  [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If the mapping has an invalid shape or lacks a required size.

#### *classmethod* from_json(raw: [str](https://docs.python.org/3/builtins/stdtypes.html#str), num_sites: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [FieldProfile](#mqt.ionshuttler.linear.field_profile.FieldProfile)

Deserialize a field profile from JSON.

* **Parameters:**
  * **raw** – Serialized JSON object.
  * **num_sites** – LinearArchitecture size for structured mappings.
* **Returns:**
  A complete field profile covering every site.

#### *classmethod* load(filename: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [Path](https://docs.python.org/3/library/pathlib.html#pathlib.Path), num_sites: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [FieldProfile](#mqt.ionshuttler.linear.field_profile.FieldProfile)

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

* **Parameters:**
  * **filename** – File to read.
  * **num_sites** – LinearArchitecture size for structured mappings.
* **Returns:**
  A complete field profile covering every site.

#### to_dict() → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [object](https://docs.python.org/3/builtins/functions.html#object)]

Return JSON-compatible profile metadata.

#### to_json() → [str](https://docs.python.org/3/builtins/stdtypes.html#str)

Serialize the profile as JSON.

* **Returns:**
  The serialized profile object.
