Skip to content

Commit

Permalink
Add StdProjection to compute standard deviation over given dimension.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 623516360
  • Loading branch information
aleximmer authored and copybara-github committed Apr 10, 2024
1 parent 5de8dcc commit 0a618fb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions connectomics/volume/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,19 @@ def __init__(self,
context_spec=context_spec)


@gin.register
class StdProjection(Projection):
"""Reduces input TensorStore along given dimension via nanstd()."""

def __init__(self,
projection_dim: int,
context_spec: Optional[MutableJsonSpec] = None):
super().__init__(
projection_fn=np.nanstd,
projection_dim=projection_dim,
context_spec=context_spec)


@gin.register
class SumProjection(Projection):
"""Reduces input TensorStore along given dimension via nansum()."""
Expand Down

0 comments on commit 0a618fb

Please sign in to comment.