当前位置: 首页>>代码示例>>Python>>正文


Python special.i0e方法代码示例

本文整理汇总了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) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:10,代码来源:_continuous_distns.py

示例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) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:4,代码来源:test_basic.py

示例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) 
开发者ID:nccgroup,项目名称:Splunking-Crime,代码行数:8,代码来源:_continuous_distns.py

示例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)) 
开发者ID:lscsoft,项目名称:bilby,代码行数:7,代码来源:likelihood.py

示例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 
开发者ID:gwastro,项目名称:pycbc,代码行数:50,代码来源:marginalized_gaussian_noise.py

示例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) 
开发者ID:gwastro,项目名称:pycbc,代码行数:52,代码来源:relbin.py


注:本文中的scipy.special.i0e方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。