# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/04_crossing.ipynb.

# %% auto 0
__all__ = ['make_DH', 'make_cross', 'truncate_select']

# %% ../nbs/04_crossing.ipynb 4
from .core import *
from .meiosis import *
from .trait import *
import torch
import random
def make_DH(sim_param, individual):
    haploid_line = simulate_gametes(sim_param.genome.genetic_map, individual, sim_param.device)
    return haploid_line.repeat(2, 1, 1)

def make_cross(sim_param, mother, father):
    egg = simulate_gametes(sim_param.genome.genetic_map, mother)  # Simulating gametes for the mother
    pollen = simulate_gametes(sim_param.genome.genetic_map, father)  # Simulating gametes for the father
    return torch.stack((egg, pollen), dim=0).squeeze(1)

def truncate_select(tgv, device):
    return torch.topk(tgv.to(device), 20).indices
