import dascore as dc
patch = dc.get_example_patch()
# L2 normalization along time dimension
l2_norm = patch.normalize(dim="time", norm="l2")
# Max normalization along distance dimension
max_norm = patch.normalize(dim="distance", norm="max")
# Bit normalization (sign only)
bit_norm = patch.normalize(dim="time", norm="bit")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) |