This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

classylss

A python binding of the CMB Boltzmann code CLASS, designed for large-scale structure calculations.

The package mainly uses CLASS in order to compute linear power spectra, but the python binding also supports computing nonlinear power spectra and the Cls spectra.

Some of the package features:

  • underyling calculations done in C++, with SWIG used to produce the Python interface
  • a parameter interface with the astropy.cosmology module
  • linear correlation function calculations using FFTLog
  • power spectra and correlation functions in the Zel’dovich approximation

Dependencies

The required external Python dependencies are:

  • astropy
  • numpy

And the necessary compilation tools are:

  • gfortran
  • g++ (>= 4.8, for c++11 support)
  • swig (>= 3.0)

Note that swig can be installed using the anaconda package manager:

conda install "swig>=3.0"

The CLASS code will automatically be downloaded and compiled, and is thus, not an external dependency for the user. The version of CLASS compiled by the code is stored in the variable classylss.version.class_version.

Installation

The package should be compiled using the GNU compilers for C++ and fortran, g++ and gfortran. If these are not the default compilers on your system (or if a specific version should be used), they should be explicitly set via environment variables. Then, the package can be installed via the pip command

# set compilers explicitly, if they are not the default compilers
export CXX=g++
export F90=gfortran

# install the package
pip install classylss

The above procedure has been tested successfully on Mac and Linux machines. However, if installation fails, it is likely due to a failure while compiling either CLASS or the underlying C++ library. In this case, the package should be installed from source and the compilation procedure customized.

The package can be downloaded from github as

git clone https://github.com/nickhand/classylss.git
cd classylss

If CLASS is not built succesfully, the user can edit the default configuration variables in depends/class.cfg, which are used when building the CLASS library.

To verify that the installation has succeeded, run:

import classylss

Examples

To compute power spectra for the Planck 2015 cosmology:

from astropy.cosmology import Planck15
from classylss import power
import numpy

# desired wavenumbers (in h/Mpc)
k = numpy.logspace(-3, 0, 500)

# desired redshift
z = 0

# linear power spectrum in [Mpc/h]^3
Plin = power.linear(k, z, verbose=True, cosmo=Planck15)

# nonlinear power spectrum in [Mpc/h]^3
Pnl = power.nonlinear(k, z, verbose=True, cosmo=Planck15)

# Zeldovich power spectrum in [Mpc/h]^3
Pzel = power.zeldovich(k, z, verbose=True, cosmo=Planck15)

and similarly, correlation functions can be computed:

from classylss import correlation

# desired separation (in Mpc/h)
r = numpy.logspace(0, numpy.log10(150), 500)

# desired redshift
z = 0

# linear 2PCF
cf_lin = correlation.linear(r, z, verbose=True, cosmo=Planck15)

# nonlinear 2PCF
cf_nl = correlation.nonlinear(r, z, verbose=True, cosmo=Planck15)

# Zeldovich power spectrum in [Mpc/h]^3
cf_zel = correlation.zeldovich(r, z, smoothing=1.0, verbose=True, cosmo=Planck15)

All of the above functions accept a class_kwargs keyword, which allows the user to pass any valid CLASS parameter to the CLASS code. The class_kwargs parameter is a dictionary that will be passed to the ClassEngine instance, which is responsible for running CLASS.

Release History

Release History

0.1.5

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2.dev0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
classylss-0.1.5.tar.gz (82.2 kB) Copy SHA256 Checksum SHA256 Source Dec 5, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting