sbmy_interface

selfisys.sbmy_interface.compute_Phi(G_ss_path, P_ss_path, g_obj, norm, AliasingCorr=True, verbosity=1)[source]

Compute the summary statistics from a field object, based on a provided summary-statistics Fourier grid and baseline spectrum.

Parameters:
  • G_ss_path (str) – Path to the FourierGrid file used for summary-statistics.

  • P_ss_path (str) – Path to the baseline power spectrum file for normalisation.

  • g_obj (Field) – Input field object from which to compute summary statistics.

  • norm (ndarray) – Normalisation constants for the summary statistics.

  • AliasingCorr (bool, optional) – Whether to apply aliasing correction. Default is True.

  • verbosity (int, optional) – Verbosity level (0=quiet, 1=normal, 2=debug). Default 1.

Returns:

Phi – Vector of summary statistics.

Return type:

ndarray

Raises:
  • OSError – If file reading fails at G_ss_path or P_ss_path.

  • RuntimeError – If unexpected issues occur during computation.

selfisys.sbmy_interface.generate_white_noise_Field(L, size, seedphase, fname_whitenoise, seedname_whitenoise, force_phase=False)[source]

Generate a white noise realisation in physical space and write it to disk.

Parameters:
  • L (float) – Size of the simulation box (in Mpc/h).

  • size (int) – Number of grid points along each axis.

  • seedphase (int or list of int) – User-provided seed to generate the initial white noise.

  • fname_whitenoise (str) – File path to write the white noise realisation.

  • seedname_whitenoise (str) – File path to write the seed state of the RNG.

  • force_phase (bool, optional) – If True, forces regeneration of the random phases. Default is False.

Raises:
  • OSError – If file writing fails or directory paths are invalid.

  • RuntimeError – For unexpected issues.

selfisys.sbmy_interface.get_power_spectrum_from_cosmo(L, size, cosmo, fname_power_spectrum, force=False)[source]

Compute a power spectrum from cosmological parameters and save it to disk.

Parameters:
  • L (float) – Size of the simulation box (in Mpc/h).

  • size (int) – Number of grid points along each axis.

  • cosmo (dict) – Cosmological parameters (and infrastructure parameters).

  • fname_power_spectrum (str) – Name (including path) of the power spectrum file to read/write.

  • force (bool, optional) – If True, forces recomputation even if the file exists. Default is False.

Raises:
  • OSError – If file writing fails or the directory path is invalid.

  • RuntimeError – For unexpected issues during power spectrum computation.

selfisys.sbmy_interface.handle_time_stepping(aa: List[float], total_steps: int, modeldir: str, figuresdir: str, sim_params: str, force: bool = False) Tuple[List[int] | None, float | None][source]

Create and merge individual time-stepping objects.

Parameters:
  • aa (list of float) – List of scale factors in ascending order.

  • total_steps (int) – Total number of time steps to distribute among the provided scale factors.

  • modeldir (str) – Directory path to store generated time-stepping files.

  • figuresdir (str) – Directory path to store time-stepping plots.

  • sim_params (str) – Simulation parameter string (e.g., “custom”, “std”, “nograv”).

  • force (bool, optional) – Whether to force recompute the time-stepping files. Default is False.

Returns:

  • merged_path (str) – Path to the merged time-stepping file.

  • indices_steps_cumul (list of int or None) – Cumulative indices for the distributed steps. Returns None if using splitLPT or if sim_params indicates an alternative strategy.

  • eff_redshifts (float or None) – Effective redshift derived from the final scale factor in ‘custom’ or ‘nograv’ mode. None otherwise.

Raises:
  • NotImplementedError – If a unsupported time-stepping strategy is used.

  • OSError – If file or directory operations fail.

  • RuntimeError – If unexpected issues occur during time-stepping setup.

selfisys.sbmy_interface.setup_sbmy_parfiles(d, cosmology, file_names, hiddenbox_params, force=False)[source]

Set up Simbelmynë parameter file (please refer to the Simbelmynë documentation for more details).

Parameters:
  • d (int) – Index (from 1 to S) specifying a direction in parameter space, 0 for the expansion point, or -1 for mock data.

  • cosmology (array, double, dimension=5) – Cosmological parameters.

  • file_names (dict) – Dictionary containing the names of the input/output files for the simulation.

  • hiddenbox_params (dict) – See the HiddenBox class for more details.

  • force (bool, optional, default=False) – If True, forces recompute the simulation parameter files.