epiverse-trace / epichains

Methods for simulating and analysing the sizes and lengths of infectious disease transmission chains from branching process models
https://epiverse-trace.github.io/epichains/
Other
6 stars 2 forks source link

Remove redundant internal checking functions in favour of {checkmate} functions #162

Closed jamesmbaazam closed 9 months ago

jamesmbaazam commented 10 months ago

Remove internal custom check_offspring_*() fns and use standard checkmate::assert_*()

In general, these functions can be removed in favour of using asserts instead.

  • If retaining any functions or writing new ones, rename all functions to assert_*() to follow the {checkmate} use of 'assert', 'check', 'test' etc to indicate return types. These functions seem to be asserts
  • check_offspring_valid(): could be replaced with an checkmate::assert_string() in all functions that call it; remove this fn
  • check_offspring_func_valid(): could be replaced with a simple checkmate::assert_function() where called, suggest removing.
  • check_generation_time_valid():

    • this function is difficult to judge outside of the context where it's used, suggest moving it.
    • also suggest removing this function and implementing it internally where it is used in the code. It basically seems to be doing rep(x, n) which feels excessive to be passing as an anonymous function
  • check_ntrees_valid(): can be replaced with checkmate::assert_count(); remove

_Originally posted by @pratikunterwegs in https://github.com/epiverse-trace/epichains/pull/122#discussion_r1420338309_