Skip to content

Commit 26727b5

Browse files
author
Kushagar garg
committed
style: standardize precision to 1e-3 and fix author order
1 parent e1ee51d commit 26727b5

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

package/AUTHORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ Chronological list of authors
263263
- Amruthesh Thirumalaiswamy
264264
- Ch Zhang
265265
- Raúl Lois-Cuns
266-
- Kushagar Garg
267266
- Shreejan Dolai
267+
- Kushagar Garg
268268

269269
External code
270270
-------------

testsuite/MDAnalysisTests/coordinates/base.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def test_distances(self):
131131
assert_allclose(
132132
d,
133133
self.ref_distances["endtoend"],
134-
atol=10 ** (-self.prec),
134+
atol=1e-3,
135135
rtol=0,
136136
err_msg="distance between M1:N and G214:C",
137137
)
@@ -322,14 +322,14 @@ def test_get_writer_2(self, ref, reader, tmpdir):
322322
assert_equal(W.n_atoms, 100)
323323

324324
def test_dt(self, ref, reader):
325-
assert_allclose(reader.dt, ref.dt, atol=10 ** (-ref.prec), rtol=0)
325+
assert_allclose(reader.dt, ref.dt, atol=1e-3, rtol=0)
326326

327327
def test_ts_dt_matches_reader(self, reader):
328328
assert_equal(reader.ts.dt, reader.dt)
329329

330330
def test_total_time(self, ref, reader):
331331
assert_allclose(
332-
reader.totaltime, ref.totaltime, atol=10 ** (-ref.prec), rtol=0
332+
reader.totaltime, ref.totaltime, atol=1e-3, rtol=0
333333
)
334334

335335
def test_first_dimensions(self, ref, reader):
@@ -340,7 +340,7 @@ def test_first_dimensions(self, ref, reader):
340340
assert_allclose(
341341
reader.ts.dimensions,
342342
ref.dimensions,
343-
atol=10 ** (-ref.prec),
343+
atol=1e-3,
344344
rtol=0,
345345
)
346346

@@ -353,7 +353,7 @@ def test_changing_dimensions(self, ref, reader):
353353
assert_allclose(
354354
reader.ts.dimensions,
355355
ref.dimensions,
356-
atol=10 ** (-ref.prec),
356+
atol=1e-3,
357357
rtol=0,
358358
)
359359
reader[1]
@@ -363,7 +363,7 @@ def test_changing_dimensions(self, ref, reader):
363363
assert_allclose(
364364
reader.ts.dimensions,
365365
ref.dimensions_second_frame,
366-
atol=10 ** (-ref.prec),
366+
atol=1e-3,
367367
rtol=0,
368368
)
369369

@@ -465,7 +465,7 @@ def test_transformations_iter(self, ref, transformed):
465465
for i, ts in enumerate(transformed):
466466
idealcoords = ref.iter_ts(i).positions + v1 + v2
467467
assert_allclose(
468-
ts.positions, idealcoords, atol=10 ** (-ref.prec), rtol=0
468+
ts.positions, idealcoords, atol=1e-3, rtol=0
469469
)
470470

471471
def test_transformations_2iter(self, ref, transformed):
@@ -477,12 +477,12 @@ def test_transformations_2iter(self, ref, transformed):
477477
for i, ts in enumerate(transformed):
478478
idealcoords.append(ref.iter_ts(i).positions + v1 + v2)
479479
assert_allclose(
480-
ts.positions, idealcoords[i], atol=10 ** (-ref.prec), rtol=0
480+
ts.positions, idealcoords[i], atol=1e-3, rtol=0
481481
)
482482

483483
for i, ts in enumerate(transformed):
484484
assert_allclose(
485-
ts.positions, idealcoords[i], atol=10 ** (-ref.prec), rtol=0
485+
ts.positions, idealcoords[i], atol=1e-3, rtol=0
486486
)
487487

488488
def test_transformations_slice(self, ref, transformed):
@@ -492,7 +492,7 @@ def test_transformations_slice(self, ref, transformed):
492492
for i, ts in enumerate(transformed[2:3:1]):
493493
idealcoords = ref.iter_ts(ts.frame).positions + v1 + v2
494494
assert_allclose(
495-
ts.positions, idealcoords, atol=10 ** (-ref.prec), rtol=0
495+
ts.positions, idealcoords, atol=1e-3, rtol=0
496496
)
497497

498498
def test_transformations_switch_frame(self, ref, transformed):
@@ -506,37 +506,37 @@ def test_transformations_switch_frame(self, ref, transformed):
506506
assert_allclose(
507507
transformed[0].positions,
508508
first_ideal,
509-
atol=10 ** (-ref.prec),
509+
atol=1e-3,
510510
rtol=0,
511511
)
512512
second_ideal = ref.iter_ts(1).positions + v1 + v2
513513
assert_allclose(
514514
transformed[1].positions,
515515
second_ideal,
516-
atol=10 ** (-ref.prec),
516+
atol=1e-3,
517517
rtol=0,
518518
)
519519

520520
# What if we comeback to the previous frame?
521521
assert_allclose(
522522
transformed[0].positions,
523523
first_ideal,
524-
atol=10 ** (-ref.prec),
524+
atol=1e-3,
525525
rtol=0,
526526
)
527527

528528
# How about we switch the frame to itself?
529529
assert_allclose(
530530
transformed[0].positions,
531531
first_ideal,
532-
atol=10 ** (-ref.prec),
532+
atol=1e-3,
533533
rtol=0,
534534
)
535535
else:
536536
assert_allclose(
537537
transformed[0].positions,
538538
first_ideal,
539-
atol=10 ** (-ref.prec),
539+
atol=1e-3,
540540
rtol=0,
541541
)
542542

@@ -550,7 +550,7 @@ def test_transformation_rewind(self, ref, transformed):
550550
assert_allclose(
551551
transformed[0].positions,
552552
ideal_coords,
553-
atol=10 ** (-ref.prec),
553+
atol=1e-3,
554554
rtol=0,
555555
)
556556

@@ -568,7 +568,7 @@ def test_transformations_copy(self, ref, transformed):
568568
for i, ts in enumerate(new):
569569
ideal_coords = ref.iter_ts(i).positions + v1 + v2
570570
assert_allclose(
571-
ts.positions, ideal_coords, atol=10 ** (-ref.prec), rtol=0
571+
ts.positions, ideal_coords, atol=1e-3, rtol=0
572572
)
573573

574574
def test_add_another_transformations_raises_ValueError(self, transformed):
@@ -846,7 +846,7 @@ def test_write_different_box(self, ref, universe, tmpdir):
846846
assert_allclose(
847847
universe.dimensions,
848848
ts_w.dimensions,
849-
atol=10 ** (-ref.prec),
849+
atol=1e-3,
850850
rtol=0,
851851
)
852852

@@ -890,7 +890,7 @@ def test_write_selection(
890890
assert_allclose(
891891
copy_ts._pos,
892892
sel.atoms.positions,
893-
atol=10 ** (-ref.prec),
893+
atol=1e-3,
894894
rtol=0,
895895
err_msg="coordinate mismatch between original and written "
896896
"trajectory at frame {} (orig) vs {} (copy)".format(

0 commit comments

Comments
 (0)