python/src/rwsims/functions.py

22 lines
648 B
Python
Raw Normal View History

2024-06-30 10:06:44 +00:00
from __future__ import annotations
import numpy as np
from numpy.typing import ArrayLike
from distributions import BaseDistribution
from motions import BaseMotion
def ste(x, a, f_infty, tau, beta):
return a*((1-f_infty) * np.exp(-(x/tau)**beta) + f_infty)
def pulse_attn(freq: ArrayLike, t_pulse: float) -> ArrayLike:
# 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)
return np.pi * numerator/denominator / 2