Physically-driven synthetic 1-photon miniscope data: a forward-model generator and teaching tool.
Minisim builds a miniscope recording forward from its physical components, the inverse of an analysis pipeline like minian. Instead of recovering signals from a movie, it starts from biology and optics and produces the movie, together with the ground truth that generated it:
place neurons -> cell activity -> bleaching -> optics -> composite -> neuropil
-> brain motion -> illumination profile -> vignette -> leakage
-> (sensor defects) -> image sensor
Each stage is a small, inspectable physical model. Because the recording is built forward, every recording ships with exact ground truth (cell locations, footprints, calcium traces, spike times, motion trajectory, per-pixel optical fields), which makes Minisim useful for:
- Benchmarking calcium-imaging pipelines (minian, CaImAn, suite2p, ...) against known ground truth.
- Teaching the anatomy of miniscope data: what each physical effect does to the image, via interactive notebooks.
- Testing analysis code with reproducible, parameterized fixtures.
Beyond the core chain, opt-in realism (all off by default, so existing specs render
unchanged): a heavy-tailed scatter halo on the optical PSF
(Tissue.scatter_halo_fraction), realistic broadband brain motion with a non-rigid
deformation field (BrainMotion(model="miniscope", nonrigid=True)), and sensor
defects (hot/stuck pixels, PRNU, row/column fixed-pattern noise: SensorDefects).
Recordings can be written as a Miniscope-DAQ folder (write_miniscope_daq, or the
minisim generate command) so pipelines that read real DAQ output can be pointed at
simulated data, with the exact ground truth alongside.
Every cell also carries a detectable flag: whether a pipeline could recover it from
this movie at all. It is a matched-filter SNR over the cell's realized footprint and
all its transients, against the shot and read noise of everything on the sensor
(matched_filter_snr), with a threshold calibrated against a strong pipeline's
recovery. By default, recall is scored over the detectable cells.
📖 Full documentation: minisim.readthedocs.io - concepts, quickstart, how-to guides, and the API reference.
Install
pip install minisim # engine only
pip install "minisim[notebook]" # + the interactive teaching notebooks
Requires Python >= 3.10. Core dependencies are just numpy, scipy, xarray, zarr, pydantic, and numpydantic.
The teaching notebooks ship inside the package; list them and copy the ones you want out to a writable directory with the bundled command:
minisim-notebooks list # see what's available
minisim-notebooks copy 01_anatomy # -> ./minisim-notebooks/01_anatomy
# then: cd minisim-notebooks/01_anatomy && jupyter lab
Quick start
from minisim import (
Acquisition, Optics, ImageSensor, PlaceNeurons, CellActivity,
CellOptics, Composite, Sensor, Spec, simulate,
)
spec = Spec(
acquisition=Acquisition(
fps=20.0, duration_s=10.0,
optics=Optics(magnification=8.0, na=0.45),
image_sensor=ImageSensor(n_px_height=256, n_px_width=256, pixel_pitch_um=8.0),
),
seed=0,
steps=[
PlaceNeurons(density_per_mm3=400000.0, soma_radius_um=4.0),
CellActivity(),
CellOptics(),
Composite(),
Sensor(),
],
)
rec = simulate(spec)
movie = rec.observed # xarray DataArray (frame, height, width)
truth = rec.ground_truth # cells, traces, spikes, optical fields
Or generate a Miniscope-DAQ-layout folder (N.avi, metaData.json, timeStamps.csv,
plus ground_truth/) straight from the shell:
minisim generate --preset miniscope_v4 --region ca1 --duration 60 --seed 0 \
--motion miniscope --nonrigid --out ./sim_v4_ca1
Relationship to minian
Minisim is the forward (generative) counterpart to minian's inverse (analysis) pipeline. The dependency is designed to be strictly one-directional: Minisim never imports minian. The intended integration is for minian to use Minisim as a test dependency, supplying ground-truth fixtures for its recovery tests; that wiring is planned, not yet in place.
License
GPL-3.0-or-later. See LICENSE.
Metadata
Release files for minisim 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| minisim-1.1.0.tar.gz | 2.5 MB | With provenance | Details for minisim-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| minisim-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for minisim-1.1.0-py3-none-any.whl |
Total release size: 5.0 MB
Release files / minisim-1.1.0.tar.gz
| Download URL | minisim-1.1.0.tar.gz |
|---|---|
| Size | 2.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c23f4d0476ff8a2bd9d5f5b3a305c1db78ed2b501558eb99c97fca7105df930b
|
|
BLAKE2b-256 checksum How to use checksums |
29fbed4f0dd9d7e0060bed6f7b55652657e98c5520294fc1d624145aff3cdd5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / minisim-1.1.0-py3-none-any.whl
| Download URL | minisim-1.1.0-py3-none-any.whl |
|---|---|
| Size | 2.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2f98bddf6d6574a2d53e3811c86373502059558f58d05ca33ae72dcffeb95fd2
|
|
BLAKE2b-256 checksum How to use checksums |
c5316247a4cd275e9b2a6c499a126697dccbe468592f6709f6f82c335434590e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logSecurity for minisim 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for minisim-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.