Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tanishy7777 committed Jan 20, 2025
1 parent 3f24903 commit 18a2e51
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions testsuite/MDAnalysisTests/analysis/test_msd.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ def test_fft_vs_simple_default_per_particle(self, msd, msd_fft):
assert_almost_equal(per_particle_simple, per_particle_fft, decimal=4)

@pytest.mark.parametrize("dim", ["xyz", "xy", "xz", "yz", "x", "y", "z"])
def test_fft_vs_simple_all_dims(self, u, SELECTION, dim, client_EinsteinMSD):
def test_fft_vs_simple_all_dims(
self, u, SELECTION, dim, client_EinsteinMSD
):
# check fft and simple give same result for each dimensionality
m_simple = MSD(u, SELECTION, msd_type=dim, fft=False)
m_simple.run(**client_EinsteinMSD)
Expand All @@ -205,7 +207,9 @@ def test_fft_vs_simple_all_dims(self, u, SELECTION, dim, client_EinsteinMSD):
assert_almost_equal(timeseries_simple, timeseries_fft, decimal=4)

@pytest.mark.parametrize("dim", ["xyz", "xy", "xz", "yz", "x", "y", "z"])
def test_fft_vs_simple_all_dims_per_particle(self, u, SELECTION, dim, client_EinsteinMSD):
def test_fft_vs_simple_all_dims_per_particle(
self, u, SELECTION, dim, client_EinsteinMSD
):
# check fft and simple give same result for each particle in each
# dimension
m_simple = MSD(u, SELECTION, msd_type=dim, fft=False)
Expand All @@ -228,7 +232,9 @@ def test_fft_vs_simple_all_dims_per_particle(self, u, SELECTION, dim, client_Ein
("z", 1),
],
)
def test_fft_step_traj_all_dims(self, step_traj, NSTEP, dim, dim_factor, client_EinsteinMSD):
def test_fft_step_traj_all_dims(
self, step_traj, NSTEP, dim, dim_factor, client_EinsteinMSD
):
# testing the fft algorithm on constant velocity trajectory
# this should fit the polynomial y=dim_factor*x**2
# fft based tests require a slight decrease in expected prescision
Expand Down Expand Up @@ -272,22 +278,26 @@ def test_random_walk_u_fft(self, random_walk_u, client_EinsteinMSD):
norm = np.linalg.norm(msd_rw.results.timeseries)
val = 3932.39927487146
assert_almost_equal(norm, val, decimal=5)



@pytest.mark.parametrize(
"classname,is_parallelizable",
[
(mda.analysis.msd, True),
]
],
)
def test_class_is_parallelizable(classname, is_parallelizable):
assert classname.EinsteinMSD._analysis_algorithm_is_parallelizable == is_parallelizable
assert (
classname.EinsteinMSD._analysis_algorithm_is_parallelizable
== is_parallelizable
)


@pytest.mark.parametrize(
"classname,backends",
[
(mda.analysis.msd, ('serial', 'multiprocessing', 'dask')),
]
(mda.analysis.msd, ("serial", "multiprocessing", "dask")),
],
)
def test_supported_backends(classname, backends):
assert classname.EinsteinMSD.get_supported_backends() == backends

0 comments on commit 18a2e51

Please sign in to comment.