From 5db6a9f2c50fddb397d868e6d4bb8c9c532238ca Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Wed, 19 Jul 2023 18:36:13 +0200 Subject: [PATCH] add HN model with independent slopes --- src/nmreval/models/bds.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/nmreval/models/bds.py b/src/nmreval/models/bds.py index 137c5ab..9356de9 100644 --- a/src/nmreval/models/bds.py +++ b/src/nmreval/models/bds.py @@ -54,10 +54,31 @@ class HavriliakNegamiBDS(_AbstractBDS): name = 'Havriliak-Negami' equation = r'\Delta\epsilon / [1-(i\omega\tau)^{\gamma}]^{\alpha}' params = _AbstractBDS.params + [r'\alpha', r'\gamma'] - bounds = _AbstractBDS.bounds + [(0, 1), (0, 1)] + bounds = _AbstractBDS.bounds + [(0, 1), (0, None)] susceptibility = HavriliakNegami.susceptibility +class HavriliakNegamiAlphaGammaBDS: + type = 'Dielectric Spectroscopy' + name = 'Havriliak-Negami (ind. slopes)' + equation = r'\Delta\epsilon / [1-(i\omega\tau)^{\gamma}]^{\alpha}' + params = [r'\Delta\epsilon', r'\tau_{0}', r'\alpha', r'\alpha\gamma'] + bounds = [(0, None), (0, None), (0, 1), (0, 1)] + iscomplex = True + + @staticmethod + def func(x, deps, tau, alpha, alphagamma, complex_mode: int = 0, **kwargs): + chi = deps * HavriliakNegami.susceptibility(2*np.pi*x, tau, alpha, alphagamma/alpha, **kwargs) + if complex_mode == 0: + return chi + elif complex_mode == 1: + return chi.real + elif complex_mode == 2: + return chi.imag + else: + raise ValueError(f'{complex_mode!r} is not 0, 1, 2') + + class KWWBDS(_AbstractBDS): name = 'KWW' params = _AbstractBDS.params + [r'\beta']