Skip to main content

redsun-mimir

License Apache Software License 2.0 PyPI Python Version codecov

Bundle of redsun components for the openUC2 "Mimir" microscope

About mimir

Mimir is the codename for an in-development portable interferometric scattering microscope (iSCAT), with an hardware controller developed by openUC2. It employs pymmcore-plus for camera control and pyserial for motor and laser control.

redsun-mimir is a bundle of components developed to target the specific hardware and software requirements for real-time acquisition with said microscope.

[!NOTE] This bundle has been used as a staging ground for development in cohesion with the main framework. Some components may be moved to redsun itself to be provided as built-in functionalities. Expect breaking changes as the framework evolves.

[!WARNING] The youseetoo module has not been fully tested and there is currently no known way of testing it in a continous integration. Ensure you can pre-emptively test the components locally.

Installation

It is strongly reccomended to install redsun-mimir in a virtual environment.

uv (reccomended)

Be sure to install uv first.

# create the venv
uv venv --python 3.11

# activate the environment in...
# ... linux
source .venv/bin/activate

# ... windows
.venv\Scripts\activate

uv pip install redsun-mimir
pip

You should have Python installed in your machine.

# create the venv
python -m venv .venv

# activate the environment in...
# ... linux
source .venv/bin/activate

# ... windows
.venv\Scripts\activate

pip install redsun-mimir

Installing from source

redsun-mimir is developed via uv; you can clone the repository and install development dependencies:

git clone https://github.com/redsun-acquisition/redsun-mimir

cd redsun-mimir

uv sync

Running a simulator container

redsun-mimir comes with a simple simulation environment with simulated devices for demonstration purposes.

To run it, you have to:

  1. install the package in your virtual environment by adding the sim optional dependencies;
  2. run mmcore install (or alternatively one of the methods described here).
  3. run the container via mimir sim.
uv (reccomended)
# in your virtual environment
uv pip install redsun-mimir[sim]

# install micro-manager device adapters
mmcore install --test-adapters

# run the example container via command line
mimir sim
pip
# in your virtual environment
pip install redsun-mimir[sim]

# install micro-manager device adapters
mmcore install --test-adapters

# run the example container via command line
mimir sim

Installing the napari application hook

ImageView embeds a napari viewer but carries no stylesheet of its own: it is styled by the application it is built under. NapariApplication supplies that application. It serves two hook points, returning the application napari itself would build (create_application) and putting napari's stylesheet on it (configure_application).

A session built only from a configuration file installs it in a hooks: section. One entry serves both points, so a YAML anchor keeps it a single provider instance:

hooks:
  create_application: &napari
    provider: "redsun_mimir.hooks:NapariApplication"
  configure_application: *napari

Without it the viewer still works and its canvas still follows the theme in napari's settings, but nothing sets a stylesheet on the application, so the layer list, the layer controls and the rest of the Qt chrome keep their default look.

The shipped containers declare the hook themselves, so mimir sim and mimir uc2 need no hooks: section.

Wiring a session from YAML

The shipped containers declare their connections in wire(). A session built only from a configuration file has no wire() to override, so it must declare them in a wiring: section: without one the components build and connect to nothing.

Do not add this section to a configuration that already backs a container class with a wire() method. The two are applied one after the other, so every rule would connect a second time and each slot would run twice per emission.

wiring:
  - from: det_ctrl.sig_new_data
    to: img_widget.update_layers
  - from: median_ctrl.median
    to: img_widget.update_layers
  - from: median_ctrl.filtered
    to: img_widget.update_layers
  - from: det_widget.sig_property_changed
    to: det_ctrl.set
  - from: det_ctrl.sig_new_configuration
    to: det_widget.on_new_configuration
  - from: motor_widget.sig_motor_move
    to: motor_ctrl.move
  - from: light_widget.sig_toggle_light_request
    to: light_ctrl.trigger
  - from: light_widget.sig_intensity_request
    to: light_ctrl.set
  - from: acq_widget.sig_launch_plan_request
    to: acq_ctrl.launch_plan
  - from: acq_widget.sig_stop_plan_request
    to: acq_ctrl.stop_plan
  - from: acq_widget.sig_pause_resume_request
    to: acq_ctrl.pause_or_resume_plan
  - from: acq_widget.sig_action_request
    to: acq_ctrl.toggle_action_event
  - from: acq_ctrl.sig_plan_done
    to: acq_widget.on_plan_done
  - from: acq_ctrl.sig_action_done
    to: acq_widget.on_action_done
  - from: acq_ctrl.sig_pre_launch_notify
    to: median_ctrl.clear_medians
  - from: acq_ctrl.sig_pre_launch_notify
    to: storage_ctrl.set_plan
  - from: acq_ctrl.sig_plan_done
    to: storage_ctrl.reset_plan

Component names are the keys used under devices:, presenters: and views:; port names are the signal attributes and the names the slots declare. The last two rules reach redsun's own StoragePresenter, which stopped discovering those signals by itself in 0.11.0.

There is no rule feeding motor_widget.update_setpoint: the motor view subscribes to the axis readbacks themselves, so its labels track the stage even when a plan is what moved it.

Features

  • Live data capture.
  • Median computation based on square-scan movement for background noise reduction following the procedure described in this paper.
  • Image visualization leveraging napari.
  • Data storage in Zarr v3 format via acquire-zarr.
  • Manual control of light source and motor drivers.
  • Fully extensible via additional components following the redsun framework.

Contributing

Contributions are very welcome. Tests can be run with pytest, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the Apache Software License 2.0 license, redsun-mimir is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Download files

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

Source Distribution

redsun_mimir-0.4.1.tar.gz (54.6 kB view details)

Uploaded Source

Built Distribution

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

redsun_mimir-0.4.1-py3-none-any.whl (79.1 kB view details)

Uploaded Python 3

File details

Details for the file redsun_mimir-0.4.1.tar.gz.

File metadata

  • Download URL: redsun_mimir-0.4.1.tar.gz
  • Upload date:
  • Size: 54.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for redsun_mimir-0.4.1.tar.gz
Algorithm Hash digest
SHA256 62f1543acc8d6d9390d8edf75214f185082e2c5f53020ab2fa419fd81024c5e2
MD5 cd1ddb722e7c3f5f71f16aaaee22c325
BLAKE2b-256 4318a4807f80c434723f12c40bd53426e23ee3c080b211480202adf697eb2764

See more details on using hashes here.

Provenance

The following attestation bundles were made for redsun_mimir-0.4.1.tar.gz:

Publisher: ci.yaml on redsun-acquisition/redsun-mimir

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

File details

Details for the file redsun_mimir-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: redsun_mimir-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 79.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for redsun_mimir-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c85dab90848b662e281cb09ae84c6dd8eb5d8f109d948e0577ace4e4f994f264
MD5 873af181dd29abae1a5713cacbaec7d6
BLAKE2b-256 2266710bc9641fb9909bbbcc344f5f89c8628f3f822091704ebab8d93f59b32a

See more details on using hashes here.

Provenance

The following attestation bundles were made for redsun_mimir-0.4.1-py3-none-any.whl:

Publisher: ci.yaml on redsun-acquisition/redsun-mimir

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

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 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