exoplanet-dev / exoplanet

Fast & scalable MCMC for all your exoplanet needs!
https://docs.exoplanet.codes
MIT License
206 stars 52 forks source link

version print and citations failing (limb darkening, fatal) #233

Closed alexteachey closed 3 years ago

alexteachey commented 3 years ago

I'm following the transit fitting demo here. I am running the latest version of exoplanet, and I don't see any dependency conflicts / breakdowns in the traceback. Happy to provide any information you think might be relevant. Thanks in advance for any thoughts / suggestions / fixes.

Running into two issues. The first is less serious than the second.

1) Printing the exoplanet version results in a failure.

exoplanet.utils.docs_setup()
print(f"exoplanet.__version__ = '{exoplanet.__version__}'")

Throws an error: AttributeError: module 'exoplanet.utils' has no attribute 'docs_setup'

2) A more serious breakdown occurs when limb darkening is invoked -- it can't find the citation, so the model can't be generated. The breakdown occurs here:

    # Compute a limb-darkened light curve using starry 
    t = np.linspace(-0.1, 0.1, 1000) 
    u = [0.3, 0.2] 
    light_curve = ( 
        xo.LimbDarkLightCurve(*u)
        .get_light_curve(orbit=orbit, r=0.1, t=t, texp=0.02) 
        .eval()
    ) 

Just copy/pasted from the demo. Results in:

----> 1 exec(open('dfm_exoplanet_transit_modeling_demo.py').read())

<string> in <module>

~/anaconda3/envs/dfm_exoplanet2/lib/python3.8/site-packages/exoplanet/light_curves/limb_dark.py in __init__(self, u, model)
     24 
     25     def __init__(self, u, model=None):`
---> 26         add_citations_to_model(self.__citations__, model=model)`
     27         self.u = as_tensor_variable(u)`
     28         u_ext = tt.concatenate([-1 + tt.zeros(1, dtype=self.u.dtype), self.u])`

~/anaconda3/envs/dfm_exoplanet2/lib/python3.8/site-packages/exoplanet/citations.py in add_citations_to_model(citations, model)`
     13         model = pm.modelcontext(model)`
     14         if not hasattr(model, "__citations__"):`
---> 15             model.__citations__ = dict()`
     16         for k in citations:`
     17             model.__citations__[k] = CITATIONS[k]`

AttributeError: 'float' object has no attribute '__citations__'
dfm commented 3 years ago

Both of these error are coming from version mismatches between the tutorial that you're following and the version of exoplanet. The syntax you're using requires at least exoplanet v0.5.0, I think, and earlier versions would fail with these issues. So perhaps you need to upgrade?

alexteachey commented 3 years ago

Thanks Dan, I thought I had been working with the latest version but apparently not. That did the trick.