Skip to content

Commit 7f99ca1

Browse files
authored
Merge pull request #1611 from FlorianPfaff/megalinter-fixes
[MegaLinter] Apply linters automatic fixes
2 parents c34f224 + 8c04580 commit 7f99ca1

2 files changed

Lines changed: 41 additions & 25 deletions

File tree

pyrecest/distributions/hypertorus/toroidal_vm_rivest_distribution.py

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# pylint: disable=redefined-builtin,no-name-in-module,no-member
22
from pyrecest.backend import all, array, cos, exp, mod, pi, sin, sqrt
3-
43
from scipy.special import iv
54

65
from .abstract_toroidal_distribution import AbstractToroidalDistribution
@@ -68,13 +67,21 @@ def trigonometric_moment(self, n):
6867
(j + ell) // 2, float((self.alpha + self.beta) / 2)
6968
) * iv((j - ell) // 2, float((self.alpha - self.beta) / 2))
7069
total1 += (
71-
iv(j + 1, float(self.kappa[0]))
72-
+ iv(j - 1, float(self.kappa[0]))
73-
) * iv(ell, float(self.kappa[1])) * bessel_jl
74-
total2 += iv(j, float(self.kappa[0])) * (
75-
iv(ell + 1, float(self.kappa[1]))
76-
+ iv(ell - 1, float(self.kappa[1]))
77-
) * bessel_jl
70+
(
71+
iv(j + 1, float(self.kappa[0]))
72+
+ iv(j - 1, float(self.kappa[0]))
73+
)
74+
* iv(ell, float(self.kappa[1]))
75+
* bessel_jl
76+
)
77+
total2 += (
78+
iv(j, float(self.kappa[0]))
79+
* (
80+
iv(ell + 1, float(self.kappa[1]))
81+
+ iv(ell - 1, float(self.kappa[1]))
82+
)
83+
* bessel_jl
84+
)
7885
m1 = self.C * 2.0 * pi**2 * total1 * exp(1j * float(self.mu[0]))
7986
m2 = self.C * 2.0 * pi**2 * total2 * exp(1j * float(self.mu[1]))
8087
return array([m1, m2])
@@ -94,18 +101,32 @@ def _correlation_series_sums(self):
94101
jl_half = (j + ell) // 2
95102
jl_diff = (j - ell) // 2
96103
iv_ab = iv(jl_half, (a + b) / 2) * iv(jl_diff, (a - b) / 2)
97-
total0 += iv(j, k0) * iv(ell, k1) * (
98-
(iv(jl_half + 1, (a + b) / 2) + iv(jl_half - 1, (a + b) / 2))
99-
* iv(jl_diff, (a - b) / 2)
100-
- iv(jl_half, (a + b) / 2)
101-
* (iv(jl_diff + 1, (a - b) / 2) + iv(jl_diff - 1, (a - b) / 2))
104+
total0 += (
105+
iv(j, k0)
106+
* iv(ell, k1)
107+
* (
108+
(
109+
iv(jl_half + 1, (a + b) / 2)
110+
+ iv(jl_half - 1, (a + b) / 2)
111+
)
112+
* iv(jl_diff, (a - b) / 2)
113+
- iv(jl_half, (a + b) / 2)
114+
* (
115+
iv(jl_diff + 1, (a - b) / 2)
116+
+ iv(jl_diff - 1, (a - b) / 2)
117+
)
118+
)
102119
)
103120
total1 += (
104-
iv(j + 2, k0) / 2 + iv(j, k0) + iv(j - 2, k0) / 2
105-
) * iv(ell, k1) * iv_ab
106-
total2 += iv(j, k0) * (
107-
iv(ell + 2, k1) / 2 + iv(ell, k1) + iv(ell - 2, k1) / 2
108-
) * iv_ab
121+
(iv(j + 2, k0) / 2 + iv(j, k0) + iv(j - 2, k0) / 2)
122+
* iv(ell, k1)
123+
* iv_ab
124+
)
125+
total2 += (
126+
iv(j, k0)
127+
* (iv(ell + 2, k1) / 2 + iv(ell, k1) + iv(ell - 2, k1) / 2)
128+
* iv_ab
129+
)
109130
return total0, total1, total2
110131

111132
def circular_correlation_jammalamadaka(self):
@@ -123,4 +144,3 @@ def shift(self, shift_by):
123144
self.alpha,
124145
self.beta,
125146
)
126-

pyrecest/tests/distributions/test_toroidal_vm_rivest_distribution.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,8 @@ def test_trigonometric_moment_numerical(self):
5959
def test_trigonometric_moment_n1_vs_numerical(self):
6060
m_analytical = self.dist.trigonometric_moment(1)
6161
m_numerical = self.dist.trigonometric_moment_numerical(1)
62-
npt.assert_allclose(
63-
m_analytical.real, m_numerical.real, atol=1e-4
64-
)
65-
npt.assert_allclose(
66-
m_analytical.imag, m_numerical.imag, atol=1e-4
67-
)
62+
npt.assert_allclose(m_analytical.real, m_numerical.real, atol=1e-4)
63+
npt.assert_allclose(m_analytical.imag, m_numerical.imag, atol=1e-4)
6864

6965
def test_plot_2d(self):
7066
self.dist.plot()

0 commit comments

Comments
 (0)