Ximinf Documentation

Welcome to ximinf — Simulation-Based Inference of Cosmological Parameters in JAX using Type Ia Supernovae.

This documentation will guide you through installation, usage, and the API reference.

Contents

Quickstart

import ximinf

API Reference

ximinf.generate_sim.scan_params(priors, N, n_realisation=1, dtype=<class 'numpy.float32'>)[source]

Generate sampled parameter sets using Latin Hypercube Sampling (LHS), using the per-parameter priors defined in priors.

Parameters:
  • priors (dict) – Mapping param name -> {‘range’: (low, high), ‘type’: str}. Supported types: ‘uniform’, ‘gaussian’, ‘half-gaussian’, ‘log-uniform’.

  • N (int) – Number of distinct parameter tuples.

  • n_realisation (int, optional) – Number of realizations per parameter tuple.

  • dtype (data-type, optional) – Numeric type for the sampled arrays (default is np.float32).

Returns:

params_dict – Dictionary of parameter arrays of shape (N * n_realisation,).

Return type:

dict

ximinf.generate_sim.simulate_one(params_dict, z_max, M, cols, errormodel=None, N=None, i=None, survey_name=None, lightcurve=False)[source]

Simulate a single dataset of SNe Ia.

Parameters:
  • params_dict (dict) – Dictionary of model parameters (alpha, beta, mabs, gamma, sigma_int, etc.).

  • z_max (float) – Maximum redshift.

  • M (int) – Number of SNe to simulate.

  • cols (list of str) – List of columns to include in the output.

  • errormodel (dict, optional) – Error model to apply to the simulated data.

  • N (int, optional) – Total number of simulations (for progress printing).

  • i (int, optional) – Current simulation index (for progress printing).

  • survey (str, optional) – Name of the survey (e.g., ‘ztf’, ‘snls’) to apply the corresponding selection function.

Returns:

data_dict – Dictionary of lists (one per column) containing the simulated data.

Return type:

dict

ximinf.selection_effects.apply_malmquist_bias(results, loc=18.8, scale=4.5, rng=None)[source]

Apply a stochastic magnitude-limit selection using a sigmoid function.

Each SN i is selected with probability:

P_detect = 1 - expit((mag_i - loc) * scale)

Rejected SNe are removed (no zero padding).

Parameters:
  • results (list of dict) – Each element is output of simulate_one.

  • loc (float) – Sigmoid midpoint.

  • scale (float) – Sigmoid steepness.

  • rng (np.random.Generator, optional)

Returns:

  • biased_results (list of dict) – Same structure as input but containing only detected SNe.

  • masks (list of np.ndarray) – Boolean selection masks per simulation.