Naut combined#408
Conversation
…d with the Nautilus_Sampler
|
|
||
|
|
||
| def plot_corner(results, param_list=None, **corner_kwargs): | ||
| def plot_corner(results, param_list=None, downsample=None, **corner_kwargs): |
There was a problem hiding this comment.
Nice keyword addition! Can you a unit test that tests whether the corner plot runs with the downsample keyword set? I assume the current unit tests will test the case where the keyword isn't set, but I haven't actually looked-- please check that too.
| else: | ||
| fixed_indices.append(i) | ||
|
|
||
| if downsample: |
| corner_kwargs["labels"] = reduced_labels_list | ||
|
|
||
| figure = corner.corner(samples, **corner_kwargs) | ||
| figure = corner.corner(samples, **corner_kwargs, weights=weights) |
There was a problem hiding this comment.
minor style thing but the weights=weights should go before **corner_kwargs
| test_nautilus_general() | ||
|
|
||
|
|
||
| # TO DO |
There was a problem hiding this comment.
remove these comments or convert to individual # TODO comment lines
| my_sampler = sampler.NautilusSampler(my_system) | ||
|
|
||
| print(f"Running {datafile} sampler {I} with {n_threads} {n_live} {n_update} {sampler_args} {run_args}") | ||
| # Run the sampler to compute some orbits, yeah! |
| @@ -0,0 +1,78 @@ | |||
| import os | |||
| os.environ['OPENBLAS_NUM_THREADS'] = '1' | |||
There was a problem hiding this comment.
it's good to remove os-specific configurations like this in unit tests that will run in a variety of environments (e.g. with a different linear algebra library)
| sampler_args = {"n_networks": 4} | ||
| run_args = {"f_live": 0.01, "n_eff": 10000} | ||
|
|
||
| I = 1 |
There was a problem hiding this comment.
What is this variable needed for?
|
|
||
| my_sampler.results.save_results(results_file) | ||
|
|
||
| # make corner plot |
There was a problem hiding this comment.
I think you can comment this line back in. It's ok to make plots in end-to-end tests.
There was a problem hiding this comment.
I'd probably recommend removing the OFTI end-to-end test and one of the two nautilus end-to-end tests from the main code branch here. You should certainly maintain these in a different repository along with any code you wrote to analyze the outputs of the code, but we probably only need one e2e test of this kind in the main repository.
| data (astropy.table.Table): output from ``orbitize.read_input.read_file()`` | ||
| curr_pos (np.array of float): for MCMC only. A multi-D array of the | ||
| current walker positions that is used for restarting a MCMC sampler. | ||
| weighted_post (np.array of float): RxN array of orbital parameters |
There was a problem hiding this comment.
Nice! Please add a unit test for saving and loading results objects created by nautilus.
| orbits we need model predictions for. It returns ``clnlikes`` | ||
| which is an array of length M, or it can be a single float if M = 1. | ||
|
|
||
| Thea McKenna, Sarah Blunt, & Lea Hirsch 2024 |
There was a problem hiding this comment.
Make sure to update the docstrings to a) give yourselves appropriate credit for code you wrote, and b) make sure you're referring to nautilus and not dynesty
| self.start = time.time() | ||
|
|
||
| def nautilus_ptform(self, u): | ||
| return self.ptform(u.T).T |
There was a problem hiding this comment.
nice catch on the differing dimension conventions here.
| Class distribution. | ||
| """ | ||
| utform = np.zeros(u.shape) | ||
| for i in range(u.shape[0]): |
There was a problem hiding this comment.
Did your vectorized version not make it in here?
No description provided.