Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if inc is None:
inc = self.inc
if obl is None:
obl = self.obl
inc, obl = to_tensor(inc, obl)
# Figure out the coords from the orbit
if orbit is not None and t is not None:
# Tensorize the time array
t = to_tensor(t)
# Only compute during transit?
if use_in_transit:
zero = to_tensor([0.])
theta0 = tt.reshape(to_tensor(theta), [1])
X0 = self._X_op(u, f, inc, obl, theta0, zero, zero, zero, zero)
transit_model = tt.tile(X0, tt.shape_padright(t).shape, ndim=2)
transit_inds = orbit.in_transit(t, r=ro, texp=texp)
t = t[transit_inds]
# Exposure time grid
if texp is None:
# Easy
tgrid = t
else:
# From DFM's exoplanet
texp = to_tensor(texp)
oversample = int(oversample)
for kwarg in kwargs.keys():
warnings.warn("Unrecognized kwarg: %s. Ignoring..." % kwarg)
# Figure out if this is a Theano Op call
if (orbit is not None and t is not None) or is_theano(u, b, zo, ro):
# Limb darkening coeffs
if u is None:
if self.udeg == 0:
u = []
else:
if self._spectral:
u = self[1:, :]
else:
u = self[1:]
u = to_tensor(u)
# Figure out the coords from the orbit
if orbit is not None and t is not None:
# Tensorize the time array
t = to_tensor(t)
# Only compute during transit?
if use_in_transit:
transit_model = tt.ones_like(t)
transit_inds = orbit.in_transit(t, r=ro, texp=texp)
t = t[transit_inds]
# Exposure time grid
if texp is None:
# Limb darkening coeffs
if u is None:
if self.udeg == 0:
u = []
else:
if self._spectral:
u = self[1:, :]
else:
u = self[1:]
u = to_tensor(u)
# Figure out the coords from the orbit
if orbit is not None and t is not None:
# Tensorize the time array
t = to_tensor(t)
# Only compute during transit?
if use_in_transit:
transit_model = tt.ones_like(t)
transit_inds = orbit.in_transit(t, r=ro, texp=texp)
t = t[transit_inds]
# Exposure time grid
if texp is None:
# Easy
tgrid = t
else:
# From DFM's exoplanet
u = to_tensor(u)
# Filter coeffs
if f is None:
if self.fdeg == 0:
f = []
else:
f = self.f
f = to_tensor(f)
# Angles
if inc is None:
inc = self.inc
if obl is None:
obl = self.obl
inc, obl = to_tensor(inc, obl)
# Figure out the coords from the orbit
if orbit is not None and t is not None:
# Tensorize the time array
t = to_tensor(t)
# Only compute during transit?
if use_in_transit:
zero = to_tensor([0.])
theta0 = tt.reshape(to_tensor(theta), [1])
X0 = self._X_op(u, f, inc, obl, theta0, zero, zero, zero, zero)
transit_model = tt.tile(X0, tt.shape_padright(t).shape, ndim=2)
transit_inds = orbit.in_transit(t, r=ro, texp=texp)
t = t[transit_inds]
theta0 = tt.reshape(to_tensor(theta), [1])
X0 = self._X_op(u, f, inc, obl, theta0, zero, zero, zero, zero)
transit_model = tt.tile(X0, tt.shape_padright(t).shape, ndim=2)
transit_inds = orbit.in_transit(t, r=ro, texp=texp)
t = t[transit_inds]
# Exposure time grid
if texp is None:
# Easy
tgrid = t
else:
# From DFM's exoplanet
texp = to_tensor(texp)
oversample = int(oversample)
oversample += 1 - oversample % 2
stencil = np.ones(oversample)
# Construct the exposure time integration stencil
if order == 0:
dt = np.linspace(-0.5, 0.5, 2*oversample+1)[1:-1:2]
elif order == 1:
dt = np.linspace(-0.5, 0.5, oversample)
stencil[1:-1] = 2
elif order == 2:
dt = np.linspace(-0.5, 0.5, oversample)
stencil[1:-1:2] = 4
stencil[2:-1:2] = 2
else:
raise ValueError("Keyword `order` must be <= 2.")
else:
f = self.f
f = to_tensor(f)
# Angles
if inc is None:
inc = self.inc
if obl is None:
obl = self.obl
inc, obl = to_tensor(inc, obl)
# Figure out the coords from the orbit
if orbit is not None and t is not None:
# Tensorize the time array
t = to_tensor(t)
# Only compute during transit?
if use_in_transit:
zero = to_tensor([0.])
theta0 = tt.reshape(to_tensor(theta), [1])
X0 = self._X_op(u, f, inc, obl, theta0, zero, zero, zero, zero)
transit_model = tt.tile(X0, tt.shape_padright(t).shape, ndim=2)
transit_inds = orbit.in_transit(t, r=ro, texp=texp)
t = t[transit_inds]
# Exposure time grid
if texp is None:
# Easy
tgrid = t
ro = kwargs.pop("ro", kwargs.pop("r", 0.0)) # Lenient! Can provide `r`
orbit = kwargs.pop("orbit", None)
t = kwargs.pop("t", None)
use_in_transit = kwargs.pop("use_in_transit", True)
texp = kwargs.pop("texp", None)
oversample = kwargs.pop("oversample", 7)
order = kwargs.pop("order", 0)
# Raise warnings for some combinations
if (orbit is not None) and (t is None):
raise ValueError("Please provide a set of times `t`.")
if (orbit is None or t is None):
use_in_transit = False
if texp is not None:
warnings.warn("Exposure time integration enabled only when an `orbit` instance is provided.")
if (to_tensor(theta).ndim != 0):
use_in_transit = False
for kwarg in kwargs.keys():
warnings.warn("Unrecognized kwarg: %s. Ignoring..." % kwarg)
# Figure out if this is a Theano Op call
if (orbit is not None and t is not None) or \
is_theano(u, f, inc, obl, theta, xo, yo, zo, ro):
# Limb darkening coeffs
if u is None:
if self.udeg == 0:
u = []
else:
if self._spectral:
u = self[1:, :]
else:
if self.udeg == 0:
u = []
else:
if self._spectral:
u = self[1:, :]
else:
u = self[1:]
u = to_tensor(u)
# Filter coeffs
if f is None:
if self.fdeg == 0:
f = []
else:
f = self.f
f = to_tensor(f)
# Angles
if inc is None:
inc = self.inc
if obl is None:
obl = self.obl
inc, obl = to_tensor(inc, obl)
# Figure out the coords from the orbit
if orbit is not None and t is not None:
# Tensorize the time array
t = to_tensor(t)
# Only compute during transit?
if use_in_transit:
warnings.warn("Unrecognized kwarg: %s. Ignoring..." % kwarg)
# Figure out if this is a Theano Op call
if (orbit is not None and t is not None) or \
is_theano(u, f, inc, obl, theta, xo, yo, zo, ro):
# Limb darkening coeffs
if u is None:
if self.udeg == 0:
u = []
else:
if self._spectral:
u = self[1:, :]
else:
u = self[1:]
u = to_tensor(u)
# Filter coeffs
if f is None:
if self.fdeg == 0:
f = []
else:
f = self.f
f = to_tensor(f)
# Angles
if inc is None:
inc = self.inc
if obl is None:
obl = self.obl
inc, obl = to_tensor(inc, obl)