2.6.4.3. pycsamt.emtf.xml.serializer#

EMTF scientific objects -> deterministic XML element trees.

The serializer is intentionally separate from filesystem I/O. It translates format-neutral pycsamt.emtf.EMTF objects into the EMTF XML vocabulary without routing through EDI or exposing ElementTree nodes to the scientific model.

Classes

EMTFXMLSerializer(*[, strict, precision])

Build a deterministic EMTF XML element tree from an EMTF.

Exceptions

EMTFXMLSerializationError

Raised when an EMTF object cannot be serialized safely.

EMTFXMLWriteWarning

Warning emitted when permissive XML writing omits unsafe content.

exception pycsamt.emtf.xml.serializer.EMTFXMLSerializationError[source]

Bases: ValueError

Raised when an EMTF object cannot be serialized safely.

exception pycsamt.emtf.xml.serializer.EMTFXMLWriteWarning[source]

Bases: UserWarning

Warning emitted when permissive XML writing omits unsafe content.

class pycsamt.emtf.xml.serializer.EMTFXMLSerializer(*, strict=True, precision=17)[source]

Bases: PyCSAMTObject

Build a deterministic EMTF XML element tree from an EMTF.

Parameters:
  • strict (bool, default=True) – Reject unsupported or scientifically ambiguous content. Permissive mode warns and omits only the problematic component.

  • precision (int, default=17) – Significant decimal digits used for floating-point response data. Seventeen digits are sufficient to round-trip IEEE float64 values.

to_element(document)[source]

Return the root <EM_TF> element for document.

Parameters:

document (EMTF)

Return type:

Element