Compare commits
4 Commits
87ffa1e67e
...
5c17e04b38
Author | SHA1 | Date | |
---|---|---|---|
5c17e04b38 | |||
16233e2f2c | |||
62705da6f3 | |||
b4486ff265 |
@ -10,4 +10,5 @@ dependencies = [
|
|||||||
"pandas",
|
"pandas",
|
||||||
"dask",
|
"dask",
|
||||||
"pathos",
|
"pathos",
|
||||||
|
"tables"
|
||||||
]
|
]
|
||||||
|
@ -261,6 +261,7 @@ class CoordinatesMap:
|
|||||||
self.frames = self.coordinates.frames
|
self.frames = self.coordinates.frames
|
||||||
self.atom_subset = self.coordinates.atom_subset
|
self.atom_subset = self.coordinates.atom_subset
|
||||||
self.function = function
|
self.function = function
|
||||||
|
self._slice = slice(None)
|
||||||
if isinstance(function, partial):
|
if isinstance(function, partial):
|
||||||
self._description = self.function.func.__name__
|
self._description = self.function.func.__name__
|
||||||
else:
|
else:
|
||||||
|
@ -5,11 +5,11 @@ import numpy as np
|
|||||||
|
|
||||||
def test_checksum():
|
def test_checksum():
|
||||||
salt = checksum.SALT
|
salt = checksum.SALT
|
||||||
checksum.SALT = ''
|
checksum.SALT = ""
|
||||||
assert checksum.checksum(1) == 304942582444936629325699363757435820077590259883
|
assert checksum.checksum(1) == 304942582444936629325699363757435820077590259883
|
||||||
assert checksum.checksum('42') == checksum.checksum(42)
|
assert checksum.checksum("42") == checksum.checksum(42)
|
||||||
cs1 = checksum.checksum(999)
|
cs1 = checksum.checksum(999)
|
||||||
checksum.SALT = '999'
|
checksum.SALT = "999"
|
||||||
assert cs1 != checksum.checksum(999)
|
assert cs1 != checksum.checksum(999)
|
||||||
|
|
||||||
a = np.array([1, 2, 3])
|
a = np.array([1, 2, 3])
|
||||||
@ -19,7 +19,6 @@ def test_checksum():
|
|||||||
|
|
||||||
|
|
||||||
def test_version():
|
def test_version():
|
||||||
|
|
||||||
@checksum.version(1)
|
@checksum.version(1)
|
||||||
def f1():
|
def f1():
|
||||||
pass
|
pass
|
||||||
|
@ -7,7 +7,7 @@ from mdevaluate import coordinates
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def trajectory(request):
|
def trajectory(request):
|
||||||
return mdevaluate.open(os.path.join(os.path.dirname(__file__), 'data/water'))
|
return mdevaluate.open(os.path.join(os.path.dirname(__file__), "data/water"))
|
||||||
|
|
||||||
|
|
||||||
def test_coordinates_getitem(trajectory):
|
def test_coordinates_getitem(trajectory):
|
||||||
|
@ -9,6 +9,6 @@ def test_pbc_diff():
|
|||||||
y = np.random.rand(10, 3)
|
y = np.random.rand(10, 3)
|
||||||
box = np.ones((3,))
|
box = np.ones((3,))
|
||||||
|
|
||||||
assert (pbc.pbc_diff(x, x, box) == approx(0))
|
assert pbc.pbc_diff(x, x, box) == approx(0)
|
||||||
dxy = (pbc.pbc_diff(x, y, box) ** 2).sum(axis=1) ** 0.5
|
dxy = (pbc.pbc_diff(x, y, box) ** 2).sum(axis=1) ** 0.5
|
||||||
assert (dxy <= 0.75**0.5).all()
|
assert (dxy <= 0.75**0.5).all()
|
||||||
|
@ -8,7 +8,7 @@ from mdevaluate import utils
|
|||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def logdata(request):
|
def logdata(request):
|
||||||
xdata = np.logspace(-1, 3, 50)
|
xdata = np.logspace(-1, 3, 50)
|
||||||
ydata = np.exp(- (xdata)**0.7)
|
ydata = np.exp(-((xdata) ** 0.7))
|
||||||
return xdata, ydata
|
return xdata, ydata
|
||||||
|
|
||||||
|
|
||||||
@ -18,16 +18,16 @@ def test_filon_fourier_transformation(logdata):
|
|||||||
xdata_zero = copy(xdata)
|
xdata_zero = copy(xdata)
|
||||||
xdata_zero[0] = 0
|
xdata_zero[0] = 0
|
||||||
_, filon = utils.filon_fourier_transformation(xdata_zero, ydata)
|
_, filon = utils.filon_fourier_transformation(xdata_zero, ydata)
|
||||||
assert not np.isnan(filon).any(), 'There are NaN values in the filon result!'
|
assert not np.isnan(filon).any(), "There are NaN values in the filon result!"
|
||||||
|
|
||||||
freqs = np.logspace(-4, 1)
|
freqs = np.logspace(-4, 1)
|
||||||
filon_freqs, filon_imag = utils.filon_fourier_transformation(
|
filon_freqs, filon_imag = utils.filon_fourier_transformation(
|
||||||
xdata, xdata, frequencies=freqs, derivative='linear', imag=True
|
xdata, xdata, frequencies=freqs, derivative="linear", imag=True
|
||||||
)
|
)
|
||||||
|
|
||||||
assert (freqs == filon_freqs).all()
|
assert (freqs == filon_freqs).all()
|
||||||
|
|
||||||
freqs, filon_real = utils.filon_fourier_transformation(
|
freqs, filon_real = utils.filon_fourier_transformation(
|
||||||
xdata, xdata, frequencies=freqs, derivative='linear', imag=False
|
xdata, xdata, frequencies=freqs, derivative="linear", imag=False
|
||||||
)
|
)
|
||||||
assert np.isclose(filon_imag.real, filon_real).all()
|
assert np.isclose(filon_imag.real, filon_real).all()
|
||||||
|
Loading…
Reference in New Issue
Block a user