Advanced Microscopy Simulations developed for the Weber Lab by Baljyot Singh Parmar
Project description
AMS-BP
Advanced Fluorescence Microscopy Simulation Tool
AMS-BP is a powerful simulation tool for advanced fluorescence microscopy experiments. This guide covers both command-line usage and library integration.
NOTE: Please note that this application DOES NOT currently model the process of stimulated emission, and as such is not suitable for simulating stimulated emission microscopy (STED)-type experiments. Work in this area is ongoing.
Table of Contents
Installation
Installing the CLI tool using UV
- Install UV.
- Run the command:
uv tool install AMS_BP
- You will have access to two CLI commands (using the uv interface):
run_AMS_BP runsim: This is the main entry point for the simulation. (seerun_AMS_BP runsim --helpfor more details)run_AMS_BP config: This is a helper tool to generate a template config file for the simulation. (seerun_AMS_BP config --helpfor more details)- Note: using
run_AMS_BP --helpwill show you all the available commands.
- You can now use these tools (they are isolated in their own env created by uv, which is cool).
PyPi
- Run:
pip install AMS_BP
Command Line Interface
AMS-BP provides a command-line interface with two main commands:
# Generate a default configuration file
run_AMS_BP config [OPTIONS]
# Run a simulation using a configuration file
run_AMS_BP runsim CONFIG_FILE
Config Command Options
-o, --output_path PATH: Specify the output directory for the configuration file-r, --recursive_o: Create output directory if it doesn't exist
Overview of Simulation Workflow
A ground truth is created, a, with $
f_{n}$ fluorophore types of $N_{f_{n}}$ molecules each. If applicable, the motion of these molecules is modelled using a 3D bounded FBM with fluctuating generalized diffusion coefficients and Hurst parameters. Variations are modelled as a Markov Chain and require rate constants as parameters. Different fluorophores can have different motion models. The resolution of the motion models is $\Delta t$ and cannot be smaller than 1 ms (for computational efficiency). Given the microscope parameters specific to the experimental procedure to simulate, at every time $t_{j}$, the excitation intensity for each channel (b) is calculated at each fluorophore's location, c. For $t_{j} \rightarrow t_{j+\Delta t}$, the photophysical state trajectory of the fluorophore is simulated using the light intensity at the molecule's location as input for any light-dependent transition rates, d. For the duration that the shutter is open and light is emitted from the sample, emission filters for each channel are applied before the convolution with PSF models, e. The incident photons on the detector are then converted to photoelectrons and finally to digital units using the detector models provided, f.
Configuration File
The configuration file (sim_config.toml) is divided into several key sections:
For a detailed description of the configuration file, refer to the Configuration File Reference.
Basic Units
version = "0.1"
length_unit = "um" # micrometers
time_unit = "ms" # milliseconds
diffusion_unit = "um^2/s" # diffusion coefficient units
Key Configuration Sections
-
Cell Parameters
- Define cell space dimensions
-
Molecule Parameters
- Number of molecules per type
- Tracking types (constant/fbm)
- Diffusion coefficients
- State transition probabilities
-
Global Parameters
- Sample plane dimensions
- Cycle count -> Exposure time + Interval time
- Exposure and interval times
-
Fluorophore Configuration
- Any number of fluorophores
- Any number of States per fluorophore
- Fluorophore StateType: (bright, dark, bleached) -> All States must be one of these.
- Transition parameters
- Spectral properties
-
Optical Configuration
- PSF parameters
- Laser settings
- Channel configuration
- Camera settings
Running Experiments
AMS-BP's CLI currently supports two types of experiments:
(however this can be extended when used as a library)
1. Time Series
[experiment]
experiment_type = "time-series"
z_position = 0.0
laser_names_active = ["red", "blue"]
laser_powers_active = [0.5, 0.05]
laser_positions_active = [[5, 5, 0], [5, 5, 0]]
2. Z-Stack
[experiment]
experiment_type = "z-stack"
z_position = [-0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5]
laser_names_active = ["red", "blue"]
laser_powers_active = [0.5, 0.05]
laser_positions_active = [[5, 5, 0], [5, 5, 0]]
Advanced Usage
Using AMS-BP as a Library
For programmatic control, you can import and use AMS-BP as a Python library:
from AMS_BP.configio.convertconfig import ConfigLoader
# Configuration loader intialization
config_loader = ConfigLoader(config_path="path/to/config.toml")
# Setup microscope
setup_config = config_loader.setup_microscope()
microscope = setup_config["microscope"]
config_exp = setup_config["experiment_config"]
function_exp = setup_config["experiment_func"]
# Run simulation
frames, metadata = function_exp(microscope=microscope, config=config_exp)
# Save results
from AMS_BP.configio.saving import save_config_frames
save_config_frames(metadata, frames, setup_config["base_config"].OutputParameters)
API Reference and Docs
Find detailed API references for the library at: joemans3/github.io/AMS_BP
A more detailed example is provided in the jupyter notebook in the examples. For starters refer to the VisualizingIndividualModules. Then head over to the laser modulation module which will show how to change the laser power over time in the simulations. Then view an example of a complex experiment setup for FRAP which is possible by the use of compositions of modules in this simulation library.
High Priority Features
- Irregular cell shapes with motion models
- Stimulated Emission models
- STORM workflow examples
- CTRW motion models
- Simpler configurations
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 ams_bp-0.2.0.tar.gz.
File metadata
- Download URL: ams_bp-0.2.0.tar.gz
- Upload date:
- Size: 6.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb5d6f45dde9d8ad74bfe95e9e622412954e26a8289c4e29b3a233321836b049
|
|
| MD5 |
7f995d7c113e84a2d7be558cac990538
|
|
| BLAKE2b-256 |
ecf18eb21aecbf5ac447a0850c510d6dfd68ab7c50b753b36577810c831cf55f
|
Provenance
The following attestation bundles were made for ams_bp-0.2.0.tar.gz:
Publisher:
publish_pypi.yml on joemans3/AMS_BP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ams_bp-0.2.0.tar.gz -
Subject digest:
eb5d6f45dde9d8ad74bfe95e9e622412954e26a8289c4e29b3a233321836b049 - Sigstore transparency entry: 176321311
- Sigstore integration time:
-
Permalink:
joemans3/AMS_BP@5be631ed2cabd67ed36aeca776952274f5b3143b -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/joemans3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yml@5be631ed2cabd67ed36aeca776952274f5b3143b -
Trigger Event:
push
-
Statement type:
File details
Details for the file ams_bp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ams_bp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 78.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
982f2c78012bbe8ab927641e612a9da31d0dccd351839963ee23a7fbf1b33fa0
|
|
| MD5 |
ddf8760997500e01cd1925ca9fb170b8
|
|
| BLAKE2b-256 |
c7553d27dfe51ae592562e8e263b199d204ec9fe032cef29518761e53392af01
|
Provenance
The following attestation bundles were made for ams_bp-0.2.0-py3-none-any.whl:
Publisher:
publish_pypi.yml on joemans3/AMS_BP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ams_bp-0.2.0-py3-none-any.whl -
Subject digest:
982f2c78012bbe8ab927641e612a9da31d0dccd351839963ee23a7fbf1b33fa0 - Sigstore transparency entry: 176321314
- Sigstore integration time:
-
Permalink:
joemans3/AMS_BP@5be631ed2cabd67ed36aeca776952274f5b3143b -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/joemans3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yml@5be631ed2cabd67ed36aeca776952274f5b3143b -
Trigger Event:
push
-
Statement type: