pyLIMA.microlmodels module

Created on Mon Dec 7 10:32:13 2015

@author: ebachelet

class pyLIMA.microlmodels.MLModel(event, model_arguments=[], parallax=['None', 0.0], xallarap='None', orbital_motion=['None', 0.0], source_spots='None', blend_flux_ratio=True)[source]

Bases: object

######## MLModels module ########

This class defines the model you want to fit your data to. Model is the parent class, each model is a child class (polymorphism), for example ModelPSPL.

Attributes :

event : A event class which describe your event that you want to model. See the event module.

parallax_model : Parallax model you want to use for the Earth types telescopes.

Has to be a list containing the model in the available_parallax parameter and the value of topar. Have a look here for more details : http://adsabs.harvard.edu/abs/2011ApJ...738...87S

‘Annual’ –> Annual parallax ‘Terrestrial’ –> Terrestrial parallax ‘Full’ –> combination of previous

topar –> a time in HJD choosed as the referenced time fot the parallax

If you have some Spacecraft types telescopes, the space based parallax is computed if parallax is different of ‘None’ More details in the microlparallax module

xallarap_model : not available yet

orbital_motion_model : not available yet

‘None’ –> No orbital motion ‘2D’ –> Classical orbital motion ‘3D’ –> Full Keplerian orbital motion

toom –> a time in HJD choosed as the referenced time fot the orbital motion
(Often choose equal to topar)

More details in the microlomotion module

source_spots_model : not available yet

‘None’ –> No source spots

More details in the microlsspots module

yoo_table : an array which contains the Yoo et al table

Jacobian_flag : a flag indicated if a Jacobian can be used (‘OK’) or not.

model_dictionnary : a python dictionnary which describe the model parameters

pyLIMA_standards_dictionnary : the standard pyLIMA parameters dictionnary

fancy_to_pyLIMA_dictionnary : a dictionnary which described which fancy parameters replace a standard pyLIMA
parameter. For example : {‘logrho’: ‘rho’}

pyLIMA_to_fancy : a dictionnary which described the function to transform the standard pyLIMA parameter to the fancy one. Example : {‘logrho’: lambda parameters: np.log10(parameters.rho)}

fancy_to_pyLIMA : a dictionnary which described the function to transform the fancy parameters to pyLIMA standards. Example : {‘rho’: lambda parameters: 10 ** parameters.logrho}

parameters_guess : a list containing guess on pyLIMA parameters.

Parameters:
  • event (object) – a event object. More details on the event module.
  • parallax (list) – a list of [string,float] indicating the parallax model you want and to_par
  • xallarap (list) – a list of [string,float] indicating the xallarap mode.l. NOT WORKING NOW.
  • orbital_motion (list) – a list of [string,float] indicating the parallax model you want and to_om. NOT WORKING NOW.
  • source_spots (string) – a string indicated the source_spots you want. NOT WORKING.
compute_pyLIMA_parameters(fancy_parameters)[source]

Realize the transformation between the fancy parameters to fit to the standard pyLIMA parameters needed to compute a model.

Parameters:fancy_parameters (list) – the parameters you fit
Returns:pyLIMA parameters
Return type:object (namedtuple)
compute_the_microlensing_model(telescope, pyLIMA_parameters)[source]

Compute the microlens model according the injected parameters. This is modified by child submodel sublclass, if not the default microlensing model is returned.

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

the microlensing model

Return type:

array_like

define_model_parameters()[source]

Define the model parameters dictionnary. It is different to the pyLIMA_standards_dictionnary if you have some fancy parameters request.

define_pyLIMA_standard_parameters()[source]

Define the standard pyLIMA parameters dictionnary.

derive_telescope_flux(telescope, pyLIMA_parameters, amplification)[source]

Compute the source/blending flux

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
  • amplification (array_like) – an array containing the magnification
Returns:

the source and the blending flux

Return type:

tuple

fancy_parameters_to_pyLIMA_standard_parameters(fancy_parameters)[source]

Transform the fancy parameters to the pyLIMA standards. The output got all the necessary standard attributes, example to, uo, tE...

Parameters:fancy_parameters (object) – the fancy_parameters as namedtuple
Returns:the pyLIMA standards are added to the fancy parameters
Return type:object
model_magnification(telescope, pyLIMA_parameters)[source]
model_type
paczynski_model_parameters()[source]
pyLIMA_standard_parameters_to_fancy_parameters(pyLIMA_parameters)[source]
Transform the the pyLIMA standards parameters to the fancy parameters. The output got all
the necessary fancy attributes.
Parameters:pyLIMA_parameters (object) – the standard pyLIMA parameters as namedtuple
Returns:the fancy parameters are added to the fancy parameters
Return type:object
source_trajectory(telescope, to, uo, tE, pyLIMA_parameters)[source]

Compute the microlensing source trajectory associated to a telescope for the given parameters.

Parameters:
  • to (float) – time of maximum magnification
  • uo (float) – minimum impact parameter
  • tE (float) – angular Einstein ring crossing time
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

source_trajectory_x, source_trajectory_y the x,y compenents of the source trajectory

Return type:

array_like,array_like

class pyLIMA.microlmodels.ModelDFSPL(event, model_arguments=[], parallax=['None', 0.0], xallarap='None', orbital_motion=['None', 0.0], source_spots='None', blend_flux_ratio=True)[source]

Bases: pyLIMA.microlmodels.MLModel

model_magnification(telescope, pyLIMA_parameters)[source]

The magnification associated to a DFSPL model. From Hwang et al 2013 : http://iopscience.iop.org/article/10.1088/0004-637X/778/1/55/pdf

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

magnification, impact_parameter

Return type:

array_like,array_like

model_type

Return the kind of microlensing model.

Returns:DFSPL
Return type:string
paczynski_model_parameters()[source]

Define the DFSPL standard parameters, [to1,uo1,to2,uo2,tE,rho_1,rho_2,q_F_filters]

Returns:a dictionnary containing the pyLIMA standards
Return type:dict
class pyLIMA.microlmodels.ModelDSPL(event, model_arguments=[], parallax=['None', 0.0], xallarap='None', orbital_motion=['None', 0.0], source_spots='None', blend_flux_ratio=True)[source]

Bases: pyLIMA.microlmodels.MLModel

model_magnification(telescope, pyLIMA_parameters)[source]

The magnification associated to a DSPL model. From Hwang et al 2013 : http://iopscience.iop.org/article/10.1088/0004-637X/778/1/55/pdf

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

magnification, impact_parameter

Return type:

array_like,array_like

model_type

Return the kind of microlensing model.

Returns:DSPL
Return type:string
paczynski_model_parameters()[source]

Define the DSPL standard parameters, [to1,uo1,to2,uo2,tE,q_F_filters]

Returns:a dictionnary containing the pyLIMA standards
Return type:dict
exception pyLIMA.microlmodels.ModelException[source]

Bases: exceptions.Exception

class pyLIMA.microlmodels.ModelFSBL(event, model_arguments=[], parallax=['None', 0.0], xallarap='None', orbital_motion=['None', 0.0], source_spots='None', blend_flux_ratio=True)[source]

Bases: pyLIMA.microlmodels.MLModel

find_binary_regime(pyLIMA_parameters)[source]
find_caustics(separation, mass_ratio)[source]
find_origin(pyLIMA_parameters)[source]
model_magnification(telescope, pyLIMA_parameters)[source]

The magnification associated to a USBL model.

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

magnification

Return type:

array_like

model_type

Return the kind of microlensing model.

:returns:FSBL :rtype: string

paczynski_model_parameters()[source]

Define the USBL standard parameters, [to,uo,tE,rho, s,q,alpha]

Returns:a dictionnary containing the pyLIMA standards
Return type:dict
uc_tc_from_uo_to(pyLIMA_parameters, to, uo)[source]
uo_to_from_uc_tc(pyLIMA_parameters)[source]
class pyLIMA.microlmodels.ModelFSPL(event, model_arguments=[], parallax=['None', 0.0], xallarap='None', orbital_motion=['None', 0.0], source_spots='None', blend_flux_ratio=True)[source]

Bases: pyLIMA.microlmodels.MLModel

Jacobian_model_magnification(telescope, pyLIMA_parameters)[source]

The magnification associated to a FSPL model. More details in microlmagnification module.

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

magnification, impact_parameter

Return type:

array_like,array_like

model_Jacobian(telescope, pyLIMA_parameters)[source]

The derivative of a FSPL model

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

jacobi

Return type:

array_like

model_magnification(telescope, pyLIMA_parameters)[source]

The magnification associated to a FSPL model. More details in microlmagnification module.

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

magnification, impact_parameter

Return type:

array_like,array_like

model_type

Return the kind of microlensing model.

Returns:FSPL
Return type:string
paczynski_model_parameters()[source]

Define the FSPL standard parameters, [to,uo,tE,rho]

Returns:a dictionnary containing the pyLIMA standards
Return type:dict
class pyLIMA.microlmodels.ModelPSBL(event, model_arguments=[], parallax=['None', 0.0], xallarap='None', orbital_motion=['None', 0.0], source_spots='None', blend_flux_ratio=True)[source]

