upxo.interfaces.io.expop module

Multi-format export of NumPy arrays for UPXO (ArrExp2d).

ArrExp2d.save(data, filename, ...) dispatches on file extension:

  • .npy / .npz — NumPy (optional compression)

  • .csv / .txt — text

  • .xlsx — Excel via pandas

  • .mat — SciPy (optional)

  • .h5 / .hdf5 — h5py if installed

  • .vtk / .vti — PyVista ImageData

  • image formats — matplotlib visual or Pillow raw

Used by surrogate batch jobs and ad-hoc array I/O. Not a grain-structure object serializer (use CTF/VTK GS methods and FE exporters for those).

class upxo.interfaces.io.expop.ArrExp2d[source]

Bases: object

Multi-format exporter for NumPy arrays (static helpers).

ArrExp2d.save(data, filename, compression=False, **kwargs) chooses a handler from the file extension (.npy, .npz, .csv, .xlsx, .mat, .h5/.hdf5, .vtk/.vti, common image formats). Used by surrogate batch jobs and ad-hoc array I/O — not a full grain-structure serializer.

Example

>>> from upxo.interfaces.io.expop import ArrExp2d as arex2
>>> arex2.save(label_field, 'slice_0001.npy')
static save(data: numpy.ndarray, filename: str, compression=False, **kwargs)[source]

Main entry point. Detects extension and dispatches to the correct handler.