python/rwsims/functions.py

23 lines
629 B
Python
Raw Normal View History

2024-06-30 10:06:44 +00:00
from __future__ import annotations
import numpy as np
2024-08-01 16:46:28 +00:00
# from numpy.typing import ArrayLike
2024-06-30 10:06:44 +00:00
2024-08-01 16:46:28 +00:00
from .distributions import BaseDistribution
from .motions import BaseMotion
2024-06-30 10:06:44 +00:00
def ste(x, a, f_infty, tau, beta):
return a*((1-f_infty) * np.exp(-(x/tau)**beta) + f_infty)
2024-08-01 16:46:28 +00:00
def pulse_attn(freq, t_pulse: float):
2024-06-30 10:06:44 +00:00
# cf. Schmitt-Rohr/Spieß eq. 2.126; omega_1 * t_p = pi/2
pi_half_squared = np.pi**2 / 4
omega = 2 * np.pi * freq
numerator = np.sin(np.sqrt(pi_half_squared + omega**2 * t_pulse**2 / 2))
denominator = np.sqrt(pi_half_squared + omega**2 * t_pulse**2 / 4)
2024-08-01 16:46:28 +00:00
return np.pi * numerator/denominator / 2