python/rwsims/functions.py

19 lines
583 B
Python
Raw Permalink Normal View History

2024-06-30 10:06:44 +00:00
from __future__ import annotations
import numpy as np
2024-08-03 17:04:13 +00:00
def ste(x: np.ndarray, a: float, f_infty: float, tau: float, beta: float) -> np.ndarray:
2024-06-30 10:06:44 +00:00
return a*((1-f_infty) * np.exp(-(x/tau)**beta) + f_infty)
2024-08-03 17:04:13 +00:00
def pulse_attn(freq: np.ndarray, 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-03 17:04:13 +00:00
return np.pi * numerator / denominator / 2