Skip to content

Input and output

io

Reading and saving NUANCE data.

load(source) accepts a local path or a globus://<collection>/<path> URL and returns a :class:~nuscope.Dataset with calibrated axes, normalized metadata and provenance (the source file's SHA-256, where it came from, who read it and with which software).

Formats:

  • NUANCE SEM/FIB TIFFs (Thermo Fisher/FEI, Zeiss, Hitachi, JEOL), read natively;
  • 40+ electron-microscopy formats through RosettaSciIO: Gatan DM3/DM4, Thermo Fisher Velox EMD, TIA SER/EMI, JEOL, Bruker BCF, EDAX, MRC, MIB, Delmic, PantaRhei, ...;
  • NUScope's own files: NeXus/HDF5 .nxs or .h5, Zarr .zarr and TIFF with embedded metadata, all carrying the full provenance and a cryptographic seal (see :mod:nuscope.integrity) that is checked on every read.

load

load(source, *, crop_databar: bool = True, lazy: bool = False, index: int = 0, **kw) -> Dataset

Load one dataset (the index-th if the file holds several).

NUScope files are verified against their seal; the report is in ds.integrity.

save

save(ds: Dataset, path, *, overwrite: bool = False, compression: Optional[str] = 'gzip', sign: Optional[bool] = None) -> Path

Save to .nxs or .h5 (NeXus/HDF5), .zarr or .tif, with metadata, provenance and a seal.

The seal holds SHA-256 hashes of data, calibration, metadata and history. sign=None also signs it when you have a key (nuscope keys create), True requires a key and False leaves it unsigned.

read_document

read_document(path: Path)

The array and the NUScope document (metadata, axes, provenance, seal) of a NUScope file, untouched.

write_seal

write_seal(path: Path, seal: dict)

Replace the seal of a NUScope file (used to add signatures; the manifest itself never changes).