tomasstolker / species

Toolkit for atmospheric characterization of directly imaged exoplanets
https://species.readthedocs.io
MIT License
22 stars 10 forks source link

Add AtmosphericRetrieval.run_dynesty #85

Closed wbalmer closed 7 months ago

wbalmer commented 7 months ago

Hi Tomas,

As mentioned in #84 , this is my current implementation of run_dynesty. I'm opening this PR to keep track of my remaining to-do items, which are

I'm not sure if the try, except, warning for the dynesty and schwimmbad imports are necessary like they are for multinest, but I added them in case. I also just went with making the passing of bounds, prior, etc implicit in the _lnprior_dynesty and _lnlikelihood_dynesty functions, as opposed to explicit parameters that would need to be passed as prior_args and loglike_args to the sampler object.

My apologies that the branch/PR contains some past commits from the add_gradient_pt branch, I began working on this branch before those were merged to main. I believe this branch is up to date with main and these commits can be squashed down.

tomasstolker commented 7 months ago

Fantastic, thanks a lot William!

With the current setup, we could probably call _prior_transform and lnlike_func directly and remove _lnprior_dynesty and _lnlike_dynesty?

The try-except for the import may indeed not be needed since pip installing of the two packages should probably not cause a problem? You can add them to the requirements.txt file.

wbalmer commented 7 months ago

Alright, I think everything on my to-do and the changes you've mentioned has been implemented :) I went ahead and deleted _lnprior_dynesty and _lnlikelihood_dynesty and called them + their args directly when creating the dynesty.NestedSamplers. I've tested that this runs even on my impossible to figure out cluster with mpirun and schwimmbad.MPIPool.

Let me know if anything looks off!