-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add pickle support * Drop py38, add py312 * skip install on macos * install in local dir on osx
- Loading branch information
1 parent
9610bac
commit c6fb3ea
Showing
4 changed files
with
82 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python | ||
|
||
import pickle | ||
import unittest | ||
import photospline | ||
|
||
import numpy as np | ||
|
||
from pathlib import Path | ||
|
||
|
||
class TestEvaluation(unittest.TestCase): | ||
def setUp(self): | ||
self.testdata = Path(__file__).parent / "test_data" | ||
self.spline = photospline.SplineTable(self.testdata / "test_spline_4d.fits") | ||
extents = np.array(self.spline.extents) | ||
loc = extents[:, :1] | ||
scale = np.diff(extents, axis=1) | ||
self.x = (np.random.uniform(0, 1, size=(self.spline.ndim, 10)) + loc) * scale | ||
|
||
def test_pickle(self): | ||
restored = pickle.loads(pickle.dumps(self.spline)) | ||
np.testing.assert_allclose(self.spline.evaluate_simple(self.x), restored.evaluate_simple(self.x), rtol=0, atol=0) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |