import dascore as dc
= dc.get_example_patch()
patch
# L2 normalization along time dimension
= patch.normalize(dim="time", norm="l2")
l2_norm
# Max normalization along distance dimension
= patch.normalize(dim="distance", norm="max")
max_norm
# Bit normalization (sign only)
= patch.normalize(dim="time", norm="bit") bit_norm
normalize
normalize(
self: Patch ,
dim: str ,
norm: Literal[‘l1’, ‘l2’, ‘max’, ‘bit’] = l2,
)-> ‘PatchType’
Normalize a patch along a specified dimension.
Parameters
Parameter | Description |
---|---|
dim | The dimension along which the normalization takes place. |
norm |
Determines the value to divide each sample by along a given axis. Options are: l1 - divide each sample by the l1 of the axis. l2 - divide each sample by the l2 of the axis. max - divide each sample by the maximum of the absolute value of the axis. bit - sample-by-sample normalization (-1/+1) |