Skip to main content

Create arbitrary boxes with isotropic power spectra

Project description

Make arbitrarily structured, arbitrary-dimension boxes.

powerbox is a pure-python code for creating density grids (or boxes) that have an arbitrary two-point distribution (i.e. power spectrum). Primary motivations for creating the code were the simple creation of lognormal mock galaxy distributions, but the methodology can be used for other applications.

Features

  • Works in any number of dimensions.

  • Arbitrary isotropic power-spectra.

  • Option to transform density field to log-normal field.

  • Really simple.

Installation

Clone/Download then python setup.py install.

Basic Usage

At this point, there’s just a single class that is useful: PowerBox. You can import it like

>>> from powerbox import PowerBox

Once imported, to see all the options, just use help:

>>> help(PowerBox)

For a basic 2D Gaussian field with a power-law power-spectrum, one can use the following:

>>> pb = PowerBox(N=512,  ## Number of grid-points in the box
                  dim=2,  ## 2D box
                  pk = lambda k: 0.1*k**-2., ## The power-spectrum
                  boxlength = 1.0 ## Size of the box (sets the units of k in pk)
                  )
>>> import matplotlib.pyplot as plt
>>> plt.imshow(pb.delta_x)

Other attributes of the box can be accessed also – check them out with tab completion in an interpreter!

TODO

  • Proper calibration of transforms

  • Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

powerbox-0.1.0-py3.6.egg (10.2 kB view details)

Uploaded Source

powerbox-0.1.0-py2.7.egg (10.7 kB view details)

Uploaded Source

File details

Details for the file powerbox-0.1.0-py3.6.egg.

File metadata

  • Download URL: powerbox-0.1.0-py3.6.egg
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for powerbox-0.1.0-py3.6.egg
Algorithm Hash digest
SHA256 539ccc6a4074acfd946e972ae309f1d0e1a5729d8d79a94c38250633a74919bc
MD5 90f6cbdf1b6745f1e800d349b2c622da
BLAKE2b-256 f0bb837da0b4c2852f5a9e30d8d547078f8556b995a4d7a6c37465eb7b5478ae

See more details on using hashes here.

File details

Details for the file powerbox-0.1.0-py2.7.egg.

File metadata

  • Download URL: powerbox-0.1.0-py2.7.egg
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for powerbox-0.1.0-py2.7.egg
Algorithm Hash digest
SHA256 92b141568996822e64042dfff3c43610a51cb53838d76e3c6e30c646e87789fe
MD5 31295819aee3d8a7651e419d5fbbdb69
BLAKE2b-256 27b587d473f64b896a852cd696a8cabe5d73dd1e0cf4623cf3a767ec8ee9e40a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page