Source code for ezmsg.sigproc.math.scale
import ezmsg.core as ez
from ezmsg.util.messages.axisarray import AxisArray
from ezmsg.util.messages.util import replace
from ..base import BaseTransformer, BaseTransformerUnit
[docs]
class ScaleSettings(ez.Settings):
scale: float = 1.0
"""Factor by which to scale the data magnitude."""
[docs]
class Scale(BaseTransformerUnit[ScaleSettings, AxisArray, AxisArray, ScaleTransformer]):
SETTINGS = ScaleSettings
[docs]
def scale(scale: float = 1.0) -> ScaleTransformer:
"""
Scale the data by a constant factor.
Args:
scale: Factor by which to scale the data magnitude.
Returns: :obj:`ScaleTransformer`
"""
return ScaleTransformer(ScaleSettings(scale=scale))