Python scipy.special.i0e() Examples
The following are 10
code examples of scipy.special.i0e().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
scipy.special
, or try the search function
.
Example #1
Source File: _continuous_distns.py From lambda-packs with MIT License | 5 votes |
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)
Example #2
Source File: test_basic.py From Computable with MIT License | 5 votes |
def test_i0e(self): assert_equal(cephes.i0e(0),1.0)
Example #3
Source File: test_basic.py From Computable with MIT License | 5 votes |
def test_i0e(self): oize = special.i0e(.1) oizer = special.ive(0,.1) assert_almost_equal(oize,oizer,8)
Example #4
Source File: _continuous_distns.py From GraphicDesignPatternByPython with MIT License | 5 votes |
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)
Example #5
Source File: test_basic.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def test_i0e(self): assert_equal(cephes.i0e(0),1.0)
Example #6
Source File: test_basic.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def test_i0e(self): oize = special.i0e(.1) oizer = special.ive(0,.1) assert_almost_equal(oize,oizer,8)
Example #7
Source File: _continuous_distns.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
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)
Example #8
Source File: likelihood.py From bilby with MIT License | 5 votes |
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))
Example #9
Source File: marginalized_gaussian_noise.py From pycbc with GNU General Public License v3.0 | 4 votes |
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
Example #10
Source File: relbin.py From pycbc with GNU General Public License v3.0 | 4 votes |
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)