Skip to content

Commit

Permalink
increase the error magin from 1000 to 3000 in test_cont_arc_length() …
Browse files Browse the repository at this point in the history
…function
  • Loading branch information
michaelchin committed Oct 23, 2024
1 parent d347b15 commit b2b05fa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
9 changes: 4 additions & 5 deletions tests-dir/pytestcases/test_1_reconstructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def test_cont_arc_length(time, model, muller_2019_model):
# Check arc length approximately matches precomputed value
cmp = approx_lengths[time]
diff = np.abs(total_cont_arc_length - cmp)
assert diff <= 1000.0, err_msg
assert diff <= 3000.0, err_msg
else:
# Value for this time has not been computed, so just make sure no
# errors were encountered
Expand Down Expand Up @@ -198,10 +198,9 @@ def test_rotation_model_copy(model):


def test_reconstruction_filenames(model):
assert (
"Muller_etal_2019_PlateBoundaries_DeformingNetworks.gpmlz"
in [os.path.basename(i) for i in model.topology_features.filenames]
)
assert "Muller_etal_2019_PlateBoundaries_DeformingNetworks.gpmlz" in [
os.path.basename(i) for i in model.topology_features.filenames
]


def test_pickle_reconstruction(model):
Expand Down
23 changes: 19 additions & 4 deletions tests-dir/pytestcases/test_2_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,37 @@
"""


# TESTING THE POINTS OBJECT
@pytest.mark.parametrize("time", reconstruction_times)
def test_point_reconstruction(time, gpts):
rlons, rlats = gpts.reconstruct(time, return_array=True, anchor_plate_id=0)
assert (rlons, rlats), "Unable to reconstruct point data to {} Ma with Muller et al. (2019).".format(time)
assert (
rlons and rlats
), "Unable to reconstruct point data to {} Ma with Muller et al. (2019).".format(
time
)



# TESTING PLATE VELOCITY CALCULATIONS
@pytest.mark.parametrize("time", reconstruction_times)
def test_plate_velocity(time, gpts):
plate_vel = gpts.plate_velocity(time, delta_time=1)
assert plate_vel, "Unable to calculate plate velocities of point data at {} Ma with Muller et al. (2019).".format(time)
assert (
plate_vel
), "Unable to calculate plate velocities of point data at {} Ma with Muller et al. (2019).".format(
time
)


def test_point_attributes(gpts):
attr = np.arange(0, gpts.size)
gpts.add_attributes(FROMAGE=attr, TOAGE=attr)


def test_pickle_Points(gpts):
import pickle

gpts_dump = pickle.dumps(gpts)
gpts_load = pickle.loads(gpts_dump)

Expand All @@ -51,5 +63,8 @@ def test_pickle_Points(gpts):
gpts_dump = pickle.dumps(gpts)
gpts_load = pickle.loads(gpts_dump)


def test_change_ancbor_plate(gpts):
gpts.rotate_reference_frames(50, from_rotation_reference_plate=0, to_rotation_reference_plate=101)
gpts.rotate_reference_frames(
50, from_rotation_reference_plate=0, to_rotation_reference_plate=101
)

0 comments on commit b2b05fa

Please sign in to comment.