Skip to content

sgnts.transforms.amplify

Amplify dataclass

Bases: TSTransform


              flowchart TD
              sgnts.transforms.amplify.Amplify[Amplify]
              sgnts.base.base.TSTransform[TSTransform]
              sgnts.base.base.TimeSeriesMixin[TimeSeriesMixin]

                              sgnts.base.base.TSTransform --> sgnts.transforms.amplify.Amplify
                                sgnts.base.base.TimeSeriesMixin --> sgnts.base.base.TSTransform
                



              click sgnts.transforms.amplify.Amplify href "" "sgnts.transforms.amplify.Amplify"
              click sgnts.base.base.TSTransform href "" "sgnts.base.base.TSTransform"
              click sgnts.base.base.TimeSeriesMixin href "" "sgnts.base.base.TimeSeriesMixin"
            

Amplify data by a factor.

Parameters:

Name Type Description Default
factor float

float, the factor to multiply the data with

1
Source code in sgnts/transforms/amplify.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@dataclass
class Amplify(TSTransform):
    """Amplify data by a factor.

    Args:
        factor:
            float, the factor to multiply the data with
    """

    factor: float = 1

    @validator.one_to_one
    def validate(self) -> None:
        pass

    @transform.one_to_one
    def process(self, input_frame: TSFrame, output_frame: TSCollectFrame) -> None:
        """Amplify non-gap data by the factor."""
        for buf in input_frame:
            if not buf.is_gap:
                assert buf.data is not None
                data = buf.data * self.factor
                buf = buf.copy(data=data)
            output_frame.append(buf)

process(input_frame, output_frame)

Amplify non-gap data by the factor.

Source code in sgnts/transforms/amplify.py
24
25
26
27
28
29
30
31
32
@transform.one_to_one
def process(self, input_frame: TSFrame, output_frame: TSCollectFrame) -> None:
    """Amplify non-gap data by the factor."""
    for buf in input_frame:
        if not buf.is_gap:
            assert buf.data is not None
            data = buf.data * self.factor
            buf = buf.copy(data=data)
        output_frame.append(buf)