Skip to content

Commit

Permalink
Fix pickle pathing
Browse files Browse the repository at this point in the history
  • Loading branch information
Zack Singer committed Nov 17, 2023
1 parent e6bf943 commit f92af5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Binary file added tests/data/inverse_distortion_in_out.pkl
Binary file not shown.
9 changes: 5 additions & 4 deletions tests/test_inverse_distortion.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import os
import pickle

import numpy as np
import sys
sys.path.append('..')
from hexrd.extensions import inverse_distortion

test_dir = os.path.dirname(os.path.abspath(__file__))

RHO_MAX = 204.8
params = [-2.277777438488093e-05, -8.763805995117837e-05, -0.00047451698761967085]

Expand Down Expand Up @@ -82,7 +83,7 @@ def test_large_input():

def test_logged_data():
# Load logged data
with open('data/inverse_distortion_in_out.pkl', 'rb') as f:
with open(os.path.join(test_dir, "data", "inverse_distortion_in_out.pkl"), 'rb') as f:
logged_data = pickle.load(f)

logged_inputs = logged_data['inputs']
Expand All @@ -91,7 +92,7 @@ def test_logged_data():

for xy_in, xy_out_expected, params in zip(logged_inputs, logged_outputs, logged_params):
xy_out = inverse_distortion.ge_41rt_inverse_distortion(xy_in, RHO_MAX, params)
assert np.allclose(xy_out, xy_out_expected, atol=1e-6)
assert np.allclose(xy_out, xy_out_expected, atol=1e-7)

def test_random_values():
np.random.seed(42)
Expand Down

0 comments on commit f92af5b

Please sign in to comment.