Powspec Documentation

The powspec package provides functions to compute power and cross spectral density of 2D arrays. Units are properly taken into account

Quick start

Here’s a simple script demonstrating the powspec package:

>>> import astropy.units as u
>>> from powspec import power_spectral_density, gen_pkfield

>>> res = 1 * u.arcmin
>>> img = gen_pkfield(npix=1024, fknee=0.1 / u.arcmin, res=res) * u.MJy
>>> print(img.unit)
MJy / arcmin2

>>> powspec_k, k = power_spectral_density(img, res=res)
>>> print(powspec_k.unit)
MJy2 / arcmin2

Getting started

Reference/API

powspec Package

Functions

power_spectral_density(img[, res, bins, ...])

Return the bin averaged power spectral density of an image

cross_spectral_density(img1, img2[, res, ...])

Return the bin averaged cross power spectral density of two images

shrink_mask(mask, kernel)

Shrink mask wrt to a kernel

fft_2d_hanning(mask[, size])

Pk(k[, alpha, fknee])

Simple power law formula

gen_pkfield([npix, alpha, fknee, res])

Generate a gaussian field with (k/k_0)^alpha law.