@@ -119,7 +119,7 @@ def test_coordinates(self):
119119 assert_allclose (
120120 A10CA .position ,
121121 self .ref_coordinates ["A10CA" ],
122- atol = 1e-3 ,
122+ atol = 10 ** ( - self . prec ) ,
123123 rtol = 0 ,
124124 err_msg = "wrong coordinates for A10:CA" ,
125125 )
@@ -131,7 +131,7 @@ def test_distances(self):
131131 assert_allclose (
132132 d ,
133133 self .ref_distances ["endtoend" ],
134- atol = 1e-3 ,
134+ atol = 10 ** ( - self . prec ) ,
135135 rtol = 0 ,
136136 err_msg = "distance between M1:N and G214:C" ,
137137 )
@@ -322,13 +322,13 @@ 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 = 1e-3 , rtol = 0 )
325+ assert_allclose (reader .dt , ref .dt , atol = 10 ** ( - ref . prec ) , 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 ):
331- assert_allclose (reader .totaltime , ref .totaltime , atol = 1e-3 , rtol = 0 )
331+ assert_allclose (reader .totaltime , ref .totaltime , atol = 10 ** ( - ref . prec ) , rtol = 0 )
332332
333333 def test_first_dimensions (self , ref , reader ):
334334 reader .rewind ()
@@ -338,7 +338,7 @@ def test_first_dimensions(self, ref, reader):
338338 assert_allclose (
339339 reader .ts .dimensions ,
340340 ref .dimensions ,
341- atol = 1e-3 ,
341+ atol = 10 ** ( - ref . prec ) ,
342342 rtol = 0 ,
343343 )
344344
@@ -351,7 +351,7 @@ def test_changing_dimensions(self, ref, reader):
351351 assert_allclose (
352352 reader .ts .dimensions ,
353353 ref .dimensions ,
354- atol = 1e-3 ,
354+ atol = 10 ** ( - ref . prec ) ,
355355 rtol = 0 ,
356356 )
357357 reader [1 ]
@@ -361,7 +361,7 @@ def test_changing_dimensions(self, ref, reader):
361361 assert_allclose (
362362 reader .ts .dimensions ,
363363 ref .dimensions_second_frame ,
364- atol = 1e-3 ,
364+ atol = 10 ** ( - ref . prec ) ,
365365 rtol = 0 ,
366366 )
367367
@@ -472,18 +472,18 @@ def test_transformations_2iter(self, ref, transformed):
472472 idealcoords = []
473473 for i , ts in enumerate (transformed ):
474474 idealcoords .append (ref .iter_ts (i ).positions + v1 + v2 )
475- assert_allclose (ts .positions , idealcoords [i ], atol = 1e-3 , rtol = 0 )
475+ assert_allclose (ts .positions , idealcoords [i ], atol = 10 ** ( - ref . prec ) , rtol = 0 )
476476
477477 for i , ts in enumerate (transformed ):
478- assert_allclose (ts .positions , idealcoords [i ], atol = 1e-3 , rtol = 0 )
478+ assert_allclose (ts .positions , idealcoords [i ], atol = 10 ** ( - ref . prec ) , rtol = 0 )
479479
480480 def test_transformations_slice (self , ref , transformed ):
481481 # Are the transformations applied when iterating over a slice of the trajectory?
482482 v1 = np .float32 ((1 , 1 , 1 ))
483483 v2 = np .float32 ((0 , 0 , 0.33 ))
484484 for i , ts in enumerate (transformed [2 :3 :1 ]):
485485 idealcoords = ref .iter_ts (ts .frame ).positions + v1 + v2
486- assert_allclose (ts .positions , idealcoords , atol = 1e-3 , rtol = 0 )
486+ assert_allclose (ts .positions , idealcoords , atol = 10 ** ( - ref . prec ) , rtol = 0 )
487487
488488 def test_transformations_switch_frame (self , ref , transformed ):
489489 # This test checks if the transformations are applied and if the coordinates
@@ -496,37 +496,37 @@ def test_transformations_switch_frame(self, ref, transformed):
496496 assert_allclose (
497497 transformed [0 ].positions ,
498498 first_ideal ,
499- atol = 1e-3 ,
499+ atol = 10 ** ( - ref . prec ) ,
500500 rtol = 0 ,
501501 )
502502 second_ideal = ref .iter_ts (1 ).positions + v1 + v2
503503 assert_allclose (
504504 transformed [1 ].positions ,
505505 second_ideal ,
506- atol = 1e-3 ,
506+ atol = 10 ** ( - ref . prec ) ,
507507 rtol = 0 ,
508508 )
509509
510510 # What if we comeback to the previous frame?
511511 assert_allclose (
512512 transformed [0 ].positions ,
513513 first_ideal ,
514- atol = 1e-3 ,
514+ atol = 10 ** ( - ref . prec ) ,
515515 rtol = 0 ,
516516 )
517517
518518 # How about we switch the frame to itself?
519519 assert_allclose (
520520 transformed [0 ].positions ,
521521 first_ideal ,
522- atol = 1e-3 ,
522+ atol = 10 ** ( - ref . prec ) ,
523523 rtol = 0 ,
524524 )
525525 else :
526526 assert_allclose (
527527 transformed [0 ].positions ,
528528 first_ideal ,
529- atol = 1e-3 ,
529+ atol = 10 ** ( - ref . prec ) ,
530530 rtol = 0 ,
531531 )
532532
@@ -540,7 +540,7 @@ def test_transformation_rewind(self, ref, transformed):
540540 assert_allclose (
541541 transformed [0 ].positions ,
542542 ideal_coords ,
543- atol = 1e-3 ,
543+ atol = 10 ** ( - ref . prec ) ,
544544 rtol = 0 ,
545545 )
546546
@@ -557,7 +557,7 @@ def test_transformations_copy(self, ref, transformed):
557557 )
558558 for i , ts in enumerate (new ):
559559 ideal_coords = ref .iter_ts (i ).positions + v1 + v2
560- assert_allclose (ts .positions , ideal_coords , atol = 1e-3 , rtol = 0 )
560+ assert_allclose (ts .positions , ideal_coords , atol = 10 ** ( - ref . prec ) , rtol = 0 )
561561
562562 def test_add_another_transformations_raises_ValueError (self , transformed ):
563563 # After defining the transformations, the workflow cannot be changed
@@ -834,7 +834,7 @@ def test_write_different_box(self, ref, universe, tmpdir):
834834 assert_allclose (
835835 universe .dimensions ,
836836 ts_w .dimensions ,
837- atol = 1e-3 ,
837+ atol = 10 ** ( - ref . prec ) ,
838838 rtol = 0 ,
839839 )
840840
@@ -878,7 +878,7 @@ def test_write_selection(
878878 assert_allclose (
879879 copy_ts ._pos ,
880880 sel .atoms .positions ,
881- atol = 1e-3 ,
881+ atol = 10 ** ( - ref . prec ) ,
882882 rtol = 0 ,
883883 err_msg = "coordinate mismatch between original and written "
884884 "trajectory at frame {} (orig) vs {} (copy)" .format (
0 commit comments