Skip to content

Commit

Permalink
improve ScaleRange docs
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnBe committed Nov 13, 2024
1 parent 818515b commit fd34109
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
13 changes: 10 additions & 3 deletions bioimageio/spec/model/v0_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,14 @@ class ZeroMeanUnitVarianceDescr(ProcessingDescrBase):


class ScaleRangeKwargs(ProcessingKwargs):
"""key word arguments for `ScaleRangeDescr`"""
"""key word arguments for `ScaleRangeDescr`
For `min_percentile`=0.0 (the default) and `max_percentile`=100 (the default)
this processing step normalizes data to the [0, 1] intervall.
For other percentiles the normalized values will partially be outside the [0, 1]
intervall. Use `ScaleRange` followed by `ClipDescr` if you want to limit the
normalized values to a range.
"""

mode: Literal["per_dataset", "per_sample"]
"""Mode for computing percentiles.
Expand All @@ -668,10 +675,10 @@ class ScaleRangeKwargs(ProcessingKwargs):
For example xy to normalize the two image axes for 2d data jointly."""

min_percentile: Annotated[Union[int, float], Interval(ge=0, lt=100)] = 0.0
"""The lower percentile used for normalization."""
"""The lower percentile used to determine the value to align with zero."""

max_percentile: Annotated[Union[int, float], Interval(gt=1, le=100)] = 100.0
"""The upper percentile used for normalization
"""The upper percentile used to determine the value to align with one.
Has to be bigger than `min_percentile`.
The range is 1 to 100 instead of 0 to 100 to avoid mistakenly
accepting percentiles specified in the range 0.0 to 1.0."""
Expand Down
13 changes: 10 additions & 3 deletions bioimageio/spec/model/v0_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,14 @@ class ZeroMeanUnitVarianceDescr(ProcessingDescrBase):


class ScaleRangeKwargs(ProcessingKwargs):
"""key word arguments for `ScaleRangeDescr`"""
"""key word arguments for `ScaleRangeDescr`
For `min_percentile`=0.0 (the default) and `max_percentile`=100 (the default)
this processing step normalizes data to the [0, 1] intervall.
For other percentiles the normalized values will partially be outside the [0, 1]
intervall. Use `ScaleRange` followed by `ClipDescr` if you want to limit the
normalized values to a range.
"""

axes: Annotated[
Optional[Sequence[AxisId]], Field(examples=[("batch", "x", "y")])
Expand All @@ -1011,10 +1018,10 @@ class ScaleRangeKwargs(ProcessingKwargs):
Default: Scale all axes jointly."""

min_percentile: Annotated[float, Interval(ge=0, lt=100)] = 0.0
"""The lower percentile used for normalization."""
"""The lower percentile used to determine the value to align with zero."""

max_percentile: Annotated[float, Interval(gt=1, le=100)] = 100.0
"""The upper percentile used for normalization
"""The upper percentile used to determine the value to align with one.
Has to be bigger than `min_percentile`.
The range is 1 to 100 instead of 0 to 100 to avoid mistakenly
accepting percentiles specified in the range 0.0 to 1.0."""
Expand Down

0 comments on commit fd34109

Please sign in to comment.