From cd0c00a5386e9c7ca5ab0fc9ca2b8aa922f8480d Mon Sep 17 00:00:00 2001 From: Sarah Blunt Date: Tue, 8 Oct 2024 16:13:07 -0700 Subject: [PATCH] mcmc running --- orbitize/system.py | 7 +++++++ tests/test_brightness.py | 11 +++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/orbitize/system.py b/orbitize/system.py index c016b4ba..d2ed093c 100644 --- a/orbitize/system.py +++ b/orbitize/system.py @@ -98,10 +98,15 @@ def __init__( # List of index arrays corresponding to each rv for each body self.rv = [] + # index arrays corresponding to brightness for each body + self.brightness = [] + self.fit_astrometry = True radec_indices = np.where(self.data_table["quant_type"] == "radec") seppa_indices = np.where(self.data_table["quant_type"] == "seppa") + brightness_indices = np.where(~np.isnan(self.data_table["brightness"])) + if len(radec_indices[0]) == 0 and len(seppa_indices[0]) == 0: self.fit_astrometry = False rv_indices = np.where(self.data_table["quant_type"] == "rv") @@ -140,6 +145,7 @@ def __init__( np.intersect1d(self.body_indices[body_num], seppa_indices) ) self.rv.append(np.intersect1d(self.body_indices[body_num], rv_indices)) + self.brightness.append(np.intersect1d(self.body_indices[body_num], brightness_indices)) # we should track the influence of the planet(s) on each other/the star if: # we are not fitting massless planets and @@ -302,6 +308,7 @@ def __init__( self.param_idx = self.basis.param_idx + def save(self, hf): """ Saves the current object to an hdf5 file diff --git a/tests/test_brightness.py b/tests/test_brightness.py index 36afe73e..7f938bdf 100644 --- a/tests/test_brightness.py +++ b/tests/test_brightness.py @@ -120,16 +120,15 @@ def test_compute_posteriors(): ax[1].axis('equal') plt.savefig('visual4farrah.png') - # model = test_system.compute_model(params_arr) + model = test_system.compute_model(params_arr) # print(model) - # test_mcmc = sampler.MCMC(test_system, 1, 50, num_threads=1) - - # test_mcmc.run_sampler(10) + test_mcmc = sampler.MCMC(test_system, 1, 50, num_threads=1) + test_mcmc.run_sampler(10) if __name__ == "__main__": # test_brightness_calculation() #test_read_input_with_brightness() - test_assert_brightness() - # test_compute_posteriors() + # test_assert_brightness() + test_compute_posteriors()