def test_initial_guess_FSPL(): event = _create_event() guesses = microlguess.initial_guess_FSPL(event) assert len(guesses) == 2 assert len(guesses[0]) == 4
def test_initial_guess_FSPL(): event = _create_event() guesses = microlguess.initial_guess_FSPL(event) assert len(guesses) == 2 assert len(guesses[0]) == 4
def initial_guess(self): """Try to estimate the microlensing parameters. Only use for PSPL and FSPL models. More details on microlguess module. :return guess_parameters: a list containing parameters guess related to the model. :rtype: list """ if len(self.model.parameters_guess) == 0: # Estimate the Paczynski parameters if self.model.model_type == 'PSPL': guess_paczynski_parameters, f_source = microlguess.initial_guess_PSPL(self.event) if self.model.model_type == 'FSPL': guess_paczynski_parameters, f_source = microlguess.initial_guess_FSPL(self.event) if self.model.model_type == 'DSPL': guess_paczynski_parameters, f_source = microlguess.initial_guess_DSPL(self.event) # Estimate the telescopes fluxes (flux_source + g_blending) parameters telescopes_fluxes = self.find_fluxes(guess_paczynski_parameters, self.model) # The survey fluxes are already known from microlguess telescopes_fluxes[0] = f_source telescopes_fluxes[1] = 0.0 if 'piEN' in self.model.model_dictionnary.keys(): guess_paczynski_parameters = guess_paczynski_parameters + [0.0, 0.0] if 'XiEN' in self.model.model_dictionnary.keys(): guess_paczynski_parameters = guess_paczynski_parameters + [0, 0] if 'dsdt' in self.model.model_dictionnary.keys(): guess_paczynski_parameters = guess_paczynski_parameters + [0, 0] if 'spot_size' in self.model.model_dictionnary.keys(): guess_paczynski_parameters = guess_paczynski_parameters + [0] else: guess_paczynski_parameters = list(self.model.parameters_guess) telescopes_fluxes = self.find_fluxes(guess_paczynski_parameters, self.model) if len(guess_paczynski_parameters) != len(list(self.model.model_dictionnary.keys())): guess_paczynski_parameters += telescopes_fluxes print(sys._getframe().f_code.co_name, ' : Initial parameters guess SUCCESS') return guess_paczynski_parameters
def initial_guess(self): """Try to estimate the microlensing parameters. Only use for PSPL and FSPL models. More details on microlguess module. :return guess_parameters: a list containing parameters guess related to the model. :rtype: list """ if len(self.model.parameters_guess) == 0: # Estimate the Paczynski parameters if self.model.model_type == 'PSPL': guess_paczynski_parameters, f_source = microlguess.initial_guess_PSPL( self.event) if self.model.model_type == 'FSPL': guess_paczynski_parameters, f_source = microlguess.initial_guess_FSPL( self.event) if self.model.model_type == 'DSPL': guess_paczynski_parameters, f_source = microlguess.initial_guess_DSPL( self.event) # Estimate the telescopes fluxes (flux_source + g_blending) parameters, with a PSPL model fake_model = microlmodels.create_model('PSPL', self.event) fake_model.define_model_parameters() telescopes_fluxes = self.find_fluxes(guess_paczynski_parameters, fake_model) # The survey fluxes are already known from microlguess telescopes_fluxes[0] = f_source telescopes_fluxes[1] = 0.0 if self.model.parallax_model[0] != 'None': guess_paczynski_parameters = guess_paczynski_parameters + [ 0.0, 0.0 ] if self.model.xallarap_model[0] != 'None': guess_paczynski_parameters = guess_paczynski_parameters + [ 0, 0 ] if self.model.orbital_motion_model[0] != 'None': guess_paczynski_parameters = guess_paczynski_parameters + [ 0, 0 ] if self.model.source_spots_model != 'None': guess_paczynski_parameters = guess_paczynski_parameters + [0] else: guess_paczynski_parameters = list(self.model.parameters_guess) telescopes_fluxes = self.find_fluxes(guess_paczynski_parameters, self.model) guess_paczynski_parameters += telescopes_fluxes guess_parameters_pyLIMA_standards = collections.namedtuple( 'parameters', self.model.pyLIMA_standards_dictionnary.keys()) for key_parameter in self.model.pyLIMA_standards_dictionnary.keys(): try: setattr( guess_parameters_pyLIMA_standards, key_parameter, guess_paczynski_parameters[ self.model.pyLIMA_standards_dictionnary[key_parameter]] ) except: pass fancy_parameters_guess = self.model.pyLIMA_standard_parameters_to_fancy_parameters( guess_parameters_pyLIMA_standards) model_guess_parameters = [] for key_parameter in list(self.model.model_dictionnary.keys()): model_guess_parameters.append( getattr(fancy_parameters_guess, key_parameter)) print(sys._getframe().f_code.co_name, ' : Initial parameters guess SUCCESS') return model_guess_parameters