exoplanet-dev / exoplanet

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

Looking for library directory when running TESS transit fitting example #307

Open emmalouden opened 1 year ago

emmalouden commented 1 year ago

To Reproduce Running this portion of the transit fitting example code (https://gallery.exoplanet.codes/tutorials/quick-tess/)

import pymc3 as pm import aesara_theano_fallback.tensor as tt

import pymc3_ext as pmx from celerite2.theano import terms, GaussianProcess

with pm.Model() as model:

Stellar parameters

mean = pm.Normal("mean", mu=0.0, sigma=10.0)
u = xo.QuadLimbDark("u")
star_params = [mean, u]

# Gaussian process noise model
sigma = pm.InverseGamma("sigma", alpha=3.0, beta=2 * np.median(yerr))
log_sigma_gp = pm.Normal("log_sigma_gp", mu=0.0, sigma=10.0)
log_rho_gp = pm.Normal("log_rho_gp", mu=np.log(10.0), sigma=10.0)
kernel = terms.SHOTerm(
    sigma=tt.exp(log_sigma_gp), rho=tt.exp(log_rho_gp), Q=1.0 / 3
)
noise_params = [sigma, log_sigma_gp, log_rho_gp]

# Planet parameters
log_ror = pm.Normal(
    "log_ror", mu=0.5 * np.log(depth_guess * 1e-3), sigma=10.0
)
ror = pm.Deterministic("ror", tt.exp(log_ror))

# Orbital parameters
log_period = pm.Normal("log_period", mu=np.log(period_guess), sigma=1.0)
period = pm.Deterministic("period", tt.exp(log_period))
t0 = pm.Normal("t0", mu=t0_guess, sigma=1.0)
log_dur = pm.Normal("log_dur", mu=np.log(0.1), sigma=10.0)
dur = pm.Deterministic("dur", tt.exp(log_dur))
b = xo.distributions.ImpactParameter("b", ror=ror)

# Set up the orbit
orbit = xo.orbits.KeplerianOrbit(period=period, duration=dur, t0=t0, b=b)

# We're going to track the implied density for reasons that will become clear later
pm.Deterministic("rho_circ", orbit.rho_star)

# Set up the mean transit model
star = xo.LimbDarkLightCurve(u)
lc_model = mean + 1e3 * tt.sum(
    star.get_light_curve(orbit=orbit, r=ror, t=x), axis=-1
)

# Finally the GP observation model
gp = GaussianProcess(kernel, t=x, diag=yerr**2 + sigma**2)
gp.marginal("obs", observed=y - lc_model)

# Double check that everything looks good - we shouldn't see any NaNs!
print(model.check_test_point())

# Optimize the model
map_soln = model.test_point
map_soln = pmx.optimize(map_soln, [sigma])
map_soln = pmx.optimize(map_soln, [ror, b, dur])
map_soln = pmx.optimize(map_soln, noise_params)
map_soln = pmx.optimize(map_soln, star_params)
map_soln = pmx.optimize(map_soln)

produces this error

Output exceeds the size limit. Open the full output data in a text editor

FileNotFoundError Traceback (most recent call last) Cell In[5], line 54 51 gp.marginal("obs", observed=y - lc_model) 53 # Double check that everything looks good - we shouldn't see any NaNs! ---> 54 print(model.check_test_point()) 56 # Optimize the model 57 map_soln = model.test_point

File /opt/anaconda3/envs/rmeffect/lib/python3.8/site-packages/pymc3/model.py:1384, in Model.check_test_point(self, test_point, round_vals) 1380 if test_point is None: 1381 test_point = self.test_point 1383 return Series( -> 1384 {RV.name: np.round(RV.logp(test_point), round_vals) for RV in self.basic_RVs}, 1385 name="Log-probability of test_point", 1386 )

File /opt/anaconda3/envs/rmeffect/lib/python3.8/site-packages/pymc3/model.py:1384, in (.0) 1380 if test_point is None: 1381 test_point = self.test_point 1383 return Series( -> 1384 {RV.name: np.round(RV.logp(test_point), round_vals) for RV in self.basic_RVs}, 1385 name="Log-probability of test_point", 1386 ) ... --> 454 for f in os.listdir(d.strip('"')): 455 if f.endswith(".so") or f.endswith(".dylib") or f.endswith(".dll"): 456 if any([f.find(ll) >= 0 for ll in l]):

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib'

Your setup (please complete the following information):