Code generation (code_generator package)

Generator of dadi code

gadma.code_generator.dadi_generator.print_dadi_code(engine, values, pts, filename, nanc=None, gen_time=None, gen_time_units=None)

Generates code for dadi to file. Code have function of demographic model that simulates AFS and main part where simulation takes place as well as calculation of log-likelihood.

Parameters
  • engine – Engine that was used with data and model.

  • values – Value of model parameters.

  • pts – Grid sizes for dadi.

  • filename – File to save generated code.

  • nanc – Size of ancestral population. Is used when other engine was used for inference.

  • gen_time – Time of one generation in units of gen_time_units.

  • gen_time_units – Units of time. String.

Note

the last two arguments are ignored as dadi could not draw models.

Generator of moments code

gadma.code_generator.moments_generator.print_moments_code(engine, values, dt_fac, filename, nanc=None, gen_time=None, gen_time_units=None)

Generates code for moments to file. Code have function of demographic model that simulates AFS and main part where simulation takes place as well as calculation of log-likelihood.

Parameters
  • engine – Engine that was used with data and model.

  • values – Value of model parameters.

  • dt_fac – Grid step for moments.

  • filename – File to save generated code.

  • nanc – Size of ancestral population. Is used when other engine was used for inference.

  • gen_time – Time of one generation in units of gen_time_units.

  • gen_time_units – Units of time. String.