Skip to content

Analysis

basic

Basic calibrated image operations.

stats

stats(ds: Dataset) -> dict

Intensity statistics and an estimate of the noise (Gaussian sigma) and SNR.

calibrate

calibrate(ds: Dataset, pixel_size_nm: float, reason: str = '') -> Dataset

Set or correct the pixel size (e.g. from a calibration standard); the reason is kept.

denoise

denoise(ds: Dataset, method: str = 'nlm', strength: float = 1.0) -> Dataset

'nlm' (non-local means), 'gaussian' or 'median'.

subtract_background

subtract_background(ds: Dataset, sigma_nm: Optional[float] = None, sigma_px: float = 50.0) -> Dataset

Remove slow shading by subtracting a wide Gaussian blur.

fft

fft(ds: Dataset, window: bool = True, log: bool = True) -> Dataset

Power spectrum with reciprocal-space axes in 1/nm (1/px when uncalibrated).

radial_profile

radial_profile(ds: Dataset, bins: int = 200) -> pd.DataFrame

Azimuthal average around the centre; on a power spectrum, peaks give lattice or feature periodicities.

line_profile

line_profile(ds: Dataset, start: tuple[float, float], end: tuple[float, float], width: int = 1) -> pd.DataFrame

Intensity along a line between (y, x) pixel positions, averaged over width pixels.

particles

Particle / feature analysis in physical units.

threshold

threshold(ds: Dataset, method: str = 'otsu', value: Optional[float] = None, dark: bool = False) -> Dataset

Binary mask: features brighter (or darker, dark=True) than the threshold.

particles

particles(ds: Dataset, method: str = 'otsu', dark: bool = False, min_area_nm2: float = 0.0, exclude_border: bool = True, separate: bool = False, min_distance_nm: Optional[float] = None) -> pd.DataFrame

One row per particle: area, equivalent diameter, Feret, aspect ratio, circularity, orientation and mean intensity, in nm. Accepts an image (thresholded with method) or a mask; separate splits touching particles with a distance-transform watershed.

core

Provenance-tracking decorator for analysis operations.

tracked

tracked(op: str)

Record the call as a provenance activity on the returned dataset(s) or table.