Skip to content

Commit

Permalink
ex16 - adding q_source
Browse files Browse the repository at this point in the history
  • Loading branch information
rpoleski committed Jun 25, 2024
1 parent c2ad834 commit e1f1c7c
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions examples/example_16/ulens_model_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
except Exception:
raise ImportError('\nYou have to install MulensModel first!\n')

__version__ = '0.37.2'
__version__ = '0.37.3'


class UlensModelFit(object):
Expand Down Expand Up @@ -456,7 +456,7 @@ def _set_default_parameters(self):
'dalpha_dt x_caustic_in x_caustic_out t_caustic_in ' +
't_caustic_out xi_period xi_semimajor_axis xi_Omega_node ' +
'xi_inclination xi_argument_of_latitude_reference ' +
'xi_eccentricity xi_omega_periapsis')
'xi_eccentricity xi_omega_periapsis q_source')
self._all_MM_parameters = parameters_str.split()
self._fixed_only_MM_parameters = ['t_0_par', 't_0_xi']
self._other_parameters = []
Expand All @@ -481,6 +481,7 @@ def _set_default_parameters(self):
xi_argument_of_latitude_reference='\\xi_u',
xi_eccentricity='\\xi_e',
xi_omega_periapsis='\\xi_{\\omega}',
q_source='q_{\\rm source}',
)
self._latex_conversion_other = dict()

Expand Down Expand Up @@ -3245,18 +3246,23 @@ def _get_time_limits_for_plot(self, tau, plot_type):
return (t_1, t_2)

if self._model.n_sources == 1:
t_1 = self._model.parameters.t_0 - tau * self._model.parameters.t_E
t_2 = self._model.parameters.t_0 + tau * self._model.parameters.t_E
t_1 = self._model.parameters.t_0
t_2 = self._model.parameters.t_0
elif self._model.n_sources == 2:
t_1 = self._model.parameters.t_0_1
t_2 = self._model.parameters.t_0_2
if t_1 > t_2:
(t_1, t_2) = (t_2, t_1)
t_1 -= tau * self._model.parameters.t_E
t_2 += tau * self._model.parameters.t_E
if self._model.parameters.is_xallarap:
t_1 = self._model.parameters.t_0
t_2 = self._model.parameters.t_0
else:
t_1 = self._model.parameters.t_0_1
t_2 = self._model.parameters.t_0_2
if t_1 > t_2:
(t_1, t_2) = (t_2, t_1)
else:
raise ValueError('internal issue: ' + str(self._model.n_sources))

t_1 -= tau * self._model.parameters.t_E
t_2 += tau * self._model.parameters.t_E

return (t_1, t_2)

def _get_ylim_for_best_model_plot(self, t_1, t_2):
Expand Down

0 comments on commit e1f1c7c

Please sign in to comment.