split BDS and derivative BDS in different types

This commit is contained in:
Dominik Demuth 2024-01-02 11:07:36 +01:00
parent 9ca11bf05e
commit 66e31695d5

View File

@ -1,5 +1,6 @@
import numpy as np import numpy as np
from . import PowerLaw
from ..distributions import Debye, ColeCole, ColeDavidson, KWW, HavriliakNegami from ..distributions import Debye, ColeCole, ColeDavidson, KWW, HavriliakNegami
from ..utils.constants import epsilon0 from ..utils.constants import epsilon0
@ -232,8 +233,8 @@ class DCCondBDS:
class DerivativeHavriliakNegami: class DerivativeHavriliakNegami:
name = 'Derivative HN' name = 'Havriliak-Negami (der.)'
type = 'Dielectric Spectroscopy' type = 'Dielectric Spectroscopy (derivative)'
params = [r'\Delta\epsilon', r'\tau', r'\alpha', r'\gamma'] params = [r'\Delta\epsilon', r'\tau', r'\alpha', r'\gamma']
choices = [ choices = [
('x axis', 'xaxis', {'Frequency': 'freq', 'Omega': 'omega'}) ('x axis', 'xaxis', {'Frequency': 'freq', 'Omega': 'omega'})
@ -254,8 +255,8 @@ class DerivativeHavriliakNegami:
class DerivativeColeCole: class DerivativeColeCole:
name = 'Derivative CC' name = 'Cole-Cole (der.)'
type = 'Dielectric Spectroscopy' type = 'Dielectric Spectroscopy (derivative)'
params = [r'\Delta\epsilon', r'\tau', r'\alpha'] params = [r'\Delta\epsilon', r'\tau', r'\alpha']
bounds = [(0, None), (0, None), (0, 1)] bounds = [(0, None), (0, None), (0, 1)]
choices = [ choices = [
@ -276,8 +277,8 @@ class DerivativeColeCole:
class DerivativeColeDavidson: class DerivativeColeDavidson:
name = 'Derivative CD' name = 'Cole-Davidson (der.)'
type = 'Dielectric Spectroscopy' type = 'Dielectric Spectroscopy (derivative)'
params = [r'\Delta\epsilon', r'\tau', r'\gamma'] params = [r'\Delta\epsilon', r'\tau', r'\gamma']
bounds = [(0, None), (0, None), (0, 1)] bounds = [(0, None), (0, None), (0, 1)]
choices = [ choices = [
@ -295,8 +296,8 @@ class DerivativeColeDavidson:
class _DerivativeHNWithHF: class _DerivativeHNWithHF:
name = 'Derivative (HN + HF wing)' name = 'HN + HF wing (der.)'
type = 'Dielectric Spectroscopy' type = 'Dielectric Spectroscopy (derivative)'
params = [r'\Delta\epsilon', r'\tau', r'\alpha', r'\gamma', r'\tau_{c}', r'\delta'] 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)] bounds = [(0, None), (0, None), (0, 1), (0, 1), (0, None), (0, 1)]
choices = [ choices = [
@ -325,8 +326,8 @@ class _DerivativeHNWithHF:
class DerivativeCCWithHF: class DerivativeCCWithHF:
name = 'Derivative (CC + HF wing)' name = 'CC + HF wing (der.)'
type = 'Dielectric Spectroscopy' type = 'Dielectric Spectroscopy (derivative)'
params = [r'\Delta\epsilon', r'\tau', r'\alpha', r'\tau_{c}', r'\delta'] params = [r'\Delta\epsilon', r'\tau', r'\alpha', r'\tau_{c}', r'\delta']
bounds = [(0, None), (0, None), (0, 1), (0, None), (0, 1)] bounds = [(0, None), (0, None), (0, 1), (0, None), (0, 1)]
choices = [ choices = [
@ -339,8 +340,8 @@ class DerivativeCCWithHF:
class DerivativeCDWithHF: class DerivativeCDWithHF:
name = 'Derivative (CD + HF wing)' name = 'CD + HF wing (der.)'
type = 'Dielectric Spectroscopy' type = 'Dielectric Spectroscopy (derivative)'
params = [r'\Delta\epsilon', r'\tau', r'\gamma', r'\tau_{c}', r'\delta'] params = [r'\Delta\epsilon', r'\tau', r'\gamma', r'\tau_{c}', r'\delta']
bounds = [(0, None), (0, None), (0, 1), (0, None), (0, 1)] bounds = [(0, None), (0, None), (0, 1), (0, None), (0, 1)]
choices = [ choices = [
@ -352,6 +353,22 @@ class DerivativeCDWithHF:
return _DerivativeHNWithHF.func(x, deps, tau, 1, gamma, tauc, delta, xaxis=xaxis) 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'): def _convert_x_to_omega(x, xaxis: str = 'freq'):
if xaxis not in ['freq', 'omega']: if xaxis not in ['freq', 'omega']:
raise ValueError(f'Argument `xaxis` is `freq` or `omega`, given is {xaxis!r}') raise ValueError(f'Argument `xaxis` is `freq` or `omega`, given is {xaxis!r}')