jaxpint.simulation#

TOA simulation for JaxPINT.

Provides functions to adjust TOA timestamps so they encode a deterministic timing model (zero residuals) and to apply arbitrary time delays to TOAs.

The zero_residuals function iteratively shifts each TOA by its time residual until the model prediction matches the observation time, analogous to pint.simulation.zero_residuals().

jaxpint.simulation.apply_delay_to_toas(toa_data, delays_seconds)[source]#

Return a new TOAData with time delays added to MJD and TDB fields.

Converts delays_seconds to days, adds to the fractional part of each timestamp, and renormalises so frac stays in [0, 1).

Parameters:
  • toa_data (TOAData) – Input TOA data (not modified).

  • delays_seconds ((n_toas,)) – Time delays in seconds. Positive values shift TOAs later.

Returns:

Copy of toa_data with mjd_int/mjd_frac and tdb_int/tdb_frac updated.

Return type:

TOAData

jaxpint.simulation.zero_residuals(model, toa_data, params, *, maxiter=10, tolerance=1e-09)[source]#

Iteratively adjust TOA times until residuals are approximately zero.

Each iteration computes time residuals and subtracts them from the TOA timestamps, converging in ~2-3 iterations. After convergence the TOA timestamps encode the full deterministic timing model.

Parameters:
  • model (TimingModel) – JaxPINT timing model.

  • toa_data (TOAData) – Input TOAs (not modified).

  • params (ParameterVector) – Timing model parameters.

  • maxiter (int) – Maximum number of iterations.

  • tolerance (float) – Convergence threshold on max(|residual|) in seconds. Default is 1e-9 s (1 ns).

Returns:

Adjusted TOAs with residuals < tolerance.

Return type:

TOAData

Raises:

RuntimeError – If convergence is not reached within maxiter iterations.

jaxpint.simulation.simulate_noise(toa_data, params, key, noise_components)[source]#

Generate a combined noise realization from multiple noise sources.

Each component receives an independent PRNG key derived from key.

Parameters:
  • toa_data (TOAData) – TOA data (used for uncertainties, flags, and array sizes).

  • params (ParameterVector) – Timing model parameters (including noise parameter values).

  • key (JAX PRNG key) – Random key; split internally for each component.

  • noise_components (sequence of NoiseComponent) – Noise sources to sample from.

Returns:

Total noise delay in seconds.

Return type:

(n_toas,)

jaxpint.simulation.make_fake_toas(model, toa_data, params, key, noise_components=())[source]#

Create simulated TOAs: zero residuals, then optionally add noise.

Parameters:
  • model (TimingModel) – JaxPINT timing model.

  • toa_data (TOAData) – Input TOAs (not modified).

  • params (ParameterVector) – Timing model parameters.

  • key (JAX PRNG key) – Random key for noise generation.

  • noise_components (sequence of NoiseComponent) – Noise sources to add. If empty, returns noiseless TOAs.

Returns:

Simulated TOAs with residuals encoding only noise.

Return type:

TOAData