diff --git a/src/nmreval/models/bds.py b/src/nmreval/models/bds.py index 9ccb922..9f6321d 100644 --- a/src/nmreval/models/bds.py +++ b/src/nmreval/models/bds.py @@ -1,5 +1,6 @@ import numpy as np +from . import PowerLaw from ..distributions import Debye, ColeCole, ColeDavidson, KWW, HavriliakNegami from ..utils.constants import epsilon0 @@ -232,8 +233,8 @@ class DCCondBDS: class DerivativeHavriliakNegami: - name = 'Derivative HN' - type = 'Dielectric Spectroscopy' + name = 'Havriliak-Negami (der.)' + type = 'Dielectric Spectroscopy (derivative)' params = [r'\Delta\epsilon', r'\tau', r'\alpha', r'\gamma'] choices = [ ('x axis', 'xaxis', {'Frequency': 'freq', 'Omega': 'omega'}) @@ -254,8 +255,8 @@ class DerivativeHavriliakNegami: class DerivativeColeCole: - name = 'Derivative CC' - type = 'Dielectric Spectroscopy' + name = 'Cole-Cole (der.)' + type = 'Dielectric Spectroscopy (derivative)' params = [r'\Delta\epsilon', r'\tau', r'\alpha'] bounds = [(0, None), (0, None), (0, 1)] choices = [ @@ -276,8 +277,8 @@ class DerivativeColeCole: class DerivativeColeDavidson: - name = 'Derivative CD' - type = 'Dielectric Spectroscopy' + name = 'Cole-Davidson (der.)' + type = 'Dielectric Spectroscopy (derivative)' params = [r'\Delta\epsilon', r'\tau', r'\gamma'] bounds = [(0, None), (0, None), (0, 1)] choices = [ @@ -295,8 +296,8 @@ class DerivativeColeDavidson: class _DerivativeHNWithHF: - name = 'Derivative (HN + HF wing)' - type = 'Dielectric Spectroscopy' + name = 'HN + HF wing (der.)' + type = 'Dielectric Spectroscopy (derivative)' params = [r'\Delta\epsilon', r'\tau', r'\alpha', r'\gamma', r'\tau_{c}', r'\delta'] bounds = [(0, None), (0, None), (0, 1), (0, 1), (0, None), (0, 1)] choices = [ @@ -325,8 +326,8 @@ class _DerivativeHNWithHF: class DerivativeCCWithHF: - name = 'Derivative (CC + HF wing)' - type = 'Dielectric Spectroscopy' + name = 'CC + HF wing (der.)' + type = 'Dielectric Spectroscopy (derivative)' params = [r'\Delta\epsilon', r'\tau', r'\alpha', r'\tau_{c}', r'\delta'] bounds = [(0, None), (0, None), (0, 1), (0, None), (0, 1)] choices = [ @@ -339,8 +340,8 @@ class DerivativeCCWithHF: class DerivativeCDWithHF: - name = 'Derivative (CD + HF wing)' - type = 'Dielectric Spectroscopy' + name = 'CD + HF wing (der.)' + type = 'Dielectric Spectroscopy (derivative)' params = [r'\Delta\epsilon', r'\tau', r'\gamma', r'\tau_{c}', r'\delta'] bounds = [(0, None), (0, None), (0, 1), (0, None), (0, 1)] choices = [ @@ -352,6 +353,22 @@ class DerivativeCDWithHF: return _DerivativeHNWithHF.func(x, deps, tau, 1, gamma, tauc, delta, xaxis=xaxis) +class PowerLawBDSDer: + name = 'Power Law' + type = 'Dielectric Spectroscopy (derivative)' + equation = r'A * \omega^{n}' + params = ['A', 'n'] + bounds = [(None, None), (None, None)] + choices = [ + ('x axis', 'xaxis', {'Frequency': 'freq', 'Omega': 'omega'}) + ] + + @staticmethod + def func(x, a, n, xaxis: str = 'freq'): + _w = _convert_x_to_omega(x, xaxis=xaxis) + return a * _w ** n + + def _convert_x_to_omega(x, xaxis: str = 'freq'): if xaxis not in ['freq', 'omega']: raise ValueError(f'Argument `xaxis` is `freq` or `omega`, given is {xaxis!r}')