Tools to simulate optics and microscopy experiments.
See the integration tests for examples.
The simulation's performance may be tuned by setting various environment variables:
IMAJIN_CACHE_SIZE_SM_RATES
-- The size of the cache storing the state machine rate computations. The recommended value is equal to the number of fluorophores in the simulation.IMAJIN_CACHE_SIZE_SM_STOPPED_STATES
- The size of the cache holding the state machines' stopped states. The recommended value is equal to the number of distinct fluorophore types in the simulation. Usually this is just 1.
Choose one of the following methods. It is recommended to install into a virtual environment.
# With SSH:
pip install git+ssh://[email protected]/LEB-EPFL/imajin.git
# With a GitHub access token:
pip install git+https://"$GITHUB_TOKEN"@github.com/LEB-EPFL/imajin.git
See https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token for how to generate an access token. The token requires repo
privileges.
- Install pyenv:
curl https://pyenv.run | bash
- Install Python interpreter(s):
pyenv install 3.10.6
- Install poetry:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
- Set the virtual environment Python version to 3.10:
poetry env use 3.10
- Activate the virtual environment:
poetry shell
- Install the dependencies:
poetry install
poetry run tox
# Black, isort, mypy, pylint
poetry run tox -e black
# etc. ...
# Python 3.X tests
poetry run tox -e py310
poetry run tox -e benchmark
poetry run tox -e format
poetry lock
Profiling will tell you how long the code spends in each function call. A few benchmarks are already setup for profiling.
poetry run tox -e profile
To view the results of, for example, test_benchmark_simulator_0_result.json:
poetry run vizviewer test_benchmark_simulator_0_result.json
Check the version of Python used by Poetry to create the virtual environment:
poetry env info
Set the Python version to 3.10 (for example):
poetry env use 3.10