Skip to main content

Light microscopy simulation in python

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

microsim-0.0.12.post0.tar.gz (4.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

microsim-0.0.12.post0-py3-none-any.whl (105.9 kB view details)

Uploaded Python 3

File details

Details for the file microsim-0.0.12.post0.tar.gz.

File metadata

  • Download URL: microsim-0.0.12.post0.tar.gz
  • Upload date:
  • Size: 4.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for microsim-0.0.12.post0.tar.gz
Algorithm Hash digest
SHA256 d845676300e1d99be43d274ded5f0e1ec50c3e03ea59725359a387d24bc3eec3
MD5 ff47558277396cb10e188ec865e767c5
BLAKE2b-256 62c197caa3b53d1f2b23e103439bb2c41175fa0a0545c1a863e04b19c5496597

See more details on using hashes here.

Provenance

The following attestation bundles were made for microsim-0.0.12.post0.tar.gz:

Publisher: ci.yml on tlambert03/microsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file microsim-0.0.12.post0-py3-none-any.whl.

File metadata

  • Download URL: microsim-0.0.12.post0-py3-none-any.whl
  • Upload date:
  • Size: 105.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for microsim-0.0.12.post0-py3-none-any.whl
Algorithm Hash digest
SHA256 ddb8130c6a25d3d8279cf9ee5f3ff7264fd6e86dfc4119562c1bf556733ef80a
MD5 3491e8cf6f85aa4196d0881c08e7ac9d
BLAKE2b-256 ca5d95f4515f13d49bc5e0b2cd65539c74cd6855caeea6fa6ae3a15b493fb796

See more details on using hashes here.

Provenance

The following attestation bundles were made for microsim-0.0.12.post0-py3-none-any.whl:

Publisher: ci.yml on tlambert03/microsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page