mpylab.env.tem.verification_pickle module

Reprocess and reduce trusted TEM verification history pickles.

mpylab.env.tem.verification_pickle.build_minimal_verification_history(history, description, frequencies)

Build a portable regression history from selected raw frequencies.

Parameters:
  • history (TEMCell) – Trusted, already reprocessed source history.

  • description (str) – Verification description to retain.

  • frequencies (iterable of float) – Raw frequency keys to retain.

Returns:

Independent minimal history with freshly evaluated processed data.

Return type:

TEMCell

Raises:

KeyError – If the description or a frequency is unavailable.

mpylab.env.tem.verification_pickle.file_sha256(path)

Return the SHA-256 digest of a file.

Parameters:

path (path-like) – File to hash.

Returns:

Lower-case hexadecimal SHA-256 digest.

Return type:

str

mpylab.env.tem.verification_pickle.migrate_verification_raw_data_schema4(raw)

Return raw TEM verification data with schema-4 field names.

The migration changes only serialized terminology and structure. It keeps measurement values, uncertainty expressions, and the stored measurement graph unchanged.

Parameters:

raw (mapping) – One entry from TEMCell.rawData_Verification.

Returns:

Independent schema-4 raw-data mapping.

Return type:

dict

mpylab.env.tem.verification_pickle.reprocess_verification_history(history, descriptions=None, source_sha256=None)

Re-evaluate verification results from unchanged stored raw data.

Parameters:
  • history (TEMCell) – Trusted measurement history to update in memory.

  • descriptions (iterable of str or None, optional) – Raw verification descriptions to evaluate. The default evaluates all stored descriptions.

  • source_sha256 (str or None, optional) – Digest of the serialized source history for provenance.

Returns:

Provenance stored on the history and in every reprocessed result.

Return type:

dict

Raises:
  • TypeError – If history is not a TEMCell.

  • KeyError – If a requested description has no raw verification data.

  • RuntimeError – If evaluation fails.

mpylab.env.tem.verification_pickle.select_minimal_fixture_frequencies(processed, preferred_frequency=80000000.0)

Select representative frequencies from a multi-target result.

The result includes the preferred frequency when available and then the first examples of regular field uniformity, a hard uniformity failure, AM-headroom failure, and TEM-mode failure. Duplicate examples are folded.

Parameters:
  • processed (mapping) – Reprocessed verification result.

  • preferred_frequency (float, optional) – Frequency to retain as the primary regression case.

Returns:

Sorted frequency keys, normally no more than five.

Return type:

tuple

Raises:

ValueError – If no target results or frequencies are available.

mpylab.env.tem.verification_pickle.write_reprocessed_verification_pickle(source, destination, descriptions=None)

Load, reprocess, atomically write, and verify a trusted history pickle.

Parameters:
  • source (path-like) – Trusted input pickle.

  • destination (path-like) – New output path. It must differ from source.

  • descriptions (iterable of str or None, optional) – Verification descriptions to reprocess.

Returns:

Reprocessed history, source SHA-256, and output SHA-256.

Return type:

tuple

Raises:

ValueError – If source and destination resolve to the same path.