playnano.analysis.export module

Write an analysis record to a JSON file.

playnano.analysis.export.export_analysis_to_json(out_path: str, analysis_record: dict[str, Any]) → None[source]

Write an analysis record to a JSON file, with arrays written in full.

Unlike AnalysisPipeline.run(log_to=...), which summarises arrays, this writes every value: arrays become nested lists and NumPy numbers become Python numbers (see NumpyEncoder).

Parameters:
  • out_path (str) – The JSON file to write. Missing folders are created.

  • analysis_record (dict) – The record returned by run().

Raises:
  • TypeError – If the record holds a value that cannot be written as JSON.

  • OSError – If the file cannot be written.