Skip to content

Commit

Permalink
Merge pull request #262 from sblunt/bugfix-results
Browse files Browse the repository at this point in the history
use astropy tables in results to address #256
  • Loading branch information
sblunt committed Sep 3, 2021
2 parents ec133de + 554bf4f commit 391c744
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions orbitize/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import astropy.constants as consts
from astropy.io import fits
from astropy.time import Time
import astropy.table as table
from erfa import ErfaWarning

import matplotlib as mpl
Expand Down Expand Up @@ -207,8 +208,8 @@ def load_results(self, filename, append=False):
version_number = "<= 1.13"
post = np.array(hf.get('post'))
lnlike = np.array(hf.get('lnlike'))
data=np.array(hf.get('data'))
self.data=data
data = np.array(hf.get('data'))
self.data = table.Table(data) # turn back into astropy table, also keeps str formatted right

# get the tau reference epoch
try:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ def test_save_and_load_results(results_to_test, has_lnlike=True):
# check tau reference epoch is stored
assert loaded_results.tau_ref_epoch == 50000

# check that str fields are indeed strs
# checking just one str entry probably is good enough
assert isinstance(loaded_results.data['quant_type'][0], str)

# Clean up: Remove save file
os.remove(save_filename)

Expand Down

0 comments on commit 391c744

Please sign in to comment.