# setup_model

class selfisys.setup_model.ModelSetup(size, L, P, S, G_sim_path, G_ss_path, Pbins_bnd, Pbins, k_s, P_ss_obj_path, P_0, planck_Pk)

  Bases: `NamedTuple`

  G_sim_path: str

    Alias for field number 4

  G_ss_path: str

    Alias for field number 5

  L: float

    Alias for field number 1

  P: int

    Alias for field number 2

  P_0: ndarray

    Alias for field number 10

  P_ss_obj_path: str

    Alias for field number 9

  Pbins: ndarray

    Alias for field number 7

  Pbins_bnd: ndarray

    Alias for field number 6

  S: int

    Alias for field number 3

  k_s: ndarray

    Alias for field number 8

  planck_Pk: ndarray

    Alias for field number 11

  size: int

    Alias for field number 0

selfisys.setup_model.compute_alpha_cv(workdir: str, k_s: ndarray, size: int, L: float, window_fct_path: str | None = None, force: bool = False) → None

  Compute the cosmic variance parameter alpha_cv.

  Parameters:

    - workdir (str) – Directory where the results will be stored.

    - k_s (np.ndarray) – Support wavenumbers.

    - size (int) – Number of elements in each direction of the box.

    - L (float) – Comoving length of the box in Mpc/h.

    - window_fct_path (str, optional) – Path to the window function file.

    - force (bool) – If True, forces recomputation of the inputs.

selfisys.setup_model.setup_model(workdir: str, params_planck: dict, params_P0: dict, size: int = 256, L: float = 3600.0, S: int = 100, N_exact: int = 8, Pinit: int = 50, trim_threshold: int = 100, minval: float | None = None, maxval: float | None = None, force: bool = False) → ModelSetup

  Set up the model by computing or loading necessary grids and parameters.

  Parameters:

    - workdir (str) – Directory where the results will be stored.

    - params_planck (dict) – Parameters for the Planck 2018 cosmology.

    - params_P0 (dict) – Parameters for the normalisation power spectrum.

    - size (int) – Number of elements in each direction of the box.

    - L (float) – Comoving length of the box in Mpc/h.

    - S (int) – Number of support wavenumbers for the input power spectra.

    - N_exact (int) – Number of support wavenumbers matching the Fourier grid.

    - Pinit (int) – Maximum number of bins for the summaries.

    - trim_threshold (int) – Minimum number of modes required per bin.

    - minval (float, optional) – Minimum k value for the summaries.

    - maxval (float, optional) – Maximum k value for the summaries.

    - force (bool) – If True, forces recomputation of the inputs.

  Returns:

    A named tuple containing: - size (int): Number of elements in each direction of the box. - L (float): Comoving length of the box in Mpc/h. - P (int): Number of bins for the summaries. - S (int): Number of support wavenumbers for input powerspectra. - G_sim_path (str): Path to the full Fourier grid file. - G_ss_path (str): Path to the Fourier grid for summaries file. - Pbins_bnd (np.ndarray): Boundaries of summary bins. - Pbins (np.ndarray): Centres of the bins for the summaries. - k_s (np.ndarray): Support wavenumbers for input power spectra. - P_ss_obj_path (str): Path to the summary power spectrum file. - P_0 (np.ndarray): Normalisation power spectrum values. - planck_Pk (np.ndarray): Planck 2018 power spectrum values.

  Return type:

    ModelSetup