Skip to content

Commit

Permalink
minor typo fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzocerrone committed Oct 1, 2024
1 parent f38e9a8 commit 51358d6
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 31 deletions.
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ repos:
rev: typos-dict-v0.11.20
hooks:
- id: typos
args: [--force-exclude] # omitting --write-changes
#args: [--force-exclude] # omitting --write-changes
args: [--force-exclude, --write-changes]

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.4.8
Expand Down
6 changes: 3 additions & 3 deletions src/ngio/core/label_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def __init__(
else:
self._group: zarr.Group = group["labels"]

self._imgage_ref = image_ref
self._image_ref = image_ref

def list(self) -> list[str]:
"""List all labels in the group."""
Expand Down Expand Up @@ -246,14 +246,14 @@ def derive(
# create the new label
new_label_group = self._group.create_group(name, overwrite=overwrite)

if self._imgage_ref is None:
if self._image_ref is None:
label_0 = self.get(list_of_labels[0])
metadata = label_0.metadata
on_disk_shape = label_0.on_disk_shape
chunks = label_0.array.chunks
dataset = label_0.dataset
else:
label_0 = self._imgage_ref
label_0 = self._image_ref
metadata = label_0.metadata
channel_index = metadata.index_mapping.get("c", None)
if channel_index is not None:
Expand Down
2 changes: 1 addition & 1 deletion src/ngio/core/ngff_image.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Abstract class for handling OME-NGFF images."""

from typing import Any, Protocol, TypeVar
from typing import Protocol, TypeVar

import numpy as np

Expand Down
5 changes: 2 additions & 3 deletions src/ngio/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import math
from typing import Any

from ngio.core.image_handler import Image
from ngio.io import StoreLike
from ngio.ngff_meta import (
create_image_metadata,
Expand Down Expand Up @@ -106,7 +105,7 @@ def create_empty_ome_zarr_image(
dimension_separator="/",
)

# Todo redo this with when a proper build of pyramid id implemente
# Todo redo this with when a proper build of pyramid is implemented
shape = [int(s / sc) for s, sc in zip(shape, scaling_factor, strict=True)]

if chunks is not None:
Expand Down Expand Up @@ -184,7 +183,7 @@ def create_empty_ome_zarr_label(
dimension_separator="/",
)

# Todo redo this with when a proper build of pyramid id implemente
# Todo redo this with when a proper build of pyramid is implemented
_shape = []
for s, sc in zip(shape, scaling_factor, strict=True):
if math.floor(s / sc) % 2 == 0:
Expand Down
4 changes: 2 additions & 2 deletions src/ngio/io/_zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import zarr
from packaging.version import Version

zarr_verison = version("zarr")
ZARR_PYTHON_V = 2 if Version(zarr_verison) < Version("3.0.0a") else 3
zarr_version = version("zarr")
ZARR_PYTHON_V = 2 if Version(zarr_version) < Version("3.0.0a") else 3

# Zarr v3 Imports
# import zarr.store
Expand Down
8 changes: 4 additions & 4 deletions src/ngio/ngff_meta/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def create_image_metadata(
for the pyramid building.
z_scaling_factor: The scaling factor for the z axis, to be used for the
pyramid building. Note that several tools may not support scaling
diffent than 1.0 for the z axis.
different than 1.0 for the z axis.
time_spacing: The time spacing (If the time axis is present).
time_units: The units of the time spacing (If the time axis is present).
num_levels: The number of levels in the pyramid.
Expand Down Expand Up @@ -146,10 +146,10 @@ def create_image_metadata(
)

channels = []
for label, wavelenghts, kwargs in zip(
for label, wavelengths, kwargs in zip(
channel_labels, channel_wavelengths, channel_kwargs, strict=True
):
channels.append(Channel(label=label, wavelength_id=wavelenghts, **kwargs))
channels.append(Channel(label=label, wavelength_id=wavelengths, **kwargs))

omero_kwargs = {} if omero_kwargs is None else omero_kwargs
omero = Omero(channels=channels, **omero_kwargs)
Expand Down Expand Up @@ -185,7 +185,7 @@ def create_label_metadata(
for the pyramid building.
z_scaling_factor: The scaling factor for the z axis, to be used for the
pyramid building. Note that several tools may not support scaling
diffent than 1.0 for the z axis.
different than 1.0 for the z axis.
time_spacing: The time spacing (If the time axis is present).
time_units: The units of the time spacing (If the time axis is present).
num_levels: The number of levels in the pyramid.
Expand Down
4 changes: 2 additions & 2 deletions src/ngio/pipes/data_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class DataTransformPipe:
"""A class to handle a pipeline of data transforms.
For example, a pipeline of transforms can be:
- Selecte a subset of the data
- Select a subset of the data
- Shuffle the axes of the data
- Normalize the data
All these in reverse order will be applied to the data when seting a patch.
All these in reverse order will be applied to the data when setting a patch.
"""

Expand Down
6 changes: 3 additions & 3 deletions src/ngio/tables/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@ def _safe_to_df(data_frame: pd.DataFrame, index_key: str) -> pd.DataFrame:
def df_to_andata(
data_frame: pd.DataFrame,
index_key: str = "label",
inplicit_conversion: bool = False,
implicit_conversion: bool = False,
) -> ad.AnnData:
"""Convert a pandas DataFrame representing a fractal table to an AnnData object.
Args:
data_frame: A pandas DataFrame representing a fractal table.
index_key: The column name to use as the index of the DataFrame.
Default is 'label'.
inplicit_conversion: If True, the function will convert the data frame
implicit_conversion: If True, the function will convert the data frame
to an AnnData object as it. If False, the function will check the data frame
for compatibility.
And correct correctly formatted data frame to AnnData object.
Default is False.
"""
if inplicit_conversion:
if implicit_conversion:
return ad.AnnData(data_frame)

return _safe_to_df(data_frame, index_key)
Expand Down
6 changes: 3 additions & 3 deletions src/ngio/tables/v1/feature_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ class FeatureTableV1:
https://fractal-analytics-platform.github.io/fractal-tasks-core/tables/
"""

def __init__(self, group: zarr.Group, inplicit_conversion: bool = False):
def __init__(self, group: zarr.Group, implicit_conversion: bool = False):
"""Initialize the class from an existing group.
Args:
group (zarr.Group): The group containing the
ROI table.
inplicit_conversion (bool): If True, the anndata object will be
implicit_conversion (bool): If True, the anndata object will be
converted to a DataFrame without any checks. If False, the
anndata object will be checked for compatibility and converted
to a DataFrame. Default is False.
Expand Down Expand Up @@ -139,7 +139,7 @@ def write(self) -> None:
@staticmethod
def _write(group: zarr.Group, table: DataFrame, meta: FeatureTableV1Meta) -> None:
ad_table = df_to_andata(
table, index_key=meta.instance_key, inplicit_conversion=False
table, index_key=meta.instance_key, implicit_conversion=False
)

path = Path(group.store.path) / group.path
Expand Down
2 changes: 1 addition & 1 deletion src/ngio/tables/v1/roi_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _create_new(
table = DataFrame(columns=columns)
else:
cls._validate_roi_table(table=table)
# this should be possibe to do duing initialization
# this should be possible to do duing initialization
# but for now this works
table = table.set_index("FieldIndex")
cls._write(group=table_group, table=table)
Expand Down
4 changes: 2 additions & 2 deletions tests/core/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from packaging.version import Version
from pytest import fixture

zarr_verison = version("zarr")
ZARR_PYTHON_V = 2 if Version(zarr_verison) < Version("3.0.0a") else 3
zarr_version = version("zarr")
ZARR_PYTHON_V = 2 if Version(zarr_version) < Version("3.0.0a") else 3


@fixture
Expand Down
4 changes: 2 additions & 2 deletions tests/io/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from packaging.version import Version
from pytest import fixture

zarr_verison = version("zarr")
ZARR_PYTHON_V = 2 if Version(zarr_verison) < Version("3.0.0a") else 3
zarr_version = version("zarr")
ZARR_PYTHON_V = 2 if Version(zarr_version) < Version("3.0.0a") else 3


def _create_zarr(tempdir, zarr_format=2):
Expand Down
4 changes: 2 additions & 2 deletions tests/ngff_meta/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from packaging.version import Version
from pytest import fixture

zarr_verison = version("zarr")
ZARR_PYTHON_V = 2 if Version(zarr_verison) < Version("3.0.0a") else 3
zarr_version = version("zarr")
ZARR_PYTHON_V = 2 if Version(zarr_version) < Version("3.0.0a") else 3


@fixture
Expand Down
4 changes: 2 additions & 2 deletions tests/tables/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from packaging.version import Version
from pytest import fixture

zarr_verison = version("zarr")
ZARR_PYTHON_V = 2 if Version(zarr_verison) < Version("3.0.0a") else 3
zarr_version = version("zarr")
ZARR_PYTHON_V = 2 if Version(zarr_version) < Version("3.0.0a") else 3


@fixture
Expand Down

0 comments on commit 51358d6

Please sign in to comment.