Skip to content

LogParam

Log parameters.

Attributes:

Name Type Description
amplitude float

The amplitude of the logarithm function.

rate float

The rate of the logarithm function.

offset float

The offset at x=1.

Methods:

  • amplitude_at_base(base: float = 10): float. Return the amplitude if the base is not natural.
  • offset_at_base(base: float = 10): float. Return the offset if the base is not natural.
Source code in ffit/funcs/log.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@dataclass(frozen=True)
class LogParam(ParamDataclass):
    """Log parameters.

    Attributes:
        amplitude (float):
            The amplitude of the logarithm function.
        rate (float):
            The rate of the logarithm function.
        offset (float):
            The offset at x=1.

    Methods:
    -------
    - `amplitude_at_base(base: float = 10)`: float.
        Return the amplitude if the base is not natural.
    - `offset_at_base(base: float = 10)`: float.
        Return the offset if the base is not natural.
    """

    amplitude: float
    rate: float
    offset: float

    std: "_t.Optional[LogParam]" = None

    def amplitude_at_base(self, base: float = 10):
        return self.amplitude / np.log(base)

    def offset_at_base(self, base: float = 10):
        return self.offset + self.amplitude * np.log(self.rate) * (1 / np.log(base) - 1)