nespinoza / juliet

A versatile modelling tool for transiting and non-transiting (single and multiple) exoplanetary systems
MIT License
55 stars 30 forks source link

Error when using example code in documentation and dynesty #93

Closed karlmtr closed 1 year ago

karlmtr commented 1 year ago

When using the example code provided in the documentation (https://juliet.readthedocs.io/en/latest/tutorials/transitfits.html#lightcurve-fitting-with-juliet), the following error appears :

AttributeError: type object 'NestedSampler' has no attribute '__code__'. Did you mean: '__doc__'?

I looked at where the error was coming from, and it would be due to a simple mistake coming from the fact that the dunder method __code__ is applied to the the DynestySampler object instead of the __init__ method. Making the following changes solved the problem :

https://github.com/nespinoza/juliet/blob/75d54a61d64b38e048ca68894e8238666d249d39/juliet/fit.py#L1660

- args = DynestySampler.__code__.co_varnames
+ args = DynestySampler.__init__.__code__.co_varnames 
Witchblade101 commented 1 year ago

Thanks! I was just going to report this same error.

nespinoza commented 1 year ago

Hi folks --- sorry about this. It's a dynesty change that is not backcompatible. Haven't had the time to update this yet, but also related to this other error. If you downgrade dynesty to 1.2.2 it works: https://github.com/nespinoza/juliet/issues/89

JonasKemmer commented 1 year ago

Hey Nestor, I also experienced this issue and found a workaround that is independent of the dynesty version (since I think there are some important bug fixes in the newer dynesty versions). Instead of calling DynestySampler.__code__.co_varnames I would recommend you using vars(DynestySampler).keys()

Best Jonas

nespinoza commented 1 year ago

This was solved in #98 by @andres-jordan --- closing!