Skip to content

Commit

Permalink
black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pattonw committed Nov 5, 2024
1 parent d67f098 commit 41cf3a9
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ConcatArrayConfig(ArrayConfig):
},
)

def array(self, mode:str="r") -> Array:
def array(self, mode: str = "r") -> Array:
arrays = [config.array(mode) for _, config in self.source_array_configs]

out_array = Array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def array(self, mode: str = "r") -> Array:
# directly read from DVID
raise NotImplementedError("NotImplemented")
from dacapo.ext import NoSuchModule

try:
from neuclease.dvid import fetch_info, fetch_labelmap_voxels, fetch_raw
except ImportError:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ def array(self, mode: str = "r") -> Array:

# mark data as non-writable
out_array.lazy_op(lambda data: data)
return out_array
return out_array
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ def array(self, mode: str = "r") -> Array:
voxel_size=source_array.voxel_size,
axis_names=source_array.axis_names,
units=source_array.units,
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ class ResampledArrayConfig(ArrayConfig):
def array(self, mode: str = "r") -> Array:
# This is non trivial. We want to upsample or downsample the source
# array lazily. Not entirely sure how to do this with dask arrays.
raise NotImplementedError()
raise NotImplementedError()
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ class TiffArrayConfig(ArrayConfig):
voxel_size: Coordinate = attr.ib(
metadata={"help_text": "The size of each voxel in each dimension."}
)
axis_names: list[str] = attr.ib(metadata={"help_text": "The axis_names of your array"})
axis_names: list[str] = attr.ib(
metadata={"help_text": "The axis_names of your array"}
)
units: list[str] = attr.ib(metadata={"help_text": "The units of your array"})

def array(self, mode: str = "r") -> Array:
Expand All @@ -51,4 +53,4 @@ def array(self, mode: str = "r") -> Array:
voxel_size=self.voxel_size,
axis_names=self.axis_names,
units=self.units,
)
)
1 change: 1 addition & 0 deletions dacapo/experiments/datasplits/datasets/dummy_dataset.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .dataset import Dataset
from funlib.persistence import Array


class DummyDataset(Dataset):
"""
DummyDataset is a child class of the Dataset. This class has property 'raw' of Array type and a name.
Expand Down
4 changes: 1 addition & 3 deletions dacapo/experiments/tasks/predictors/distance_predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ def create_target(self, gt: Array):
"""
Turn the ground truth labels into a distance transform.
"""
distances = self.process(
gt[:], gt.voxel_size, self.norm, self.dt_scale_factor
)
distances = self.process(gt[:], gt.voxel_size, self.norm, self.dt_scale_factor)
return np_to_funlib_array(
distances,
gt.roi.offset,
Expand Down
10 changes: 6 additions & 4 deletions dacapo/experiments/trainers/gunpowder_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,11 @@ def iterate(self, num_iterations, model, optimizer, device):
snapshot_array_identifier,
v.axis_names,
v.roi,
v.shape[0]
if (v.channel_dims == 1 and v.shape[0] > 1)
else None,
(
v.shape[0]
if (v.channel_dims == 1 and v.shape[0] > 1)
else None
),
v.voxel_size,
v.dtype if not v.dtype == bool else np.float32,
model.output_shape * v.voxel_size,
Expand All @@ -386,7 +388,7 @@ def iterate(self, num_iterations, model, optimizer, device):
array = open_from_identifier(
snapshot_array_identifier, mode="a"
)

# neuroglancer doesn't allow bools
if not v.dtype == bool:
data = v[:]
Expand Down
2 changes: 0 additions & 2 deletions dacapo/store/array_store.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


import zarr
import neuroglancer
import attr
Expand Down
8 changes: 5 additions & 3 deletions dacapo/tmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ def create_from_identifier(
voxel_size=voxel_size,
axis_names=axis_names,
dtype=dtype,
chunk_shape=(*num_channels, *write_size / voxel_size)
if write_size is not None
else None,
chunk_shape=(
(*num_channels, *write_size / voxel_size)
if write_size is not None
else None
),
mode=mode if overwrite is False else "w",
)

Expand Down
2 changes: 1 addition & 1 deletion tests/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import multiprocessing as mp

mp.set_start_method('fork', force=True)
mp.set_start_method("fork", force=True)

0 comments on commit 41cf3a9

Please sign in to comment.