Skip to content

Commit b1213b1

Browse files
[pre-commit.ci] auto fixes from pre-commit hooks
1 parent ebfd3ed commit b1213b1

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

doc/source/examples/resampleexample.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,3 @@ given enough datapoints.
8585
qmin = 0
8686
qmax = 25
8787
nickel_resample = (nickel_grid, nickel_func, qmin, qmax)
88-

src/diffpy/utils/resampler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def nsinterp(xp, fp, qmin=0, qmax=25, left=None, right=None):
109109
rmin = np.min(xp)
110110
rmax = np.max(xp)
111111

112-
nspoints = int(np.round((qmax-qmin)*(rmax-rmin)/np.pi))
112+
nspoints = int(np.round((qmax - qmin) * (rmax - rmin) / np.pi))
113113

114114
x = np.linspace(rmin, rmax, nspoints)
115115
fp_at_x = wsinterp(x, xp, fp)

tests/test_resample.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numpy as np
44
import pytest
55

6-
from diffpy.utils.resampler import wsinterp, nsinterp
6+
from diffpy.utils.resampler import nsinterp, wsinterp
77

88

99
def test_wsinterp():
@@ -34,18 +34,18 @@ def test_wsinterp():
3434

3535
def test_nsinterp():
3636
# Create a cosine function cos(2x) for x \in [0, 3pi]
37-
xp = np.linspace(0, 3*np.pi, 100)
37+
xp = np.linspace(0, 3 * np.pi, 100)
3838
fp = np.cos(2 * xp)
3939

4040
# Want to resample onto the grid {0, pi, 2pi, 3pi}
41-
x = np.array([0, np.pi, 2*np.pi, 3*np.pi])
41+
x = np.array([0, np.pi, 2 * np.pi, 3 * np.pi])
4242

4343
# Get wsinterp result
4444
ws_f = wsinterp(x, xp, fp)
4545

4646
# Use nsinterp with qmin-qmax=4/3
4747
qmin = np.random.uniform()
48-
qmax = qmin + 4/3
48+
qmax = qmin + 4 / 3
4949
ns_x, ns_f = nsinterp(xp, fp, qmin, qmax)
5050

5151
assert np.allclose(x, ns_x)

0 commit comments

Comments
 (0)