Compare commits

...

4 Commits

Author SHA1 Message Date
5c17e04b38 Added tables to dependencies 2024-01-23 10:09:11 +01:00
16233e2f2c Merge branch 'mdeval_dev'
# Conflicts:
#	.gitignore
#	doc/conf.py
#	examples/plot_chi4.py
#	examples/plot_isf.py
#	examples/plot_spatialisf.py
#	examples/plot_temperature.py
#	src/mdevaluate/cli.py
#	src/mdevaluate/correlation.py
#	src/mdevaluate/distribution.py
#	src/mdevaluate/functions.py
#	test/test_atoms.py
2024-01-16 16:54:54 +01:00
62705da6f3 Moved files and reformatted some 2023-12-18 14:47:22 +01:00
b4486ff265 Added slices to CoordinatesMap 2023-12-06 15:44:33 +01:00
6 changed files with 14 additions and 13 deletions

View File

@ -10,4 +10,5 @@ dependencies = [
"pandas", "pandas",
"dask", "dask",
"pathos", "pathos",
"tables"
] ]

View File

@ -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:

View File

@ -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

View File

@ -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):

View File

@ -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()

View File

@ -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()