from typing import Optional
from typing import Dict
import torch


def sample_periodic_trajectories(
    num_cell_types: int,
    seed: Optional[int] = None,
    a_min: float = -3.0,
    a_max: float = 3.0,
    b_min: float = 0.25,
    b_max: float = 1.0,
    c_min: float = 0.0,
    c_max: float = 5.0,
) -> Dict:
    """Get a sample of coefficients for periodic trajectories
    
    :param num_cell_types: Number of celltypes
    :param seed: Seed for reproducibility
    :param a_min: min value for a
    :param a_max: max value for a
    :param b_min: min value for b
    :param b_max: max value for b
    :param c_min: min value for c
    :param c_max: max value for c
    
    :return: Dictionary of coefficients
    """

    if seed is not None:
        torch.manual_seed(seed)

    # y = a sin(b*x+c)
    a = torch.rand(num_cell_types) * (a_max - a_min) + a_min
    b = torch.rand(num_cell_types) * (b_max - b_min) + b_min
    c = torch.rand(num_cell_types) * (c_max - c_min) + c_min

    return {"a": a, "b": b, "c": c}