Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test on python 3.12 #69

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ jobs:
src: "viscy"

test:
name: Test
needs: [lint]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -30,6 +31,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Install cpu wheels only to speed up the build
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
pip install ".[metrics,dev]"
- name: Test with pytest
run: pytest -v
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies = [
"timm>=0.9.5",
"tensorboard>=2.13.0",
"lightning>=2.0.1",
"monai>=1.2.0",
"monai>=1.3.1",
"jsonargparse[signatures]>=4.20.1",
"scikit-image",
"matplotlib",
Expand Down
1 change: 1 addition & 0 deletions viscy/evaluation/evaluation_metrics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Metrics for model evaluation"""

from typing import Sequence, Union
from warnings import warn

Expand Down
26 changes: 13 additions & 13 deletions viscy/light/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,19 +268,19 @@ def _log_segmentation_metrics(
self.log_dict(
{
# semantic segmentation
"test_metrics/accuracy": accuracy(
pred_binary, target_binary, task="binary"
)
if compute
else -1,
"test_metrics/dice": dice(pred_binary, target_binary)
if compute
else -1,
"test_metrics/jaccard": jaccard_index(
pred_binary, target_binary, task="binary"
)
if compute
else -1,
"test_metrics/accuracy": (
accuracy(pred_binary, target_binary, task="binary")
if compute
else -1
),
"test_metrics/dice": (
dice(pred_binary, target_binary) if compute else -1
),
"test_metrics/jaccard": (
jaccard_index(pred_binary, target_binary, task="binary")
if compute
else -1
),
"test_metrics/mAP": coco_metrics["map"] if compute else -1,
"test_metrics/mAP_50": coco_metrics["map_50"] if compute else -1,
"test_metrics/mAP_75": coco_metrics["map_75"] if compute else -1,
Expand Down
1 change: 1 addition & 0 deletions viscy/preprocessing/generate_masks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Generate masks from sum of flurophore channels"""

import iohub.ngff as ngff

import viscy.utils.aux_utils as aux_utils
Expand Down
4 changes: 1 addition & 3 deletions viscy/utils/image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ def im_bit_convert(im, bit=16, norm=False, limit=[]):
/ (limit[1] - limit[0] + sys.float_info.epsilon)
* (2**bit - 1)
)
im = np.clip(
im, 0, 2**bit - 1
) # clip the values to avoid wrap-around by np.astype
im = np.clip(im, 0, 2**bit - 1) # clip the values to avoid wrap-around by np.astype
if bit == 8:
im = im.astype(np.uint8, copy=False) # convert to 8 bit
else:
Expand Down
1 change: 1 addition & 0 deletions viscy/utils/normalize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Image normalization related functions"""

import sys

import numpy as np
Expand Down
Loading