def model_magnification(self, telescope, pyLIMA_parameters): """ 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 :param object telescope: a telescope object. More details in telescope module. :param object pyLIMA_parameters: a namedtuple which contain the parameters :return: magnification, impact_parameter :rtype: array_like,array_like """ source1_trajectory = self.source_trajectory(telescope, pyLIMA_parameters.to, pyLIMA_parameters.uo, pyLIMA_parameters.tE, pyLIMA_parameters) to2 = pyLIMA_parameters.to + pyLIMA_parameters.delta_to uo2 = pyLIMA_parameters.delta_uo + pyLIMA_parameters.uo source2_trajectory = self.source_trajectory(telescope, to2, uo2, pyLIMA_parameters.tE, pyLIMA_parameters) source1_magnification = microlmagnification.amplification_PSPL(*source1_trajectory) source2_magnification = microlmagnification.amplification_PSPL(*source2_trajectory) blend_magnification_factor = getattr(pyLIMA_parameters, 'q_flux_' + telescope.filter) effective_magnification = (source1_magnification + source2_magnification * blend_magnification_factor) / ( 1 + blend_magnification_factor) return effective_magnification
def model_magnification(self, telescope, pyLIMA_parameters): """ 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 :param object telescope: a telescope object. More details in telescope module. :param object pyLIMA_parameters: a namedtuple which contain the parameters :return: magnification, impact_parameter :rtype: array_like,array_like """ source1_trajectory = self.source_trajectory(telescope, pyLIMA_parameters.to, pyLIMA_parameters.uo, pyLIMA_parameters.tE, pyLIMA_parameters) to2 = pyLIMA_parameters.to + pyLIMA_parameters.delta_to uo2 = pyLIMA_parameters.delta_uo + pyLIMA_parameters.uo source2_trajectory = self.source_trajectory(telescope, to2, uo2, pyLIMA_parameters.tE, pyLIMA_parameters) source1_magnification = microlmagnification.amplification_PSPL(*source1_trajectory)[0] source2_magnification = microlmagnification.amplification_PSPL(*source2_trajectory)[0] blend_magnification_factor = getattr(pyLIMA_parameters, 'q_flux_' + telescope.filter) effective_magnification = (source1_magnification + source2_magnification * blend_magnification_factor) / ( 1 + blend_magnification_factor) return effective_magnification, source1_trajectory
def model_magnification(self, telescope, pyLIMA_parameters): """ The magnification associated to a PSPL model. More details in microlmagnification module. :param object telescope: a telescope object. More details in telescope module. :param object pyLIMA_parameters: a namedtuple which contain the parameters :return: magnification, impact_parameter :rtype: array_like,array_like """ source_trajectoire = self.source_trajectory(telescope, pyLIMA_parameters.to, pyLIMA_parameters.uo, pyLIMA_parameters.tE, pyLIMA_parameters) return microlmagnification.amplification_PSPL(*source_trajectoire)
def model_magnification(self, telescope, pyLIMA_parameters): """ The magnification associated to a USBL model. :param object telescope: a telescope object. More details in telescope module. :param object pyLIMA_parameters: a namedtuple which contain the parameters :return: magnification, impact_parameter :rtype: array_like,array_like """ source_trajectoire = self.source_trajectory(telescope, pyLIMA_parameters.to, pyLIMA_parameters.uo, pyLIMA_parameters.tE, pyLIMA_parameters) magnification = np.zeros(len(source_trajectoire[0])) # for key in self.model_dictionnary.keys()[:len(self.parameters_boundaries)]: # param = getattr(pyLIMA_parameters, key) # limits = self.parameters_boundaries[self.model_dictionnary[key]] # if (param<limits[0]) | (limits[1]<param): # magnification += 0.1*np.inf # return magnification,magnification if 'dsdt' in pyLIMA_parameters._fields: separation = 10 ** pyLIMA_parameters.logs + \ microlorbitalmotion.orbital_motion_2D_separation_shift(self.orbital_motion_model[1], telescope.lightcurve_flux[:, 0], pyLIMA_parameters.dsdt) else: separation = np.array([10 ** pyLIMA_parameters.logs] * len(source_trajectoire[0])) if self.USBL_windows: index_USBL = np.where((telescope.lightcurve_flux[:, 0] < self.USBL_windows[1]) & ( telescope.lightcurve_flux[:, 0] > self.USBL_windows[0]))[0] Xs = source_trajectoire[0][index_USBL] Ys = source_trajectoire[1][index_USBL] magnification_USBL = \ microlmagnification.amplification_USBL(separation[index_USBL], 10 ** pyLIMA_parameters.logq, Xs, Ys, pyLIMA_parameters.rho, tolerance=0.001)[0] magnification[index_USBL] = magnification_USBL index_PSPL = np.where((telescope.lightcurve_flux[:, 0] > self.USBL_windows[1]) | ( telescope.lightcurve_flux[:, 0] < self.USBL_windows[0]))[0] magnification_PSPL = microlmagnification.amplification_PSPL(source_trajectoire[0][index_PSPL], source_trajectoire[1][index_PSPL])[0] magnification[index_PSPL] = magnification_PSPL else: Xs, Ys = source_trajectoire magnification = \ microlmagnification.amplification_USBL(separation, 10 ** pyLIMA_parameters.logq, Xs, Ys, pyLIMA_parameters.rho, tolerance=0.001)[0] return magnification, source_trajectoire
def model_magnification(self, telescope, pyLIMA_parameters): """ The magnification associated to a USBL model. :param object telescope: a telescope object. More details in telescope module. :param object pyLIMA_parameters: a namedtuple which contain the parameters :return: magnification, impact_parameter :rtype: array_like,array_like """ source_trajectoire = self.source_trajectory(telescope, pyLIMA_parameters.to, pyLIMA_parameters.uo, pyLIMA_parameters.tE, pyLIMA_parameters) magnification = np.zeros(len(source_trajectoire[0])) for key in self.model_dictionnary.keys()[:len(self.parameters_boundaries)]: param = getattr(pyLIMA_parameters, key) limits = self.parameters_boundaries[self.model_dictionnary[key]] if (param<limits[0]) | (limits[1]<param): magnification += 0.1 return magnification,magnification if 'dsdt' in pyLIMA_parameters._fields: separation = 10 ** pyLIMA_parameters.logs + \ microlorbitalmotion.orbital_motion_2D_separation_shift(self.orbital_motion_model[1], telescope.lightcurve_flux[:, 0], pyLIMA_parameters.dsdt) else: separation = np.array([10 ** pyLIMA_parameters.logs] * len(source_trajectoire[0])) if self.USBL_windows: index_USBL = np.where((telescope.lightcurve_flux[:, 0] < self.USBL_windows[1]) & ( telescope.lightcurve_flux[:, 0] > self.USBL_windows[0]))[0] Xs = source_trajectoire[0][index_USBL] Ys = source_trajectoire[1][index_USBL] magnification_USBL = \ microlmagnification.amplification_USBL(separation[index_USBL], 10 ** pyLIMA_parameters.logq, Xs, Ys, pyLIMA_parameters.rho, tolerance=0.001)[0] magnification[index_USBL] = magnification_USBL index_PSPL = np.where((telescope.lightcurve_flux[:, 0] > self.USBL_windows[1]) | ( telescope.lightcurve_flux[:, 0] < self.USBL_windows[0]))[0] magnification_PSPL = microlmagnification.amplification_PSPL(source_trajectoire[0][index_PSPL], source_trajectoire[1][index_PSPL])[0] magnification[index_PSPL] = magnification_PSPL else: Xs, Ys = source_trajectoire magnification = \ microlmagnification.amplification_USBL(separation, 10 ** pyLIMA_parameters.logq, Xs, Ys, pyLIMA_parameters.rho, tolerance=0.001)[0] return magnification, source_trajectoire