pymixef.interoperability package

Interchange utilities with explicit compatibility accounting.

class pymixef.interoperability.CompatibilityReport(source_format, target_format, issues=(), metadata=<factory>)[source]

Bases: object

Machine-readable accounting for every translated construct.

Parameters:
  • source_format (str)

  • target_format (str)

  • issues (tuple[CompatibilityIssue, ...])

  • metadata (dict[str, Any])

source_format: str
target_format: str
issues: tuple[CompatibilityIssue, ...]
metadata: dict[str, Any]
by_status(status)[source]
Parameters:

status (str)

Return type:

tuple[CompatibilityIssue, …]

require_supported()[source]
Return type:

None

property supported: bool
to_dict()[source]
Return type:

dict[str, Any]

write(path)[source]
Parameters:

path (str | Path)

Return type:

Path

class pymixef.interoperability.InterchangeResult(value, report)[source]

Bases: Generic[T]

A translated value paired with its mandatory compatibility report.

Parameters:
value: T
report: CompatibilityReport
require_supported()[source]
Return type:

T

pymixef.interoperability.export_pharmml(model, path)[source]

Export parameter declarations to a minimal, reviewable PharmML document.

Parameters:
  • model (Mapping[str, Any])

  • path (str | Path)

Return type:

InterchangeResult[Path]

pymixef.interoperability.export_sbml(model, path)[source]

Export state declarations to a reviewable SBML Level 3 Version 2 file.

States become species in one default compartment. Rate equations and model fields outside the declaration-only subset are reported as unsupported; the file is still written so callers must inspect the report or call InterchangeResult.require_supported() when partial export is unsafe.

Parameters:
  • model (Mapping[str, Any])

  • path (str | Path)

Return type:

InterchangeResult[Path]

pymixef.interoperability.export_sedml(design, path)[source]

Export one uniform-time-course design as SED-ML Level 1 Version 4.

output_end_time and number_of_points are required. The export records the deterministic output grid and KiSAO identifier; richer SED-ML tasks and ranges are outside this function’s supported subset.

Parameters:
  • design (Mapping[str, Any])

  • path (str | Path)

Return type:

InterchangeResult[Path]

pymixef.interoperability.import_nonmem_data(data, *, column_mapping=None)[source]

Normalize NONMEM-style columns; event canonicalization remains separate.

Parameters:
  • data (Mapping[str, Any])

  • column_mapping (Mapping[str, str] | None)

Return type:

InterchangeResult[dict[str, ndarray]]

pymixef.interoperability.import_nonmem_table(path)[source]

Import a comma- or whitespace-delimited NONMEM output table.

Repeated TABLE NO. preambles are removed explicitly and reported. The importer requires one header row and refuses ragged records.

Parameters:

path (str | Path)

Return type:

InterchangeResult[dict[str, ndarray]]

pymixef.interoperability.import_pharmml(path)[source]

Read symbols and structural-model metadata from a PharmML document.

Parameters:

path (str | Path)

Return type:

InterchangeResult[dict[str, Any]]

pymixef.interoperability.import_sbml(path)[source]

Import the declaration-only SBML Level 3 Version 2 Core subset.

Compartments, species, and parameters are returned as plain mappings. Reactions, rules, events, foreign namespaces, and unrecognized content are retained as unsupported compatibility issues instead of being silently translated. Call InterchangeResult.require_supported() to refuse partial imports.

Parameters:

path (str | Path)

Return type:

InterchangeResult[dict[str, Any]]

pymixef.interoperability.import_sedml(path)[source]

Import uniform-time-course simulations from a SED-ML document.

The result captures output grids and KiSAO algorithm identifiers. One-step, steady-state, repeated-task, and functional-range constructs are reported as unsupported; call InterchangeResult.require_supported() to reject a partial translation.

Parameters:

path (str | Path)

Return type:

InterchangeResult[dict[str, Any]]

pymixef.interoperability.parse_control_stream(value)[source]

Parse records and preserve a documented NM-TRAN subset.

Structural code is retained verbatim but marked unsupported for automatic compilation. This is deliberate refusal rather than an unsafe approximation.

Parameters:

value (str | Path)

Return type:

InterchangeResult[dict[str, list[str]]]

pymixef.interoperability.translate_r_formula(formula)[source]

Translate the supported lme4 formula subset without changing semantics.

PyMixEF intentionally uses the same operators for its safe formula grammar. R function calls and environment lookups are refused because arbitrary code evaluation is outside that grammar.

Parameters:

formula (str)

Return type:

InterchangeResult[str]

Submodules