Synthesis (synthesis)

Systhesise FKP-style paired random catalogues for given survey specifications.

This can be used for determining survey window functions and estimating correlation induced by geometric filtering.

SyntheticCatalogue(number_density, boxsize)

Synthetic catalogue for probing survey geometry.

CovarianceEstimator(realisations[, reference])

Covariance matrix estimator for power spectrum multipoles at fiducial values.

generate_compression_matrix(...[, ...])

Generate a compression matrix for spherical modes.


class harmonia.surveyor.synthesis.SyntheticCatalogue(number_density, boxsize, contrast=None, expansion=1.0, sphericalise=None, mask=None, selection=None, weight=None, apply_selection_as_veto=False)[source]

Synthetic catalogue for probing survey geometry.

Parameters:
  • mean_density (float) – Mean number density (in cubic \(h\)/Mpc).

  • boxsize (float, array_like) – Catalogue boxsize (in Mpc/\(h\)) as a scalar or a triple of scalars.

  • contrast (float or None, optional) – Contrast of the number density of the secondary random catalogue to that of the primary. If None (default), the secondary catalogue is not produced. This cannot be None if sphericalise is provided.

  • expansion (float, optional) – Expansion factor of the catalogue box for grid assignment (default is 1.). Ignored if sphericalise is set.

  • sphericalise (float or None, optional) – If not None (default), this is passed to the radius parameter of SphericalFKPCatalogue for instantiating the synthetic catalogue.

  • mask, selection, weight (callable or None, optional) – Survey mask, selection or weight function (default is None). Must be given as a function of Cartesian coordinate only assuming the origin is at the centre of the catalogues.

  • apply_selection_as_veto (bool, optional) – If True (default is False), selection returning boolean values is applied to the ‘Selection’ column of the catalogues instead of the ‘NZ’ column (see nbodykit documentation for this peculiarity.)

Variables:
compute_spherical_coefficients(disc)[source]

Compute the spherical Fourier density contrast coefficients of the synthetic catalogue.

Parameters:

disc (DiscreteSpectrum) – Discrete spectrum.

Returns:

Density contrast coefficients.

Return type:

SphericalArray

See also

SphericalMap

compute_power(orders, kmin=0.0001, kmax=None, dk=None, num_mesh=256, resampler='tsc', interlaced=True)[source]

Compute the power spectrum multipoles of the synthetic catalogue.

Parameters:
  • orders (sequence of int) – Orders of the power spectrum multipoles.

  • kmin (float, optional) – Minimum wavenumber of the map (in \(h\)/Mpc) (default is 1.e-4).

  • kmax (float or None, optional) – Maximum wavenumber of the map (in \(h\)/Mpc) (default is None). If None, kmax is the Nyquist wavenumber determined from num_mesh.

  • dk (float or None, optional) – Wavenumber bin width (in \(h\)/Mpc) (default is None).

  • num_mesh (int, optional) – Mesh number per dimension for interpolating the discrete catalogues on a grid.

  • resampler ({‘cic’, ‘tsc’, ‘pcs’}, optional) – Grid assignment scheme (default is 'tsc') for catalogue interpolation.

  • interlaced (bool, optional) – If True (default), use interlacing for aliasing mitigation.

Returns:

Power spectrum multipoles binned in wavenumbers.

Return type:

CartesianArray

See also

CartesianMap

compute_window(orders, kmin=1e-06, **kwargs)[source]

Compute the Fourier-space window function multipoles from the synthetic catalogue.

Parameters:
  • orders (sequence of int) – Orders of the power spectrum multipoles.

  • kmin (float, optional) – Minimum wavenumber (in \(h\)/Mpc) (default is 1.e-6).

  • **kwargs – Any other parameters to be passed to compute_power().

Returns:

Window function multipoles binned in logarithmic wavenumbers.

Return type:

CartesianArray

See also

compute_power()

compute_mask(orders, *args, **kwargs)[source]

Compute the configuration-space mask function multipoles from the synthetic catalogue by Hankel transform of the window function multipoles.

Parameters:
  • orders (sequence of int) – Orders of the mask function multipoles.

  • *args, **kwargs – Any other position and keyword parameters to be passed to compute_window(). Only required when window_multipoles is not available.

Returns:

Mask function multipoles binned in logarithmic separations. This is a NumPy structured array similar to array of CartesianArray.

Return type:

numpy.ndarray

See also

CartesianArray

class harmonia.surveyor.synthesis.CovarianceEstimator(realisations, reference=None)[source]

Covariance matrix estimator for power spectrum multipoles at fiducial values.

Parameters:
  • realisations (sequence of CartesianArray) – Independent realisations of power spectrum multipoles from which the covariance matrix is estimated. For each realisation, orders and wavenumbers of the multipoles must be sorted.

  • reference (CartesianArray or None, optional) – Underlying power spectrum multipoles binned in wavenumber that are realised for covariance estimation. Orders and wavenumbers of the multipoles must be sorted. If None (default), this is determined by the average of realisations.

Variables:
  • realisations (sequence of CartesianArray) – Independent realisations of power spectrum multipoles from which the covariance matrix is estimated.

  • reference (CartesianArray or None) – Underlying power spectrum multipoles binned in wavenumber that are realised for covariance estimation.

  • wavenumbers (float ndarray) – Wavenumbers at which the covariance matrix is estimated. This is set by reference if available; otherwise it is set by the first of realisations.

See also

CartesianArray

save(output_file)[source]

Save the estimator with its attributes as a .npz file.

Parameters:

output_file (str or pathlib.Path) – Output file path.

classmethod load(input_file)[source]

Load the estimator with its attributes from a .npz file.

Parameters:

input_file (str or pathlib.Path) – Input file path.

get_fiducial_vector(pivot)[source]

Return the fiducial data vector for which the covariance matrix is estimated.

Parameters:

pivot ({‘order’, ‘wavenumber’}) – Pivot order used for data vectorisation.

Returns:

Fiducial vector.

Return type:

float numpy.ndarray

get_fiducial_covariance(pivot)[source]

Return the fiducial covariance matrix estimated from data realisations.

Parameters:

pivot ({‘order’, ‘wavenumber’}) – Pivot order used for data vectorisation.

Returns:

Estimate fiducialcovariance.

Return type:

float numpy.ndarray

harmonia.surveyor.synthesis.generate_compression_matrix(fiducial_model_kwargs, extremal_model_kwargs=None, sensitivity_threshold=0.01, discard=None)[source]

Generate a compression matrix for spherical modes.

Notes

Compression is achieved by discarding non-positive eigenvalue modes that are at least \(10^{-8}\) times smaller than the largest and in addition any of the following means:

  • discard is passed to discard a number of low-eigenvalue modes;

  • extremal_model_kwargs is passed and eigenvalues of the resulting model covariance are compared with those from fiducial_covariance. Modes corresponding to low, insensitive (i.e. relative difference less than sensitivity_threshold) are discarded.

  • A combination of the above if the appropriate parameters are passed.

Parameters:
  • fiducial_model_kwargs (dict) – Fiducial model parameters to be passed to spherical_covariance().

  • extremal_model_kwargs (dict or None, optional) – Extremal model parameters to be passed to spherical_covariance().

  • sensitivity_threshold (float, optional) – Sensitivity threshold for modes deemed discardable (default is 0.01).

  • discard (int or None, optional) – Number of low-eigenvalue modes to discard from all modes (default is None).

Returns:

compression_matrix – Compression matrix.

Return type:

numpy.ndarray