Skip to main content

microsim

License PyPI Python Version CI codecov

Light microscopy simulation in python.

The goal of this library is to generate highly realistic simulated data such as the following:

Montage2

(this data was generated using segmentations from cell jrc_hela-3 at OpenOrganelle as the ground truth)

https://github.com/user-attachments/assets/905fa1af-c8bd-406e-87a7-7c5921de74d1

Documentation

Start with the tutorial, and read about the simulation stages, then see the API Reference for details on the Simulation object and options for all of the fields.

Installation

from PyPI

pip install "microsim[all]"

[!NOTE] At the moment, this library is a bit more "application" than it is "library". If you are following the docs or tutorials, its probably best to install the full [all] extra, which brings in io, visualization, and other data-fetching dependencies. However, the bare minimal install is fully functional for generating data.

Local Development

gh repo clone tlambert03/microsim
cd microsim
uv sync

From github

To get the bleeding edge version, which will change rapidly, you can install from github.

pip install "microsim[all] @ git+https://github.com/tlambert03/microsim"

With GPU support

If available, microsim can use either Jax or Cupy to accelerate computations. These are not installed by default, see the jax or cupy installation instructions, paying attention to your GPU requirements. Support for torch is planned.

Usage

Construct and run a microsim.Simulation object.

from microsim import schema as ms
from microsim.util import ortho_plot

# define the parameters of the simulation
sim = ms.Simulation(
    truth_space=ms.ShapeScaleSpace(shape=(128, 512, 512), scale=(0.02, 0.01, 0.01)),
    output_space={'downscale': 8},
    sample=ms.Sample(
        labels=[ms.MatsLines(density=0.5, length=30, azimuth=5, max_r=1)]
    ),
    modality=ms.Confocal(pinhole_au=0.2),
    output_path="au02.tiff",
)

# run it
result = sim.run()

# optionally plot the result
ortho_plot(result)

Metadata

Release files for microsim 0.0.12.post0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for microsim 0.0.12.post0
File Size Uploaded
microsim-0.0.12.post0.tar.gz 4.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for microsim 0.0.12.post0
File Interpreter ABI Platform
microsim-0.0.12.post0-py3-none-any.whl Python 3 none any Details

Total release size: 4.6 MB

Release files / microsim-0.0.12.post0.tar.gz

Download URL microsim-0.0.12.post0.tar.gz
Size 4.5 MB
Tags Source
SHA-256 checksum
How to use checksums
d845676300e1d99be43d274ded5f0e1ec50c3e03ea59725359a387d24bc3eec3
BLAKE2b-256 checksum
How to use checksums
62c197caa3b53d1f2b23e103439bb2c41175fa0a0545c1a863e04b19c5496597
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 10, 2026.

Transparency log

Release files / microsim-0.0.12.post0-py3-none-any.whl

Download URL microsim-0.0.12.post0-py3-none-any.whl
Size 105.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddb8130c6a25d3d8279cf9ee5f3ff7264fd6e86dfc4119562c1bf556733ef80a
BLAKE2b-256 checksum
How to use checksums
ca5d95f4515f13d49bc5e0b2cd65539c74cd6855caeea6fa6ae3a15b493fb796
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.12.post0 This release

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page