Bases: pyLIMA.microlmodels.MLModel

find_binary_regime(pyLIMA_parameters)[source]
find_caustics(separation, mass_ratio)[source]
find_origin(pyLIMA_parameters)[source]
model_magnification(telescope, pyLIMA_parameters)[source]

The magnification associated to a USBL model.

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

magnification, impact_parameter

Return type:

array_like,array_like

model_type

Return the kind of microlensing model.

:returns:PSBL :rtype: string

paczynski_model_parameters()[source]

Define the USBL standard parameters, [to,uo,tE,rho, s,q,alpha]

Returns:a dictionnary containing the pyLIMA standards
Return type:dict
uc_tc_from_uo_to(pyLIMA_parameters, to, uo)[source]
uo_to_from_uc_tc(pyLIMA_parameters)[source]
class pyLIMA.microlmodels.ModelPSPL(event, model_arguments=[], parallax=['None', 0.0], xallarap='None', orbital_motion=['None', 0.0], source_spots='None', blend_flux_ratio=True)[source]

Bases: pyLIMA.microlmodels.MLModel

Jacobian_model_magnification(telescope, pyLIMA_parameters)[source]

The magnification associated to a PSPL model. More details in microlmagnification module.

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

magnification, impact_parameter

Return type:

array_like,array_like

model_Jacobian(telescope, pyLIMA_parameters)[source]

The derivative of a PSPL model

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

jacobi

Return type:

array_like

model_magnification(telescope, pyLIMA_parameters)[source]

The magnification associated to a PSPL model. More details in microlmagnification module.

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

magnification

Return type:

array_like

model_type

Return the kind of microlensing model.

Returns:PSPL
Return type:string
paczynski_model_parameters()[source]

Define the PSPL standard parameters, [to,uo,tE]

Returns:a dictionnary containing the pyLIMA standards
Return type:dict
class pyLIMA.microlmodels.ModelUSBL(event, model_arguments=[], parallax=['None', 0.0], xallarap='None', orbital_motion=['None', 0.0], source_spots='None', blend_flux_ratio=True)[source]

Bases: pyLIMA.microlmodels.MLModel

find_binary_regime(pyLIMA_parameters)[source]
find_caustics(separation, mass_ratio)[source]
find_origin(pyLIMA_parameters)[source]
model_magnification(telescope, pyLIMA_parameters)[source]

The magnification associated to a USBL model.

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

magnification

Return type:

array_like

model_type

Return the kind of microlensing model.

Returns:USBL
Return type:string
paczynski_model_parameters()[source]

Define the USBL standard parameters, [to,uo,tE,rho, s,q,alpha]

Returns:a dictionnary containing the pyLIMA standards
Return type:dict
uc_tc_from_uo_to(pyLIMA_parameters, to, uo)[source]
uo_to_from_uc_tc(pyLIMA_parameters)[source]
class pyLIMA.microlmodels.ModelVariablePL(event, model_arguments=[], parallax=['None', 0.0], xallarap='None', orbital_motion=['None', 0.0], source_spots='None', blend_flux_ratio=True)[source]

Bases: pyLIMA.microlmodels.MLModel

compute_pulsations(time, filter, pyLIMA_parameters)[source]
compute_the_microlensing_model(telescope, pyLIMA_parameters)[source]

Compute the microlens model according the injected parameters. This is modified by child submodel sublclass, if not the default microlensing model is returned.

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

the microlensing model

Return type:

array_like

derive_telescope_flux(telescope, pyLIMA_parameters, amplification, pulsations)[source]
model_magnification(telescope, pyLIMA_parameters)[source]

The magnification associated to a PSPL model. More details in microlmagnification module.

Parameters:
  • telescope (object) – a telescope object. More details in telescope module.
  • pyLIMA_parameters (object) – a namedtuple which contain the parameters
Returns:

magnification

Return type:

array_like

model_type

Return the kind of microlensing model.

Returns:VariablePL
Return type:string
paczynski_model_parameters()[source]

Define the PSPL standard parameters, [to,uo,tE]

Returns:a dictionnary containing the pyLIMA standards
Return type:dict
pyLIMA.microlmodels.create_model(model_type, event, model_arguments=[], parallax=['None', 0.0], xallarap=['None'], orbital_motion=['None', 0.0], source_spots='None', blend_flux_ratio=True)[source]

Load a model according to the supplied model_type. Models are expected to be named Model<model_type> e.g. ModelPSPL

Parameters:model_type (string) – Model type e.g. PSPL
Returns:Model object for given model_type