Skip to content

Commit 301bb2e

Browse files
Depend on backwards-compatible focus finder (#223)
* depend on backwards compatible focus finder * bump 3.10 to 3.11 * Fix tests * upgrade to 3.11-compatible black * black formatting * roll back "black==22.3.0" * set "black==26.1.0" --------- Co-authored-by: Ivan Ivanov <[email protected]>
1 parent 053be5e commit 301bb2e

File tree

8 files changed

+37
-35
lines changed

8 files changed

+37
-35
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: ["3.10"]
14+
python-version: ["3.11"]
1515

1616
steps:
1717
- name: Checkout repo
@@ -26,7 +26,7 @@ jobs:
2626
run: pip install -e ".[dev]"
2727

2828
- name: Check code style with Black
29-
run: black --check -t py310 .
29+
run: black --check -t py311 .
3030

3131
- name: Check code with Flake8
3232
run: flake8 .
@@ -38,7 +38,7 @@ jobs:
3838
runs-on: windows-latest
3939
strategy:
4040
matrix:
41-
python-version: ["3.10"]
41+
python-version: ["3.11"]
4242

4343
steps:
4444
- name: Checkout repo

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ uninstall:
1010

1111
.PHONY: check-format
1212
check-format:
13-
black --check -S -t py310 .
13+
black --check -S -t py311 .
1414
isort --check .
1515

1616
.PHONY: format
1717
format:
18-
black -S -t py310 .
18+
black -S -t py311 .
1919
isort .
2020

2121
.PHONY: lint

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ This version of the code still uses the legacy name `mantis`, which overlaps wit
1111

1212
## Installation
1313

14-
We recommend using a virtual conda environment with Python 3.10:
14+
We recommend using a virtual conda environment with Python 3.11:
1515

1616
```sh
17-
conda create -y --name mantis python=3.10
17+
conda create -y --name mantis python=3.11
1818
conda activate mantis
1919

2020
git clone https://github.com/czbiohub-sf/shrimPy.git
@@ -24,7 +24,7 @@ pip install ./mantis
2424
Optionally, you can also install the [biahub](https://github.com/czbiohub-sf/biahub) image analysis library in the same environment. `biahub` is currently used when characterizing the microscope point spread function, and will be used for real-time image processing in the future. You can install both libraries in a single step with:
2525

2626
```sh
27-
conda create -y --name mantis python=3.10
27+
conda create -y --name mantis python=3.11
2828
conda activate mantis
2929

3030
git clone https://github.com/czbiohub-sf/shrimPy.git

mantis/acquisition/AcquisitionSettings.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ def __post_init__(self):
5757

5858
@dataclass(config=config)
5959
class ChannelSettings:
60-
default_exposure_times_ms: Union[
61-
NonNegativeFloat, List[NonNegativeFloat], None
62-
] = None # in ms
63-
default_laser_powers: Union[
64-
NonNegativeFloat, List[NonNegativeFloat], List[None], None
65-
] = None
60+
default_exposure_times_ms: Union[NonNegativeFloat, List[NonNegativeFloat], None] = (
61+
None # in ms
62+
)
63+
default_laser_powers: Union[NonNegativeFloat, List[NonNegativeFloat], List[None], None] = (
64+
None
65+
)
6666
channel_group: Optional[str] = None
6767
channels: List[str] = field(default_factory=list)
6868
use_sequencing: bool = False

mantis/acquisition/acq_engine.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -722,19 +722,19 @@ def setup_autoexposure(self):
722722
)
723723
if ts2_ttl_state == 32:
724724
# State 32 corresponds to illumination with 488 laser
725-
self.ls_acq.channel_settings.light_sources[
726-
channel_idx
727-
] = microscope_operations.setup_vortran_laser(VORTRAN_488_COM_PORT)
725+
self.ls_acq.channel_settings.light_sources[channel_idx] = (
726+
microscope_operations.setup_vortran_laser(VORTRAN_488_COM_PORT)
727+
)
728728
elif ts2_ttl_state == 64:
729729
# State 64 corresponds to illumination with 561 laser
730-
self.ls_acq.channel_settings.light_sources[
731-
channel_idx
732-
] = microscope_operations.setup_vortran_laser(VORTRAN_561_COM_PORT)
730+
self.ls_acq.channel_settings.light_sources[channel_idx] = (
731+
microscope_operations.setup_vortran_laser(VORTRAN_561_COM_PORT)
732+
)
733733
elif ts2_ttl_state == 128:
734734
# State 128 corresponds to illumination with 639 laser
735-
self.ls_acq.channel_settings.light_sources[
736-
channel_idx
737-
] = microscope_operations.setup_vortran_laser(VORTRAN_639_COM_PORT)
735+
self.ls_acq.channel_settings.light_sources[channel_idx] = (
736+
microscope_operations.setup_vortran_laser(VORTRAN_639_COM_PORT)
737+
)
738738
else:
739739
logger.error(
740740
'Unknown TTL state {} for channel {} in config group {}'.format(
@@ -1050,6 +1050,7 @@ def refocus_ls_path(
10501050
pixel_size=LS_PIXEL_SIZE,
10511051
threshold_FWHM=threshold_FWHM,
10521052
plot_path=self._logs_dir / f'ls_refocus_plot_{timestamp}_Pos{stack_idx}.png',
1053+
return_statistics=True,
10531054
)
10541055
focus_indices.append(idx)
10551056
peak_indices.append(stats['peak_index'])
@@ -1350,11 +1351,11 @@ def acquire(self):
13501351
channel_index = self.ls_acq.channel_settings.channels.index(
13511352
_event['axes']['channel']
13521353
)
1353-
_event[
1354-
'exposure'
1355-
] = self.ls_acq.channel_settings.exposure_times_per_well[well_id][
1356-
channel_index
1357-
]
1354+
_event['exposure'] = (
1355+
self.ls_acq.channel_settings.exposure_times_per_well[well_id][
1356+
channel_index
1357+
]
1358+
)
13581359

13591360
globals.lf_last_img_idx = lf_events[-1]['axes']
13601361
globals.ls_last_img_idx = ls_events[-1]['axes']

mantis/acquisition/microscope_operations.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,8 @@ def acquire_defocus_stack(
374374
else:
375375
raise RuntimeError(f'Unknown z stage: {z_stage}')
376376

377-
move_z(z_range[0]); time.sleep(0.3)
377+
move_z(z_range[0])
378+
time.sleep(0.3)
378379
for z_ind, rel_z in enumerate(z_range):
379380
# set z position
380381
move_z(rel_z)

mantis/tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
def test_main():
77
runner = CliRunner()
8-
result = runner.invoke(cli)
8+
result = runner.invoke(cli, ['--help'])
99

1010
assert result.exit_code == 0
1111
assert "tools for mantis" in result.output

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name = "mantis"
66
description = "Acquisition engine for collecting data on the mantis microscope"
77
readme = "README.md"
88
license = { file = "LICENSE" }
9-
requires-python = ">=3.10, <4.0"
9+
requires-python = ">=3.11, <4.0"
1010

1111
# the dynamically determined project metadata attributes
1212
dynamic = ["version"]
@@ -15,7 +15,7 @@ classifiers = [
1515
"Development Status :: 3 - Alpha",
1616
"Intended Audience :: Science/Research",
1717
"Programming Language :: Python :: 3 :: Only",
18-
"Programming Language :: Python :: 3.10",
18+
"Programming Language :: Python :: 3.11",
1919
]
2020

2121
# list package dependencies here
@@ -28,14 +28,14 @@ dependencies = [
2828
"pydantic>=2.0.0",
2929
"pylablib==1.4.1",
3030
"tifffile",
31-
"waveorder @ git+https://github.com/mehta-lab/waveorder@return_peak_stats",
31+
"waveorder @ git+https://github.com/mehta-lab/waveorder@focus-statistics-api",
3232
]
3333

3434

3535
[project.optional-dependencies]
3636
# note that dev dependencies are only pinned to major versions
3737
dev = [
38-
"black==22.3.0",
38+
"black==26.1.0",
3939
"flake8~=5.0",
4040
"isort~=5.12",
4141
"pre-commit~=2.19",
@@ -60,7 +60,7 @@ version = { attr = "mantis.__version__" }
6060

6161
[tool.black]
6262
line-length = 95
63-
target-version = ['py310']
63+
target-version = ['py311']
6464
include = '\.pyi?$'
6565
skip-string-normalization = true
6666
exclude = '''

0 commit comments

Comments
 (0)