Closed canyon289 closed 6 months ago
Hi! I'm trying to use exoplanet with PyMC (v4) and I'm having trouble with defining the limb-darkening coeffs:
u_ld = xo.distributions.QuadLimbDark("u", testval=np.array(init_u))
Throws an error when defined under pm.Model() where pm is pyMC not pyMC3.
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
~/opt/anaconda3/envs/py38/lib/python3.8/site-packages/pymc3/model.py in get_context(cls, error_if_none)
320 try:
--> 321 candidate = cls.get_contexts()[-1] # type: Optional[T]
322 except IndexError as e:
IndexError: list index out of range
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
~/opt/anaconda3/envs/py38/lib/python3.8/site-packages/pymc3/distributions/distribution.py in __new__(cls, name, *args, **kwargs)
85 try:
---> 86 model = Model.get_context()
87 except TypeError:
~/opt/anaconda3/envs/py38/lib/python3.8/site-packages/pymc3/model.py in get_context(cls, error_if_none)
325 if error_if_none:
--> 326 raise TypeError("No %s on context stack" % str(cls))
327 return None
TypeError: No <class 'pymc3.model.Model'> on context stack
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
/var/folders/6k/5j78gjkn74b4xb382c27jzwr0000gn/T/ipykernel_64514/3843441120.py in <module>
17
18 # fit MCMC transit
---> 19 map_soln, model,[period,r,t0,b_ip,u_ld,mean] = fit_transit(x,y,yerr,init_r,init_t0, init_period,init_b,init_mean,init_u,period_error)
20 # plot the fit
21 plot_fit(x,y,yerr,map_soln)
~/Documents/Postdoc/CUBoulder/chromatic_fitting/src/recover_transit.py in fit_transit(x, y, yerr, init_r, init_t0, init_period, init_b, init_mean, init_u, period_error, fixed_var)
86 u_ld = xo.distributions.QuadLimbDark("u", testval=np.array(init_u), observed=np.array(init_u))
87 else:
---> 88 u_ld = xo.distributions.QuadLimbDark("u", testval=np.array(init_u))
89
90 # r = pm.Uniform(
~/opt/anaconda3/envs/py38/lib/python3.8/site-packages/pymc3/distributions/distribution.py in __new__(cls, name, *args, **kwargs)
86 model = Model.get_context()
87 except TypeError:
---> 88 raise TypeError(
89 "No model on context stack, which is needed to "
90 "instantiate distributions. Add variable inside "
TypeError: No model on context stack, which is needed to instantiate distributions. Add variable inside a 'with model:' block, or use the '.dist' syntax for a standalone distribution.
Yeah - exoplanet does not work with PyMC v4. You'll need to stick with PyMC3!
Hi, I'm not sure this is the best place to ask my question (sorry if it's not). I was wondering if there were plans to make exoplanet compatible with PyMC v4 or if the JAX backend (exo4jax I think?) was the main path forward in the future?
Thank you!
Great question and this is a good place to ask!
So far, I have updated all the backend packages (exoplanet-core, and celerite2) to be compatible with PyMC v4. This means that in principle it shouldn't be too hard to get the main package updated, but I haven't had the bandwidth to work on it!
For my own work, I've mostly been hacking on the JAX implementation (which is really more of a separate project, name TBD :D), but I definitely want to make sure that this package stays up to date. Maybe it makes sense to open a separate issue or PR to track these changes...
Quick update here that I'm working on the update to pymc
v4 over here: https://github.com/exoplanet-dev/exoplanet/pull/271
Hi, PyMC3 has been renamed PyMC. If this affects you and you have questions, or you want someone to direct your rage at I'm available! Do let me know how i, or any of the PyMC devs can help.
Ravin