tracts.core.optimize_cob_sex_biased_single_step#

optimize_cob_sex_biased_single_step(p0, population, genetic_model, likelihood_options=None, p_dict=None, exclude_tracts_below_cM=0, maxiter=None, reset_counter=True, npts=50, print_step_header=True)#

Optimizes the log-likelihood over all parameters defined by the demographic model, given a specified pair of admixture models for autosomes and allosomes. The optimization is carried out jointly in a single step, estimating all parameters simultaneously using both autosomal and allosomal data.

Parameters:
  • p0 (list) – An array of initial parameters to start the optimization.

  • population (Population) – A Population object containing the data to fit.

  • genetic_model (GeneticModel) – Bundles the demographic model (whose parameter_handler handles parameter transformations and fixed parameters, and whose model_func/outofbounds_fun methods compute migration matrices and violation scores) with the admixture and phase-type model configuration (ad_model_autosomes, ad_model_allosomes, rho_f, rho_m, TP, N_cores) used to compute the likelihood.

  • likelihood_options (LikelihoodOptions | None) – Logging verbosity (verbose_log, verbose_screen) for this optimization run. Its include_autosomes/include_allosomes flags are ignored here: allosomes are included whenever genetic_model.phase_type_config.ad_model_allosomes is not None. If None, defaults to LikelihoodOptions().

  • p_dict (dict) – A dictionary mapping population labels to their corresponding indices in the model.

  • exclude_tracts_below_cM (float) – Minimum tract length in centimorgans to exclude from analysis. Default is 0.

  • maxiter (int) – Maximum iterations to run for.

  • reset_counter (bool) – Resets the iteration counter to zero. Set to False to continue iteration count (e.g., if optimization continues from previous point).

  • npts (int) – Number of bins for the tract length histogram. Default is 50.

  • print_step_header (bool) – If True, print the admixture-model title and parameter-set subtitle at the start of the optimization. If False, only the iteration table header is printed. For internal use only; set automatically by run_model_multi_init() to suppress repeated headers across multiple runs within the same step. Default is True.

Returns:

A tuple containing the optimal parameters found and the corresponding likelihood.

Return type:

tuple[ndarray, float]