From c7a258aa1d7e16b5e9e5a6a738d27853676ef2c1 Mon Sep 17 00:00:00 2001 From: Markus Rosenstihl Date: Thu, 8 Jan 2015 16:56:44 +0100 Subject: [PATCH] removed redundant implementations of fit functions (hav-neg, conductiviety, etc.) --- data/Container.py | 28 +++++----------------------- libmath/functions.py | 2 +- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/data/Container.py b/data/Container.py index 71eb450..77211a1 100644 --- a/data/Container.py +++ b/data/Container.py @@ -21,19 +21,12 @@ class Conductivity(BaseContainer): self.color = QColor("blue") self.id_label = "Cond." self.id_string = "cond" - self.param_number = 3 + + def function(self, p ,x): return functions.cond_cmplx(p,x) - # def function( self, p, x ): - # om = 2*np.pi*x - # sgma, isgma, n = p - # cond = sgma/(om**n)+isgma/(1j*om**n) # Jonscher (Universal Dielectric Response: e",e' prop sigma/omega**n - # cplx = np.array([cond.real, -cond.imag]) - # return cplx - - class PowerComplex(BaseContainer): def __init__( self, plt_real=None, plt_imag=None, limits=None ): @@ -45,11 +38,7 @@ class PowerComplex(BaseContainer): self.param_number = 2 def function( self, p, x ): - om = 2*np.pi*x - sgma, n = p - power = sgma/(om*1j)**n - cplx = np.array([power.real, -power.imag]) - return cplx + return functions.power_cmplx(p, x) class Static(BaseContainer): @@ -62,10 +51,7 @@ class Static(BaseContainer): self.param_number = 1 def function( self, p, x ): - eps_inf = p[0] - static = np.ones((2, x.size))*eps_inf - static[1, :] *= 0 # set imag part zero - return static + return functions.static_cmplx(p, x) class Peak(BaseContainer): @@ -81,11 +67,7 @@ class Peak(BaseContainer): self.param_number = 4 def function( self, p, x ): - eps, t, a, b = p - om = 2*np.pi*x - hn = eps/(1+(1j*om*t)**a)**b - cplx = np.array([hn.real, -hn.imag]) - return cplx + return functions.hn(p, x) class YAFF(BaseContainer): diff --git a/libmath/functions.py b/libmath/functions.py index dff9027..3b0e607 100644 --- a/libmath/functions.py +++ b/libmath/functions.py @@ -54,7 +54,7 @@ class HavNegCmplx(Function): self.set_num_paramters(4) -def hn(x, p): +def hn(p, x): om = 2*np.pi*x #hn = om*1j eps, t, a, b = p