Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions orbitize/hipparcos.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def __init__(
self.alphadec0_epoch = alphadec0_epoch

self.hip_data = hip_data
self.brandt_correction = brandt_correction

# dvd files don't contain the Hipparcos astrometric solution, so
# we need to look it up
Expand Down Expand Up @@ -371,6 +372,7 @@ def _save(self, hf):
if self.hip_data is not None:
hip_data_group = hf.create_group("hip_data")
hip_data_group.update(self.hip_data)
hf.attrs["brandt_correction"] = self.brandt_correction

def compute_lnlike(self, raoff_model, deoff_model, samples, param_idx):
"""
Expand Down
19 changes: 14 additions & 5 deletions orbitize/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import orbitize.basis
import orbitize.plot
import orbitize.gaia, orbitize.hipparcos
from orbitize import DATADIR

class Results(object):
"""
Expand Down Expand Up @@ -315,14 +316,16 @@ def load_results(self, filename, append=False):
hip_data = {key : hip_data_raw[key][()] for key in hip_data_raw.keys()}
else:
hip_data = None
brandt_correction = bool(hf.attrs.get("brandt_correction", False))

hipparcos_IAD = orbitize.hipparcos.HipparcosLogProb(
tmpfile,
hip_num,
num_secondary_bodies,
alphadec0_epoch,
renormalize_errors,
hip_data,
hip_data=hip_data,
brandt_correction=brandt_correction
)

# load Gaia data
Expand All @@ -339,18 +342,24 @@ def load_results(self, filename, append=False):

# alternatively load HGCA. Note requires hipparcos_IAD attribute
gaiagost_data = hf.get("Gaia_GOST")
hgca_filepath = None
if gaiagost_data is not None:

tmpfile = 'tmpfile_gost_OkToDeleteAfterFitFinishes'
tmptbl = table.Table(np.array(gaiagost_data))
tmptbl.write(tmpfile, format="ascii", overwrite=True)

hgca_entry_raw = hf.get("HGCA_entry")
hgca_entry = None
if hgca_entry_raw is None:
raise KeyError("HGCA Entry not found in {} for initializing HGCALogProb".format(filename))
hgca_entry = {key : hgca_entry_raw[key][()] for key in hgca_entry_raw.keys()}

gaia = orbitize.gaia.HGCALogProb(int(hip_num), hipparcos_IAD, tmpfile, hgca_entry=hgca_entry)
if os.path.exists(os.path.join(DATADIR, "HGCA_vEDR3.fits")):
hgca_filepath = os.path.join(DATADIR, "HGCA_vEDR3.fits")
else:
raise KeyError("HGCA Entry not found in {} for initializing HGCALogProb".format(filename))
else:
hgca_entry = {key : hgca_entry_raw[key][()] for key in hgca_entry_raw.keys()}

gaia = orbitize.gaia.HGCALogProb(int(hip_num), hipparcos_IAD, tmpfile, hgca_filepath=hgca_filepath, hgca_entry=hgca_entry)
hipparcos_IAD = None # HGCA handles hipparocs, so don't want to pass Hipparcos also into the system


Expand Down
6 changes: 3 additions & 3 deletions tests/test_multiplanet.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,12 @@ def test_fit_selfconsist():
samp.curr_pos[0, :, 2] = np.random.normal(c_params[0], 0.01, n_walkers) # sma
samp.curr_pos[0, :, 3] = np.random.normal(c_params[-1], 0.01, n_walkers) # tau
# we will make a fairly broad mass starting position
samp.curr_pos[0, :, 4] = np.random.uniform(mass_b * 0.25, mass_b * 4, n_walkers)
samp.curr_pos[0, :, 5] = np.random.uniform(mass_c * 0.25, mass_c * 4, n_walkers)
samp.curr_pos[0, :, 4] = np.random.uniform(mass_b * 0.5, mass_b * 2, n_walkers)
samp.curr_pos[0, :, 5] = np.random.uniform(mass_c * 0.5, mass_c * 2, n_walkers)
samp.curr_pos[0, 0, 4] = mass_b
samp.curr_pos[0, 0, 5] = mass_c

samp.run_sampler(n_walkers * 200, burn_steps=200)
samp.run_sampler(n_walkers * 1000, burn_steps=1000)

res = samp.results

Expand Down
Loading