本文整理匯總了Python中scipy.special.i0e方法的典型用法代碼示例。如果您正苦於以下問題:Python special.i0e方法的具體用法?Python special.i0e怎麽用?Python special.i0e使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scipy.special
的用法示例。
在下文中一共展示了special.i0e方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _pdf
# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import i0e [as 別名]
def _pdf(self, x, b):
# rice.pdf(x, b) = x * exp(-(x**2+b**2)/2) * I[0](x*b)
#
# We use (x**2 + b**2)/2 = ((x-b)**2)/2 + xb.
# The factor of np.exp(-xb) is then included in the i0e function
# in place of the modified Bessel function, i0, improving
# numerical stability for large values of xb.
return x * np.exp(-(x-b)*(x-b)/2.0) * sc.i0e(x*b)
示例2: test_i0e
# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import i0e [as 別名]
def test_i0e(self):
assert_equal(cephes.i0e(0),1.0)
示例3: _pdf
# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import i0e [as 別名]
def _pdf(self, x, b):
# We use (x**2 + b**2)/2 = ((x-b)**2)/2 + xb.
# The factor of np.exp(-xb) is then included in the i0e function
# in place of the modified Bessel function, i0, improving
# numerical stability for large values of xb.
return x * np.exp(-(x-b)*(x-b)/2.0) * sc.i0e(x*b)
示例4: _setup_phase_marginalization
# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import i0e [as 別名]
def _setup_phase_marginalization(self):
self._bessel_function_interped = interp1d(
np.logspace(-5, 10, int(1e6)), np.logspace(-5, 10, int(1e6)) +
np.log([i0e(snr) for snr in np.logspace(-5, 10, int(1e6))]),
bounds_error=False, fill_value=(0, np.nan))
示例5: _loglr
# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import i0e [as 別名]
def _loglr(self):
r"""Computes the log likelihood ratio,
.. math::
\log \mathcal{L}(\Theta) =
I_0 \left(\left|\sum_i O(h^0_i, d_i)\right|\right) -
\frac{1}{2}\left<h^0_i, h^0_i\right>,
at the current point in parameter space :math:`\Theta`.
Returns
-------
float
The value of the log likelihood ratio evaluated at the given point.
"""
params = self.current_params
try:
wfs = self.waveform_generator.generate(**params)
except NoWaveformError:
return self._nowaveform_loglr()
except FailedWaveformError as e:
if self.ignore_failed_waveforms:
return self._nowaveform_loglr()
else:
raise e
hh = 0.
hd = 0j
for det, h in wfs.items():
# the kmax of the waveforms may be different than internal kmax
kmax = min(len(h), self._kmax[det])
if self._kmin[det] >= kmax:
# if the waveform terminates before the filtering low frequency
# cutoff, then the loglr is just 0 for this detector
hh_i = 0.
hd_i = 0j
else:
# whiten the waveform
h[self._kmin[det]:kmax] *= \
self._weight[det][self._kmin[det]:kmax]
# calculate inner products
hh_i = h[self._kmin[det]:kmax].inner(
h[self._kmin[det]:kmax]).real
hd_i = self._whitened_data[det][self._kmin[det]:kmax].inner(
h[self._kmin[det]:kmax])
# store
setattr(self._current_stats, '{}_optimal_snrsq'.format(det), hh_i)
hh += hh_i
hd += hd_i
hd = abs(hd)
self._current_stats.maxl_phase = numpy.angle(hd)
return numpy.log(special.i0e(hd)) + hd - 0.5*hh
示例6: _loglr
# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import i0e [as 別名]
def _loglr(self):
r"""Computes the log likelihood ratio,
.. math::
\log \mathcal{L}(\Theta) = \sum_i
\left<h_i(\Theta)|d_i\right> -
\frac{1}{2}\left<h_i(\Theta)|h_i(\Theta)\right>,
at the current parameter values :math:`\Theta`.
Returns
-------
float
The value of the log likelihood ratio.
"""
# get model params
p = self.current_params.copy()
p.update(self.static_params)
hh = 0.
hd = 0j
for ifo in self.data:
# get detector antenna pattern
fp, fc = self.det[ifo].antenna_pattern(p['ra'], p['dec'],
p['polarization'],
p['tc'])
# get timeshift relative to end of data
dt = self.det[ifo].time_delay_from_earth_center(p['ra'], p['dec'],
p['tc'])
dtc = p['tc'] + dt - self.end_time
tshift = numpy.exp(-2.0j * numpy.pi * self.fedges * dtc)
# generate template and calculate waveform ratio
hp, hc = get_fd_waveform_sequence(sample_points=Array(self.fedges),
**p)
htilde = numpy.array(fp * hp + fc * hc) * tshift
r = (htilde / self.h00_sparse[ifo]).astype(numpy.complex128)
r0 = r[:-1]
r1 = (r[1:] - r[:-1]) / (self.fedges[1:] - self.fedges[:-1])
# <h, d> is sum over bins of A0r0 + A1r1
hd += numpy.sum(self.sdat[ifo]['a0'] * r0
+ self.sdat[ifo]['a1'] * r1)
# <h, h> is sum over bins of B0|r0|^2 + 2B1Re(r1r0*)
hh += numpy.sum(self.sdat[ifo]['b0'] * numpy.absolute(r0) ** 2.
+ 2. * self.sdat[ifo]['b1']
* (r1 * numpy.conjugate(r0)).real)
hd = abs(hd)
llr = numpy.log(special.i0e(hd)) + hd - 0.5 * hh
return float(llr)