Skip to content

Commit

Permalink
Update test_align.py
Browse files Browse the repository at this point in the history
fixing pep
  • Loading branch information
talagayev authored Oct 18, 2024
1 parent 0796f48 commit 7023aa1
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions testsuite/MDAnalysisTests/analysis/test_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def test_average_structure_deprecated_attrs(
):
# Issue #3278 - remove in MDAnalysis 3.0.0
avg = align.AverageStructure(universe, reference).run(
stop=2,**client_AverageStructure
stop=2, **client_AverageStructure
)

wmsg = "The `universe` attribute was deprecated in MDAnalysis 2.0.0"
Expand Down Expand Up @@ -503,7 +503,9 @@ def test_average_structure_mass_weighted(
self, universe, reference, client_AverageStructure
):
ref, rmsd = _get_aligned_average_positions(self.ref_files, reference, weights='mass')
avg = align.AverageStructure(universe, reference, weights='mass').run(**client_AverageStructure)
avg = align.AverageStructure(universe, reference, weights='mass').run(
**client_AverageStructure
)
assert_allclose(avg.results.universe.atoms.positions, ref,
rtol=0, atol=1.5e-4)
assert_allclose(avg.results.rmsd, rmsd, rtol=0, atol=1.5e-7)
Expand All @@ -513,8 +515,9 @@ def test_average_structure_select(
):
select = 'protein and name CA and resid 3-5'
ref, rmsd = _get_aligned_average_positions(self.ref_files, reference, select=select)
avg = align.AverageStructure(universe, reference,
select=select).run(**client_AverageStructure)
avg = align.AverageStructure(universe, reference, select=select).run(
**client_AverageStructure
)
assert_allclose(avg.results.universe.atoms.positions, ref,
rtol=0, atol=1.5e-4)
assert_allclose(avg.results.rmsd, rmsd, rtol=0, atol=1.5e-7)
Expand All @@ -535,7 +538,9 @@ def test_mismatch_atoms(self, universe):
with pytest.raises(SelectionError):
align.AverageStructure(universe, u)

def test_average_structure_ref_frame(self, universe, client_AverageStructure):
def test_average_structure_ref_frame(
self, universe, client_AverageStructure
):
ref_frame = 3
u = mda.Merge(universe.atoms)

Expand All @@ -546,17 +551,19 @@ def test_average_structure_ref_frame(self, universe, client_AverageStructure):
# back to start
universe.trajectory[0]
ref, rmsd = _get_aligned_average_positions(self.ref_files, u)
avg = align.AverageStructure(universe,
ref_frame=ref_frame).run(**client_AverageStructure)
avg = align.AverageStructure(universe, ref_frame=ref_frame).run(
**client_AverageStructure
)
assert_allclose(avg.results.universe.atoms.positions, ref,
rtol=0, atol=1.5e-4)
assert_allclose(avg.results.rmsd, rmsd, rtol=0, atol=1.5e-7)

def test_average_structure_in_memory(
self, universe, client_AverageStructure
):
avg = align.AverageStructure(universe,
in_memory=True).run(**client_AverageStructure)
avg = align.AverageStructure(universe, in_memory=True).run(
**client_AverageStructure
)
reference_coordinates = universe.trajectory.timeseries().mean(axis=1)
assert_allclose(avg.results.universe.atoms.positions,
reference_coordinates, rtol=0, atol=1.5e-4)
Expand Down

0 comments on commit 7023aa1

Please sign in to comment.