OpenCL Quadratic model¶

class
pytransit.
QuadraticModelCL
(klims: tuple = (0.05, 0.25), nk: int = 256, nz: int = 256, cl_ctx=None, cl_queue=None)[source]¶ OpenCL implementation of the transit light curve model with quadratic limb darkening by Mandel and Agol (2002).
This class implements the quadratic transit model by Mandel & Agol (ApJ 580, L171L175, 2002) in OpenCL. The class can replace pytransit.QuadraticModel directly, and offers in most cases a significant performance boost with some drawbacks (see the notes below).
Notes
 All the calculations are done in single precision. This can affect the results when modelling extremely shallow transits, and will certainly affect the model if the times are given in JD. The times should be given relative to some constant epoch that maximises the precision (see pytransit.lpf.lpf.BaseLPF for an example).

__init__
(klims: tuple = (0.05, 0.25), nk: int = 256, nz: int = 256, cl_ctx=None, cl_queue=None) → None[source]¶ Transit model with quadratic limb darkening (Mandel & Agol, ApJ 580, L171L175, 2002).
Parameters:  klims (tuple, optional) – Radius ratio limits (kmin, kmax) for the interpolated model.
 nk (int, optional) – Radius ratio grid size for the interpolated model.
 nz (int, optional) – Normalized distance grid size for the interpolated model.
 cl_ctx (optional) – OpenCL context.
 cl_queue (optional) – OpenCL queue

set_data
(time, lcids=None, pbids=None, nsamples=None, exptimes=None)[source]¶ Set the data for the transit model.
Parameters:  time (arraylike) – Array of midexposure times for which the model will be evaluated.
 lcids (arraylike, optional) – Array of integer light curve indices. Must have the same size as the time array.
 pbids (arraylike, optional) – Array of passband indices, one per light curve. Must satisfy pbids.size == unique(lcids).size.
 nsamples (int or arraylike, optional) – Number of samples per exposure. Can either be an integer, in which case all the light curves will have the same supersampling rate, or an array of integers, in which case each light curve can have a different rate.
 exptimes (float or arraylike, optional) – Exposure times, again either for all the modelled data, or one value per light curve.
 epids (arraylike, optional) – Epoch indices that can be used to link a light curve to a specific zero epoch and period (for TTV calculations).

evaluate
(k: Union[float, numpy.ndarray], ldc: numpy.ndarray, t0: Union[float, numpy.ndarray], p: Union[float, numpy.ndarray], a: Union[float, numpy.ndarray], i: Union[float, numpy.ndarray], e: Union[float, numpy.ndarray] = None, w: Union[float, numpy.ndarray] = None, copy: bool = True) → numpy.ndarray[source]¶ Evaluate the transit model for a set of scalar or vector parameters.
Parameters:  k – Radius ratio(s) either as a single float, 1D vector, or 2D array.
 ldc – Limb darkening coefficients as a 1D or 2D array.
 t0 – Transit center(s) as a float or a 1D vector.
 p – Orbital period(s) as a float or a 1D vector.
 a – Orbital semimajor axis (axes) divided by the stellar radius as a float or a 1D vector.
 i – Orbital inclination(s) as a float or a 1D vector.
 e (optional) – Orbital eccentricity as a float or a 1D vector.
 w (optional) – Argument of periastron as a float or a 1D vector.
Notes
The model can be evaluated either for one set of parameters or for many sets of parameters simultaneously. In the first case, the orbital parameters should all be given as floats. In the second case, the orbital parameters should be given as a 1D arraylike.
Returns: Modelled flux either as a 1D or 2D ndarray. Return type: ndarray

evaluate_ps
(k: Union[float, numpy.ndarray], ldc: numpy.ndarray, t0: float, p: float, a: float, i: float, e: float = 0.0, w: float = 0.0, copy: bool = True)[source]¶ Evaluate the transit model for a set of scalar parameters.
Parameters:  k (arraylike) – Radius ratio(s) either as a single float or an 1D array.
 ldc (arraylike) – Limb darkening coefficients as a 1D array.
 t0 (float) – Transit center as a float.
 p (float) – Orbital period as a float.
 a (float) – Orbital semimajor axis divided by the stellar radius as a float.
 i (float) – Orbital inclination(s) as a float.
 e (float, optional) – Orbital eccentricity as a float.
 w (float, optional) – Argument of periastron as a float.
Returns: Modelled flux as a 1D ndarray.
Return type: ndarray

evaluate_pv
(pvp: numpy.ndarray, ldc: numpy.ndarray, copy: bool = True)[source]¶ Evaluate the transit model for 2D parameter array.
Parameters:  pvp – Parameter array with a shape (npv, npar) where npv is the number of parameter vectors, and each row contains a set of parameters [k, t0, p, a, i, e, w]. The radius ratios can also be given per passband, in which case the row should be structured as [k_0, k_1, k_2, …, k_npb, t0, p, a, i, e, w].
 ldc – Limb darkening coefficient array with shape (npv, 2*npb), where npv is the number of parameter vectors and npb is the number of passbands.
Notes
This version of the evaluate method is optimized for calculating several models in parallel, such as when using emcee for MCMC sampling.
Returns: Modelled flux either as a 1D or 2D ndarray. Return type: ndarray