Skip to content

Commit ffd3bb4

Browse files
authored
Improve repo structure (#228)
* clean up dependencies * add cli * use setuptools_scm for version management * remove setup.py and setup.cfg * replace black isort and flake8 with ruff * update pre-commits * simplify [tool.setuptools.packages.find] * update github workflows * leave todo note to specify writer backend * leave note to update CLI args
1 parent e5e4122 commit ffd3bb4

18 files changed

+392
-284
lines changed

.github/workflows/pull-request-ci.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,50 +7,48 @@ on:
77
branches: [main]
88

99
jobs:
10-
style:
10+
lint:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
1414
python-version: ["3.11"]
1515

1616
steps:
1717
- name: Checkout repo
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0 # Fetch all history for setuptools_scm
1921

2022
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v4
23+
uses: actions/setup-python@v5
2224
with:
2325
python-version: ${{ matrix.python-version }}
2426

25-
- name: Install the shrimpy package
27+
- name: Install dependencies
2628
run: pip install -e ".[dev]"
2729

28-
- name: Check code style with Black
29-
run: black --check -t py311 .
30-
31-
- name: Check code with Flake8
32-
run: flake8 .
30+
- name: Check code style and linting with ruff
31+
run: make check
3332

34-
- name: Check code with isort
35-
run: isort --check .
36-
37-
pytest:
33+
test:
3834
runs-on: windows-latest
3935
strategy:
4036
matrix:
4137
python-version: ["3.11"]
4238

4339
steps:
4440
- name: Checkout repo
45-
uses: actions/checkout@v3
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0 # Fetch all history for setuptools_scm
4644

4745
- name: Set up Python ${{ matrix.python-version }}
48-
uses: actions/setup-python@v4
46+
uses: actions/setup-python@v5
4947
with:
5048
python-version: ${{ matrix.python-version }}
5149

52-
- name: Install the shrimpy package
50+
- name: Install dependencies
5351
run: pip install -e ".[dev]"
5452

5553
- name: Run tests
56-
run: pytest -v
54+
run: make test

.pre-commit-config.yaml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
exclude: ^(docs|notebooks|ignore|/tests/artifacts|examples|scripts)/
1+
exclude: (^|/)(archive|examples|scripts)/
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
44
rev: v4.1.0
@@ -22,20 +22,11 @@ repos:
2222
- id: python-check-blanket-type-ignore
2323
- id: python-no-log-warn
2424

25-
- repo: https://github.com/pycqa/isort
26-
rev: 5.12.0
25+
- repo: https://github.com/astral-sh/ruff-pre-commit
26+
rev: v0.8.6
2727
hooks:
28-
- id: isort
29-
30-
- repo: https://github.com/psf/black
31-
rev: 22.3.0
32-
hooks:
33-
- id: black
34-
entry: black
35-
36-
- repo: https://github.com/pycqa/flake8
37-
rev: 5.0.4
38-
hooks:
39-
- id: flake8
40-
entry: flake8
41-
args: [--statistics]
28+
# Run the linter
29+
- id: ruff
30+
args: [--fix]
31+
# Run the formatter
32+
- id: ruff-format

Makefile

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,23 @@
11
PACKAGE_NAME := shrimpy
22

3-
.PHONY: setup-develop
4-
setup-develop:
3+
.PHONY: install
4+
install:
55
pip install -e ".[dev]"
66

77
.PHONY: uninstall
88
uninstall:
99
pip uninstall -y $(PACKAGE_NAME)
1010

11-
.PHONY: check-format
12-
check-format:
13-
black --check -S -t py311 .
14-
isort --check .
11+
.PHONY: check
12+
check:
13+
ruff format --check .
14+
ruff check .
1515

1616
.PHONY: format
1717
format:
18-
black -S -t py311 .
19-
isort .
20-
21-
.PHONY: lint
22-
lint:
23-
flake8 $(PACKAGE_NAME)
24-
25-
# run the pre-commit hooks on all files (not just staged changes)
26-
# (requires pre-commit to be installed)
27-
.PHONY: pre-commit
28-
pre-commit:
29-
pre-commit run --all-files
18+
ruff format .
19+
ruff check --fix .
3020

3121
.PHONY: test
3222
test:
33-
python -m pytest . --disable-pytest-warnings
23+
python -m pytest

docs/data_structure.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ YYYY_MM_DD_<experiment_description>
7272
|--- <acq-name>
7373
| |--- <Row>
7474
| |--- <Col>
75-
| |--- <Pos_Label>
75+
| |--- <Pos_Label>
7676
| |--- labelfree # zarr dataset with TCZYX dimensions
7777
| |--- lightsheet # zarr dataset with TCZYX dimensions
78-
| |--- <Pos_Label>
78+
| |--- <Pos_Label>
7979
| |--- labelfree # zarr dataset with TCZYX dimensions
8080
| |--- lightsheet # zarr dataset with TCZYX dimensions
8181
| ...

docs/mantis_usage.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Overview - unofficial
2-
Mantis microscope is a fast multimodal microscope capable of acquiring label-free and fluorescence measurments simultaneously via two remote-refocus based arms that quickly acquire volumetric information.
2+
Mantis microscope is a fast multimodal microscope capable of acquiring label-free and fluorescence measurments simultaneously via two remote-refocus based arms that quickly acquire volumetric information.
33

44
---
55
## Table of contents
@@ -37,48 +37,48 @@ Mantis microscope is a fast multimodal microscope capable of acquiring label-fre
3737
6. Hook up the humidifier tube to the left side golden port of the chamber.
3838

3939
###### Temperature probe
40-
7. Pass the thermometer probe through the side hole of the chamber.
40+
7. Pass the thermometer probe through the side hole of the chamber.
4141
8. Place the probe in one of the wells. Make sure it is dipped inside.
4242
9. Use kapton tape to fix the probe to the side of the chamber. Make sure the probe does not obstruct the FOV for imaging other wells.
4343
---
4444
## Sample Preparation
4545
### Apply silicone oil to the plate/slide
46-
1. Using the `1000cst` (most viscous solution) and the makeup palette, apply a layer of oil to the bottom of the plate/slide.
46+
1. Using the `1000cst` (most viscous solution) and the makeup palette, apply a layer of oil to the bottom of the plate/slide.
4747

48-
**Note: This layer should have minimal number of bubbles and enough oil for autofocus to engage. Make sure to wear gloves and discard them before touching any other microscope or computer part. Handling the oil can be messy and we want to keep things clean.
48+
**Note: This layer should have minimal number of bubbles and enough oil for autofocus to engage. Make sure to wear gloves and discard them before touching any other microscope or computer part. Handling the oil can be messy and we want to keep things clean.
4949

5050
---
5151
## Setting up the acquisition using `Mantis Acquisition Engine`
52-
1. Initialize two instances of micromanager to prepare both arms for acquisition.
52+
1. Initialize two instances of micromanager to prepare both arms for acquisition.
5353
1. Micromanager *230312* version with `mantis-LF.cfg` configuration.
5454
2. Micromanager *230312 Nightly Build* version with `mantis-LS.cfg` configuration.
5555
##### Micromanager with Label-free configuration
56-
2. Using the micromanager with the `label-free` configuration, set `Channel LS` property group to `External Control`. This will reset the microscope to the default configurations including the filter cube to position 6. Then, set the `Imaging Path` propety group to `Epi`. Set the `Channel - LF` property group to `BF`.
56+
2. Using the micromanager with the `label-free` configuration, set `Channel LS` property group to `External Control`. This will reset the microscope to the default configurations including the filter cube to position 6. Then, set the `Imaging Path` propety group to `Epi`. Set the `Channel - LF` property group to `BF`.
5757
3. Focus the sample and check the focus is ~4700um.
5858
4. Engage autofocus. [For more details](#setup-autofocus)
5959
5. Switch to the `Imaging Path` to the `label-free` path and use the `KDC101` to adjust the position of `O2` and match the focal planes.
6060
6. Inspect the fluorescence channels by switching the `Channel LS` property group to the respective fluorophore name or laser line (i.e GFP, TXR, Cy5, mCherry, etc)
6161
##### Micromanager with Light-sheet configuration
62-
1. Using the micromanager with the `light-sheet` configuration use the `KDC101` to adjust the position of `O3` to match the focal planes.
62+
1. Using the micromanager with the `light-sheet` configuration use the `KDC101` to adjust the position of `O3` to match the focal planes.
6363
2. Set-up the `Prime BSI` settings to:
64-
1. Readout -> 200MHz
64+
1. Readout -> 200MHz
6565
2. Gain -> Sensitivity
6666
3. Check the ROI to be captured and offset by changing the Y-coordinate. Click `ImageJ->Edit->Selection->Specify` and set the dimensions:
6767
1. Height: 2048
6868
2. Width: 256-300
69-
3. X-coordinate: 0
69+
3. X-coordinate: 0
7070
4. Y-coordinate: 896
7171

72-
** Note: this view is 3D with the coverslip in the x-orientation.
72+
** Note: this view is 3D with the coverslip in the x-orientation.
7373

7474
### Setup autofocus
7575
Check the LED on the microscope body and find the PFS button on the microscope focus knob.
7676
1. One click == Turn on autofocus
77-
1. Autofocus **LED ON** + **one beep** = autofocus engaged
77+
1. Autofocus **LED ON** + **one beep** = autofocus engaged
7878
2. After the **beep**, turning the focus know changes the autofocus offset
7979
2. Toggle autofocus state by clicking PFS button.
8080

81-
** Note: when it autofocus engages, the beep can be easily missed.
81+
** Note: when it autofocus engages, the beep can be easily missed.
8282

8383
### YAML file:
8484
1. Copy the default [yaml file](../mantis/acquisition/settings/example_acquisition_settings.yaml) or one from a previous acquisition similar to the planned acquisition into the acquisition folder
@@ -98,26 +98,24 @@ Check the LED on the microscope body and find the PFS button on the microscope f
9898
3. Add the desired offset. Negative offsets == non-overlapping
9999

100100
#### For HCS:
101-
4. Use the HCS generator under `Plugins -> Acquisition Tools -> HCS Site Generator` to image all the wells.
101+
4. Use the HCS generator under `Plugins -> Acquisition Tools -> HCS Site Generator` to image all the wells.
102102
5. Use the 3 point interpolation to adjust objective z-position across the plate.
103103
---
104104

105105
#### For 8-well Ibidi Plate or other custom slides:
106106
6. Use the HCS generator as above to `Create Custom` plate format
107-
7. The 8-well Ibidi Plate can be found in the `Documents` folder.
107+
7. The 8-well Ibidi Plate can be found in the `Documents` folder.
108108

109109
## Run the acquisition
110110
1. Open powershell
111111
2. Activate enviroment
112112
-`conda activate mantis`
113113
3. Navigate to the acquisition folder:
114-
-`cd /path/to/acquisition`
114+
-`cd /path/to/acquisition`
115115
4. Run the acquisition engine
116116
-`mantis run-acquisition --help` for instructions.
117117

118118
---
119119
## FAQ
120120
1. _ The objective won't move up with the focus knobs_
121121
- Most likely the objective is on `escape` move and the `escape` button on the microscope body is on (green). Press and hold to disable. This ensures we can manually raise/lower the objective and avoid creating bubbles with the focus knob.
122-
123-

docs/platemap.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ D,LMAN1,GOLGA2,GPR107,DCP1B,TOMM70A,MAP4,,,,,,
66
E,LMAN1,GOLGA2,GPR107,DCP1B,TOMM70A,MAP4,,,,,,
77
F,LMAN1,GOLGA2,GPR107,DCP1B,TOMM70A,MAP4,,,,,,
88
G,LMAN1,GOLGA2,GPR107,DCP1B,TOMM70A,MAP4,,,,,,
9-
H,LMAN1,GOLGA2,GPR107,DCP1B,TOMM70A,MAP4,,,,,,
9+
H,LMAN1,GOLGA2,GPR107,DCP1B,TOMM70A,MAP4,,,,,,

docs/setup_guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ print(mantis.__mm_version__)
4040
```
4141

4242
* Download the recommended [Micro-Manager nightly build](https://download.micro-manager.org/nightly/2.0/Windows/) and install following the installer prompts in the `C:\Program Files\Micro-Manager-2.0_YYYY_MM_DD` directory.
43-
43+
4444
* Copy the `Ti2_Mic_Driver.dll` device adapter located at `C:\Program Files\Nikon\Ti2-SDK\bin` to the Micro-manager install directory, as described [here](https://micro-manager.org/NikonTi2).
4545

4646
* Install another copy of the recommended [Micro-Manager nightly build](https://download.micro-manager.org/nightly/2.0/Windows/) in the `C:\Program Files\Micro-Manager-2.0_YYYY_MM_DD_2` directory. This copy of Micro-manager will be used by the headless light-sheet acquisition engine.

0 commit comments

Comments
 (0)