Skip to content

Commit

Permalink
updating code for pydantic v2 (#160)
Browse files Browse the repository at this point in the history
* updating code for pydantic v2

* update for iohub in stable version

* update TransformationMeta import from iohub.ngff_meta to iohub.ngff

* update channel_display_settings import from iohub.display_utils to iohub.ngff

* update channel_display_settings import from iohub.ngff to iohub.ngff.disply and sorting imports for style correction

* imports organization for style test

* imports organization for style test

* imports organization for style test

---------

Co-authored-by: Taylla Milena Theodoro <[email protected]>
  • Loading branch information
tayllatheodoro and Taylla Milena Theodoro authored Sep 19, 2024
1 parent 8f2469b commit 9727c79
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions mantis/acquisition/AcquisitionSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import numpy as np

from pydantic import ConfigDict, NonNegativeFloat, NonNegativeInt, validator
from pydantic.dataclasses import dataclass
from pydantic.v1 import ConfigDict, NonNegativeFloat, NonNegativeInt, validator
from pydantic.v1.dataclasses import dataclass

config = ConfigDict(extra='forbid')

Expand Down
2 changes: 1 addition & 1 deletion mantis/acquisition/scripts/measure_psf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
import torch

from iohub.ngff_meta import TransformationMeta
from iohub.ngff import TransformationMeta
from iohub.reader import open_ome_zarr
from pycromanager import Acquisition, Core, multi_d_acquisition_events

Expand Down
2 changes: 1 addition & 1 deletion mantis/analysis/AnalysisSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
import torch

from pydantic import BaseModel, Extra, NonNegativeInt, PositiveFloat, PositiveInt, validator
from pydantic.v1 import BaseModel, Extra, NonNegativeInt, PositiveFloat, PositiveInt, validator


# All settings classes inherit from MyBaseModel, which forbids extra parameters to guard against typos
Expand Down
2 changes: 1 addition & 1 deletion mantis/analysis/scripts/simple_phase_recon.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np

from iohub import open_ome_zarr, read_micromanager
from iohub.ngff_meta import TransformationMeta
from iohub.ngff import TransformationMeta
from recOrder.compute.reconstructions import initialize_reconstructor, reconstruct_phase3D

# %% Load data
Expand Down
4 changes: 2 additions & 2 deletions mantis/cli/estimate_bleaching.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import matplotlib.pyplot as plt
import numpy as np

from iohub.display_utils import channel_display_settings
from iohub.ngff import open_ome_zarr
from iohub import open_ome_zarr
from iohub.ngff.display import channel_display_settings
from scipy.optimize import curve_fit
from tqdm import tqdm

Expand Down
4 changes: 2 additions & 2 deletions mantis/cli/estimate_psf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import numpy as np
import torch

from iohub.ngff import open_ome_zarr
from iohub.ngff_meta import TransformationMeta
from iohub import open_ome_zarr
from iohub.ngff import TransformationMeta

from mantis.analysis.AnalysisSettings import PsfFromBeadsSettings
from mantis.analysis.analyze_psf import detect_peaks, extract_beads
Expand Down
2 changes: 1 addition & 1 deletion mantis/cli/stitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pandas as pd

from iohub import open_ome_zarr
from iohub.ngff_meta import TransformationMeta
from iohub.ngff import TransformationMeta
from slurmkit import HAS_SLURM, SlurmParams, slurm_function, submit_function

from mantis.analysis.AnalysisSettings import StitchSettings
Expand Down
2 changes: 1 addition & 1 deletion mantis/cli/update_scale_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import click

from iohub import open_ome_zarr
from iohub.ngff_meta import TransformationMeta
from iohub.ngff import TransformationMeta

from mantis.cli.parsing import input_position_dirpaths

Expand Down
4 changes: 2 additions & 2 deletions mantis/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import numpy as np
import yaml

from iohub.ngff import Position, open_ome_zarr
from iohub.ngff_meta import TransformationMeta
from iohub import open_ome_zarr
from iohub.ngff import Position, TransformationMeta
from numpy.typing import DTypeLike
from tqdm import tqdm

Expand Down
2 changes: 1 addition & 1 deletion mantis/tests/test_analysis/test_analysis_settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pytest

from pydantic import ValidationError
from pydantic.v1 import ValidationError

from mantis.analysis.AnalysisSettings import (
DeskewSettings,
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ classifiers = [
# list package dependencies here
dependencies = [
"copylot @ git+https://github.com/czbiohub-sf/coPylot",
"iohub==0.1.0",
"iohub==0.2.0a1",
"matplotlib",
"napari; 'arm64' in platform_machine", # without Qt5 and skimage
"napari[all]; 'arm64' not in platform_machine", # with Qt5 and skimage
Expand All @@ -34,7 +34,7 @@ dependencies = [
"monai",
"pandas~=2.1",
"pycromanager==0.28.1",
"pydantic",
"pydantic>=2.0.0",
"pylablib==1.4.1",
"scipy",
"slurmkit @ git+https://github.com/royerlab/slurmkit",
Expand Down

0 comments on commit 9727c79

Please sign in to comment.