SpectralLoss

class cosmax.spectral_ops.SpectralLoss(elements: int, bins: int, size: float = 1.0)

Bases: SpectralOperation

Compute the MSE in spectral space for each wavenumber

Parameters:
  • elements – number of grid points in each dimension

  • bins – number of bins for the power spectrum

  • size – size of the box in real space

elements

number of grid points in each dimension

Type:

int

size

jax.Array

Type:

float

bins

number of bins for the power spectrum

Type:

int

index_grid

index of the bin for each wavenumber

Type:

jax.Array

n_modes

number of modes in each bin

Type:

jax.Array

Methods Summary

__call__(delta_a, delta_b)

Compute the power spectrum from a 3D density field

Methods Documentation

__call__(delta_a: Array, delta_b: Array) Tuple[Array, Array]

Compute the power spectrum from a 3D density field

Parameters:
  • pred – 3D density field

  • true – 3D density field

Returns:

wavenumber and power spectrum