text
stringlengths 0
828
|
---|
m_resized = np.resize(m, newsize)
|
tau_resized = np.resize(tau, newsize)
|
c_resized = np.resize(c, newsize)
|
omega = np.atleast_2d(2 * np.pi * self.f).T
|
self.w = np.resize(omega, (len(m), nr_f)).T
|
self.rho0 = rho0
|
self.m = m_resized
|
self.tau = tau_resized
|
self.c = c_resized
|
# compute some common terms
|
self.otc = (self.w * self.tau) ** self.c
|
self.otc2 = (self.w * self.tau) ** (2 * self.c)
|
self.ang = self.c * np.pi / 2.0 # rad
|
self.denom = 1 + 2 * self.otc * np.cos(self.ang) + self.otc2"
|
249,"def response(self, parameters):
|
r""""""Complex response of the Cole-Cole model::
|
:math:`\hat{\rho} = \rho_0 \left(1 - \sum_i m_i (1 - \frac{1}{1 + (j
|
\omega \tau_i)^c_i})\right)`
|
Parameters
|
----------
|
parameters: list or tuple or numpy.ndarray
|
Cole-Cole model parameters: rho0, m, tau, c (all linear)
|
Returns
|
-------
|
response: :class:`sip_models.sip_response.sip_response`
|
model response object
|
""""""
|
# get a config object
|
self._set_parameters(parameters)
|
terms = self.m * (1 - (1 / (1 + (1j * self.w * self.tau) ** self.c)))
|
# sum up terms
|
specs = np.sum(terms, axis=1)
|
rcomplex = self.rho0 * (1 - specs)
|
response = sip_response.sip_response(self.f, rcomplex=rcomplex)
|
return response"
|
250,"def dre_drho0(self, pars):
|
r"""""" Compute partial derivative of real parts with respect to
|
:math:`\rho_0`
|
:math:`\frac{\partial \hat{\rho'}(\omega)}{\partial \rho_0} = 1 -
|
\frac{m (\omega \tau)^c cos(\frac{c \pi}{2}) + (\omega \tau)^c}{1 + 2
|
(\omega \tau)^c cos(\frac{c \pi}{2}) + (\omega \tau)^{2 c}}`
|
Note that partial derivatives towards :math:`\rho_0` are 1D, in
|
contrast to the other parameter derivatives, which usually return 2D
|
arrays!
|
Returns
|
-------
|
dre_drho0: :class:`numpy.ndarray`
|
Size N (nr of frequencies) array with the derivatives
|
""""""
|
self._set_parameters(pars)
|
numerator = self.m * self.otc * (np.cos(self.ang) + self.otc)
|
term = numerator / self.denom
|
specs = np.sum(term, axis=1)
|
result = 1 - specs
|
return result"
|
251,"def dre_dlog10rho0(self, pars):
|
""""""Compute partial derivative of real parts to log10(rho0)
|
""""""
|
# first call the linear response to set the parameters
|
linear_response = self.dre_drho0(pars)
|
result = np.log(10) * self.rho0 * linear_response
|
return result"
|
252,"def dre_dm(self, pars):
|
r""""""
|
:math:`\frac{\partial \hat{\rho'}(\omega)}{\partial m} = - \rho_0 m
|
(\omega \tau)^c \frac{(cos(\frac{c \pi}{2}) + (\omega \tau)^c)}{1 + 2
|
(\omega \tau)^c cos(\frac{c \pi}{2}) + (\omega \tau)^{2 c}}`
|
""""""
|
self._set_parameters(pars)
|
numerator = -self.otc * (np.cos(self.ang) + self.otc)
|
result = numerator / self.denom
|
result *= self.rho0
|
return result"
|
253,"def dim_dm(self, pars):
|
r""""""
|
:math:`\frac{\partial \hat{\rho''}(\omega)}{\partial m} = - \rho_0 m
|
(\omega \tau)^c \frac{sin(\frac{c \pi}{2})}{1 + 2 (\omega \tau)^c
|
cos(\frac{c \pi}{2}) + (\omega \tau)^{2 c}}`
|
""""""
|
self._set_parameters(pars)
|
numerator = -self.otc * np.sin(self.ang)
|
result = numerator / self.denom
|
result *= self.rho0
|
return result"
|
254,"def dim_dtau(self, pars):
|
r""""""
|
:math:`\frac{\partial \hat{\rho''}(\omega)}{\partial \tau} = \rho_0
|
\frac{-m \omega^c c \tau^{c-1} sin(\frac{c \pi}{2} }{1 + 2 (\omega
|
\tau)^c cos(\frac{c \pi}{2}) + (\omega \tau)^{2 c}} +
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.