Skip to content

nuscope

nuscope

NUScope: read, analyze, save and trace electron-microscopy data at the NUANCE Center, Northwestern University.

import nuscope as ns
img = ns.load("Quanta/ResolutionTest_SE_10kx_5kv_008.tif")        # or globus://<collection>/<path>
print(img.describe())
parts = ns.analyze.particles(ns.analyze.denoise(img))
ns.save(img, "result.h5")                                        # metadata + provenance + seal inside
print(ns.verify("result.h5"))                                    # intact? signed by whom?
print("\n".join(img.provenance.lineage()))

Created by Roberto dos Reis (@rmsreis), NUANCE Center. Original instrument loaders by Nathaniel Kabat.

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.

load_all

load_all(source, *, crop_databar: bool = True, lazy: bool = False, **kw) -> list[Dataset]

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.

verify

verify(path) -> Report

Verify a NUScope file (.nxs, .h5, .zarr or .tif) without loading it as a dataset.

formats

formats() -> list[str]