Physically-driven synthetic 1-photon miniscope data: a forward-model generator and teaching tool, the inverse of the minian analysis pipeline.
Project description
minisim
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 -> 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.
📖 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
Relationship to minian
minisim is the forward (generative) counterpart to minian's inverse (analysis) pipeline. The dependency is strictly one-directional: minisim never imports minian. minian uses minisim as a test dependency to supply ground-truth fixtures for its recovery tests.
License
GPL-3.0-or-later. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file minisim-0.2.0.tar.gz.
File metadata
- Download URL: minisim-0.2.0.tar.gz
- Upload date:
- Size: 200.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5797473420450a35ed064159610adb858ec35446ce003abf5aab6feacd8a88bd
|
|
| MD5 |
672857bd9e12c44e1bdf287d08f3dd48
|
|
| BLAKE2b-256 |
e82bc665fdf73a569c0e52167f07d25d23b62e5570a30976a1755072fcfe44ce
|
Provenance
The following attestation bundles were made for minisim-0.2.0.tar.gz:
Publisher:
publish.yml on miniscope/minisim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
minisim-0.2.0.tar.gz -
Subject digest:
5797473420450a35ed064159610adb858ec35446ce003abf5aab6feacd8a88bd - Sigstore transparency entry: 1760115484
- Sigstore integration time:
-
Permalink:
miniscope/minisim@24d558cf3a486eaab74ee590a95a2d5c17dde039 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/miniscope
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@24d558cf3a486eaab74ee590a95a2d5c17dde039 -
Trigger Event:
push
-
Statement type:
File details
Details for the file minisim-0.2.0-py3-none-any.whl.
File metadata
- Download URL: minisim-0.2.0-py3-none-any.whl
- Upload date:
- Size: 221.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5aae55f35b4efcade1caa7d31c406d6de0c6b238fb8e5e3bf12cb6736283c89
|
|
| MD5 |
36d7e02758caee0d89fac32bd714b528
|
|
| BLAKE2b-256 |
55a1aeaa63247e57188ed8ba35dd2c48ac1cc6e23bb597f5f60583c18852945b
|
Provenance
The following attestation bundles were made for minisim-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on miniscope/minisim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
minisim-0.2.0-py3-none-any.whl -
Subject digest:
c5aae55f35b4efcade1caa7d31c406d6de0c6b238fb8e5e3bf12cb6736283c89 - Sigstore transparency entry: 1760115587
- Sigstore integration time:
-
Permalink:
miniscope/minisim@24d558cf3a486eaab74ee590a95a2d5c17dde039 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/miniscope
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@24d558cf3a486eaab74ee590a95a2d5c17dde039 -
Trigger Event:
push
-
Statement type: