Model Functions
Code to define the models and model parameters for the gp regression.
- class src.magpy_rv.models.Keplerian(time, model_params)[source]
The generalized Keplerian RV model (only use when dealing with RV observation of star with possible planet).
- Parameters
time (array, floats) – Time array over which to compute the Keplerian.
model_params (dictionary) –
- Dictionary of model parameters containing:
- Pfloat
Period of orbit in days.
- Kfloat
Semi-aplitude of the rv signal in meter per seconds.
- eccfloat
Eccentricity of orbit. Float between 0 and 0.99
- omegafloat
Angle of periastron, in rad.
- t0float
Time of periastron passage of a planet
- ecc_anomaly(M, ecc, max_itr=200)[source]
- Parameters
M (float) – Mean anomaly
ecc (float) – Eccentricity, number between 0. and 0.99
max_itr (integer, optional) – Number of maximum iteration in E computation. The default is 200.
- Returns
E – Eccentric anomaly
- Return type
float
- model()[source]
- Returns
rad_vel – Radial volicity model derived by the number of planet include
- Return type
array, floats
- static params(model_num=None, plotting=True, SkCk=False)[source]
Function to return a list of the parameters in selected format
- Parameters
model_num (int, optional) – indicates the nth of this model in the model list, defaults to None
plotting (bool, optional) – True returns the list in format for plots, False returns the list in format for text, defaults to True
SkCk (bool, optional) – If True return list including Sk and Ck, if False return list including ecc and omega, defaults to False
- class src.magpy_rv.models.Model[source]
Parent class for all models. All new models should inherit from this class and follow its structure. Each new model will require a __init__() method to override the parent class. In the __init__ function, call the neccesary parameters.
- class src.magpy_rv.models.No_Model(y, no)[source]
The subtracted model from the RV is null
- Parameters
y (array) – Observed RV or ys
- static params(model_num=None, plotting=True)[source]
Function to return a list of the parameters in selected format
- Parameters
model_num (int, optional) – indicates the nth of this model in the model list, defaults to None
plotting (bool, optional) – True returns the list in format for plots, False returns the list in format for text, defaults to True
- class src.magpy_rv.models.Offset(flags, model_params)[source]
The subtracted model from RV is a constant offset chosen explicitlty
- Parameters
flags (array of floats) – array of flags representing which datapoints in the time array are related to which telescope and so will have which offset generated by the combine_data function
model_params (dictionary of model parameters) – dictionary containing the offset model parameter
- Raises
Assertion: – Raised if model parameters is longer than 1
- static params(model_num=None, plotting=True)[source]
Function to return a list of the parameters in selected format
- Parameters
model_num (int, optional) – indicates the nth of this model in the model list, defaults to None
plotting (bool, optional) – True returns the list in format for plots, False returns the list in format for text, defaults to True
- class src.magpy_rv.models.Polynomial(time, model_params)[source]
The model of the rv data follows a polynomial up to the 3rd degree with equation:
\[a_3(time)^3 + a_2(time)^2 + a_1(time) + a_0\]- Parameters
time (array) – Time or x axis array
model_params (dictionary of model parameters) – containing a0, a1, a2, a3
- Raises
Assertion: – Raised if the model does not have 4 model parameters
- static params(model_num=None, plotting=True)[source]
Function to return a list of the parameters in selected format
- Parameters
model_num (int, optional) – indicates the nth of this model in the model list, defaults to None
plotting (bool, optional) – True returns the list in format for plots, False returns the list in format for text, defaults to True
- src.magpy_rv.models.combine_data(times, ys, y_errs)[source]
Function to combine data from multiple telescopes to an X and Y array and generate an array of flags for the offsets
- Parameters
times (list or tuple of arrays of floats) – list of the time arrays from the telescopes where the first array in the list is the zero point offset
ys (list or tuple of arrays of floats) – list of the rv arrays from the telescopes where the first array in the list is the zero point offset, arrays entered into list in same order as times
y_errs (list or tuple of arrays of floats) – list of the rv error arrays from the telescopes where the first array in the list is the zero point offset, arrays entered into list in same order as times
- Raises
Assertion: – Raised if times is not a list or tuple
Assertion – Raised if ys is not a list or tuple
Assertion – Raised if y_errs is not a list or tuple
- Returns
time (array of floats) – combined time array of all telescopes
y (array of floats) – combined rv array of all telescopes
y_err (array of floats) – combined rv error array of all telescopes
flags (array of floats) – array of flags representing which datapoints in the time array are related to which telescope and so will have which offset
- src.magpy_rv.models.defModelList()[source]
Function to return the list of all currently available Models
- src.magpy_rv.models.mod_create(model)[source]
Function to generate a dictionary of necessary model parameters for the chosen models
- Parameters
model (string or list of strings) – name of the desired model or list of the model names
- Raises
ValueError: – Raised if the model is not a string or list of strings
- Returns
model_params – Dictionary of all necessary parameters
- Return type
dictionary