mpylab.env.immunity_result module

Structured, disturbance-neutral immunity-result export.

mpylab.env.immunity_result.build_immunity_document(*, application, eut_description, performance_criterion, records, created_at)

Build a disturbance-neutral, JSON-compatible immunity document.

Parameters:
  • application (str) – Name of the application or measurement workflow.

  • eut_description (str) – Description of the equipment under test.

  • performance_criterion (str) – Performance criterion used to assess the EUT.

  • records (iterable) – Immunity result records to include.

  • created_at (str) – Timestamp associated with the document.

Returns:

JSON-compatible document following the mpylab immunity schema.

Return type:

dict

mpylab.env.immunity_result.load_immunity_document(path)

Load and minimally validate a structured immunity-result document.

Parameters:

path (path-like) – Input filename.

Returns:

Validated immunity document.

Return type:

dict

Raises:

ValueError – If the schema, schema version, or records collection is invalid.

mpylab.env.immunity_result.to_json_compatible(value)

Recursively convert mpylab and scuq result objects to JSON values.

Parameters:

value (object) – Value to convert. Quantities, NumPy objects, complex numbers, mappings, sequences, and objects providing as_dict are handled explicitly.

Returns:

A value composed only of JSON-compatible scalar and container types.

Return type:

object

mpylab.env.immunity_result.write_immunity_document(path, document)

Write an immunity document.

Parameters:
  • path (path-like) – Destination filename.

  • document (mapping) – JSON-compatible immunity document.

Returns:

Resolved path of the written file.

Return type:

pathlib.Path