randomfield

This package provides utilities for efficient generation of random fields for cosmology.

Reference/API

randomfield.generate Module

High-level functions to generate random fields.

Classes

Generator(nx, ny, nz, grid_spacing_Mpc_h[, ...]) Manage random field generation for a specified geometry.

Class Inheritance Diagram

Inheritance diagram of randomfield.generate.Generator

randomfield.cosmotools Module

Calculate cosmological quantities.

Functions

apply_lognormal_transform(delta, growth[, sigma]) Transform delta values drawn from a normal distribution with mean zero and standard deviation sigma to have a log-normal distribution with mean one and standard deviation growth * sigma.
calculate_power(cosmology, k_min, k_max[, ...]) Calculate the power spectrum P(k,z) over the range k_min <= k <= k_max.
create_cosmology(*args, **kwargs) Create a background cosmology model.
get_class_parameters(cosmology) Get CLASS parameters corresponding to an astropy cosmology model.
get_growth_function(cosmology, redshifts) Calculate the growth function.
get_mean_matter_densities(cosmology, redshifts) Calculate mean densities in g / cm**3.
get_redshifts(cosmology, data, spacing[, ...]) Calculate the redshift grid.

randomfield.powertools Module

Utilities for working with tabulated power spectra.

Functions

create_ksq_grids(data, spacing, packed)
fill_with_log10k(data, spacing[, packed]) Fill an array with values of log10(k).
filter_power(power, sigma[, out]) Apply a Gaussian filtering to a power spectrum.
get_k_bounds(data, spacing[, packed]) Return the bounds of wavenumber values for the specified grid.
load_default_power() Loads a default power spectrum P(k,z) with 1e-4 <= k <= 22 and z = 0.
tabulate_sigmas(data, power, spacing[, packed]) Replace an array of log10(k) values with the corresponding sigmas.
validate_power(power) Validates a power spectrum.

randomfield.transform Module

Provide a uniform interface to numpy.fft and pyfftw transforms.

Functions

allocate(shape, dtype[, use_pyfftw]) Allocate a contiguous block of un-initialized typed memory.
complex_type(scalar_type) Determine the complex type corresponding to a component scalar type.
expanded_shape(data[, packed]) Determine the expanded shape of a 3D array.
is_hermitian(data[, packed, rtol, atol]) Test if a 3D field is Hermitian.
scalar_type(complex_type) Determine the type of the real and imaginary parts of a complex type.
symmetrize(data[, packed]) Symmetrize a complex 3D field so that its inverse FFT is real valued.

Classes

Plan(shape[, dtype_in, data_in, overwrite, ...]) A plan for performing fast Fourier transforms on a single buffer.

Class Inheritance Diagram

Inheritance diagram of randomfield.transform.Plan

randomfield.random Module

Generate random numbers.

Functions

randomize(data[, seed]) Randomize data by multiplying existing sigma values by normal deviates.