rpoleski / MulensModel

Microlensing Modelling package

Home Page:https://rpoleski.github.io/MulensModel/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Coverage of code by unit tests should be increased

rpoleski opened this issue · comments

Currently coverage is 72% and we should work on increasing it.

  • caustics.py critical_curve()
  • event.py __init__() with fix_source_flux_ratio commit 562bc2a
  • event.py calculate_chi2_gradient() with one parameter commit 562bc2a
  • event.py model() "if new_value.coords..." commit f413c7e
  • event.py source_fluxes() commit 3b32536
  • fitdata.py scale_fluxes()
  • fitdata.py get_residuals() and more than 1 source
  • fitdata.py calculate_chi2_gradient() for 1 parameter
  • fitdata.py get_dataset_trajectory() with ephemerides file
  • fitdata.py _get_d_u_d_params()
  • fitdata.py source_flux_ratio()
  • limbdarkeningcoeffs.py get_weighted_limb_coeff_gamma()
  • model.py set_times()
  • model.py set_default_magnification_method()
  • model.py get_parallax()
  • model.py parameters()
  • model.py is_static()
  • model.py bandpasses()
  • modelparameters.py _get_standard_parameters_from_Cassan08()
  • modelparameters.py uniform_caustic_sampling()
  • mulensdata.py flux()
  • mulensdata.py err_flux()
  • mulensdata.py data_and_err_in_chi2_fmt()
  • mulensdata.py chi2_fmt()
  • satelliteskycoord.py _check_times() - raise ValueError
  • uniformcausticsampling.py _select_n_points()
  • utils.py get_y_value_y_err()
  • utils.py find_subtract_xlabel()

I've went through output of coverage code and noted the functions which should be covered better by tests. I know it's a lot of work, but we need such a list to start the work. The list is above.

Implemented in commit 562bc2a
2. event.py init() with fix_source_flux_ratio
3. event.py calculate_chi2_gradient() with one parameter (but test FAILS)

In addition to the unit tests, mentioned above, many lines of event.py are not covered by unittests. I am working on making them more complete.

@rpoleski Line 131 is not covered by unit tests. However, in reviewing the data_ref.setter, I find that data_ref is now always int. So, I think:

Lines 128--131:

            if isinstance(self.data_ref, (int)):
                data_ref = self.datasets[self.data_ref]
            else:
                data_ref = self.data_ref

-->

            data_ref = self.datasets[self.data_ref]

Agree?

event.py missing code coverage (wrt commit fa1886b):

  • 131, see above

184-198, plot()
208-254, _plot_lc_default()
260-279, _plot_trajectory_default()
296-300, plot_model()
342-381, plot_data()
394-438, plot_residuals()
446-450, plot_trajectory()
461-467, plot_source_for_datasets()

  • 475-514, _set_default_colors() could be tested.
  • 561, get_ref_fluxes() warning.

567, `fit_blending, deprecated
585, fit_blending, deprecated
613, fit_blending, deprecated
649, fit_blending, deprecated
683, fit_blending, deprecated

  • 715, calculate_chi2_gradient, for 1 parameter

761-764, _sum()

  • 884, _set_data_ref(), new_value = MulensData
  • 891, _set_data_ref(), duplicate datasets

950, comment
984, comment
1016, deprecated
1028, deprecated
1039, deprecated
1043-1052 deprecated