From dbf7ac2091e4b7ee054a52839299f8486cd27c4b Mon Sep 17 00:00:00 2001 From: William Patton Date: Thu, 2 Jan 2025 12:39:48 -0800 Subject: [PATCH] Add converter to turn upsample/downsample into `Coordinate`s for easy multiplication --- .../datasets/arrays/resampled_array_config.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dacapo/experiments/datasplits/datasets/arrays/resampled_array_config.py b/dacapo/experiments/datasplits/datasets/arrays/resampled_array_config.py index d60a5c3d..7c70e2b1 100644 --- a/dacapo/experiments/datasplits/datasets/arrays/resampled_array_config.py +++ b/dacapo/experiments/datasplits/datasets/arrays/resampled_array_config.py @@ -48,10 +48,10 @@ class ResampledArrayConfig(ArrayConfig): metadata={"help_text": "The Array that you want to upsample or downsample."} ) - upsample: Coordinate = attr.ib( + _upsample: Coordinate = attr.ib( metadata={"help_text": "The amount by which to upsample!"} ) - downsample: Coordinate = attr.ib( + _downsample: Coordinate = attr.ib( metadata={"help_text": "The amount by which to downsample!"} ) interp_order: bool = attr.ib( @@ -109,6 +109,14 @@ def preprocess(self, array: Array) -> Array: axis_names=array.axis_names, units=array.units, ) + + @property + def upsample(self) -> Coordinate: + return Coordinate(self._upsample) + + @property + def downsample(self) -> Coordinate: + return Coordinate(self._downsample) def array(self, mode: str = "r") -> Array: source_array = self.source_array_config.array(mode)