Top-level API#

The primary entry points of massphoto are available directly at the package root after import massphoto as mp.

This page summarises all top-level functions and classes and links to their full reference documentation.

Primary Functions#

fit

Detect events and fit PSFs with chunked (Dask) processing.

read_movie

Read a movie file and return (frames, metadata).

calc_ratiometric

Calculate ratiometric movie to reveal contrast changes over time.

Event Detection & PSF Fitting#

detect

Detect events in a movie with chunked (Dask) processing.

detect_on_map

Detects peaks in a multi-dimensional array of maps.

fit_event

Fit PSFs to detected events for precise position and contrast determination.

PSF2D

A class to represent a 2D point spread function (PSF) with custom or default parameters.

fit_psf_params

Fit the parameters of the PSF model to a given PSF guess.

get_psf_thumbnails

Extracts valid point spread function (PSF) thumbnails from a processed movie based on the provided coordinates.

Movie Transformations & Drift#

correct_drift

Correct drift in a movie by applying a per-frame translation.

calc_differential

Calculate the differential image based on the given parameters.

calc_mobileframes

Calculate "mobile frames" by local median background subtraction.

calc_frame_sharpness

Calculate relative sharpness for each frame.

normalize_frames

Normalize frame means to remove slow illumination drift.

rebin_movie

Rebin a 2D image or 3D movie by averaging blocks.

Event Metrics & Metadata#

add_local_density

Add the local density to the localizations DataFrame.

add_nearest_neighbour

Add the nearest neighbour distance to the localizations DataFrame.

annotate_frame_metrics

Annotate an event DataFrame with frame-level metrics.

convert_metadata

Convert metadata dictionary to a standardized format.

Pipeline Orchestration & Replay#

process

Run a chunked, parallel processing pipeline over a movie.

resolve_record

Resolve an analysis record into defaults overrides and a replay callable.

File Export#

save_mp

Save a movie to the MassPhotometer .mp HDF5 container format.

save_h5

Save a movie to an HDF5 file.

save_tiff

Save a movie as a multi-page TIFF file.