From 03cdc225caa2cace9deb3c18f69895c3dab8ece2 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Mon, 24 Jun 2024 17:53:45 +0200 Subject: [PATCH] add sinc function --- src/nmreval/models/basic.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/nmreval/models/basic.py b/src/nmreval/models/basic.py index 411e218..ce4308d 100644 --- a/src/nmreval/models/basic.py +++ b/src/nmreval/models/basic.py @@ -191,6 +191,18 @@ class PowerLawCross: return ret_val +class Sinc: + type = 'Basic' + name = 'Sinc' + equation = 'C * sinc((x-x_{0})/w)' + params = ['C', 'x_{0}', 'w'] + + @staticmethod + def func(x, c: float, x0: float, w: float): + # numpy sinc is defined as sin(pi*x)/(pi*x) + return c * np.sinc(((x-x0)/w)/np.pi) + + class Sine: """ Wavy sine function