pipe

Common operations around the core datastructures for running a sim

source

select_and_cross

 select_and_cross (key:<function PRNGKey>,
                   pop:chewc.population.Population, sp:chewc.sp.SimParam,
                   n_parents:int, n_crosses:int, use:str='pheno')

Selects parents and performs random crosses to create a new generation.


source

update_pop_values

 update_pop_values (key:<function PRNGKey>,
                    pop:chewc.population.Population, sp:chewc.sp.SimParam,
                    h2:jaxtyping.Float[Array,'nTraits'])

*Calculates genetic and phenotypic values for a new population.

This is a common pipeline step after creating progeny, who are born with only genotypic information.

Args: key: A JAX random key for phenotypic noise generation. pop: The population of new individuals (e.g., progeny). sp: The simulation parameters, containing trait information. h2: The heritability for the trait(s) being phenotyped.

Returns: A new Population object with updated bv and pheno attributes.*


source

select_ind

 select_ind (pop:chewc.population.Population, n_ind:int,
             use:Union[str,Callable[[chewc.population.Population],jax.Arra
             y]]='pheno', select_top:bool=True)

*Selects the top or bottom individuals from a population.

Args: pop: The population to select from. n_ind: The number of individuals to select. use: The criterion for selection. Can be a string (‘gv’, ‘bv’, ‘pheno’, ‘ebv’) or a custom function that takes a Population and returns a 1D array of selection values. select_top: If True, selects the highest values; otherwise, selects the lowest.

Returns: A new, smaller Population object with the selected individuals.*