tracts.legacy.test_model_func#

test_model_func(model_func, parameters, fracs_list=None, time_params=True, time_scale=100)#

Given a demographic model function, run a few debugging tests to ensure that it behaves as expected, namely: (i) that migration matrices sum to less than one (exactly one for the last generation, (ii) that it behaves continuously realtive to time parameters.

Parameters:
  • model_func – A migration model. It takes in parameters and outputs a migration matrix.

  • parameters – Parameters for which the model will be tested.

  • fracs_list (default None) – Parameters required by some demographic models corresponding to the observed proportion of ancestry from each source population.

  • time_params (default True) – If True, test all parameters for continuity as if they were time parameters. If a list of boolean values of the same length of parameters, only test parameters corresponding to True values.

  • time_scale (default 100) – The scaling of the time variables: time (in generations) = time_parameter*time_scale. This is used to test continuity around integer values.

Returns:

A tuple with the minimum violation score (negative means that a violation has occurred) and the migration matrix value as well.