Skip to main content

Python wrapper for the COrrelation Function Full-sky Estimator code

Project description

COFFE v3

This is the public repository for the code COFFE (COrrelation Function Full-sky Estimator), which can be used to compute the following quantities in linear perturbation theory:

  • full-sky and flat-sky 2-point correlation function (2PCF) of galaxy number counts, taking into account all of the effects (density, RSD, lensing, etc.)
  • full-sky and flat-sky multipoles of the 2PCF
  • redshift-averaged multipoles of the 2PCF
  • flat-sky Gaussian covariance matrix of the multipoles of the 2PCF
  • flat-sky Gaussian covariance matrix of the redshift-averaged multipoles of the 2PCF

The relevant theoretical papers are:

Installation

From pip

If you are on Linux or MacOS, the latest version of COFFE can be installed using:

pip install coffe

Note that Windows is not officially supported.

If you wish to install the development version of COFFE, please refer to the section below.

Development version

NOTE: the use of a virtual environment (such as Python's venv) is highly recommended.

Prerequisites

If you would like to install the development version, you will need to first have the following:

  • a C compiler, compatible with the C99 standard
  • a Python interpreter, version 3.8 or above
  • GSL (GNU Scientific Library) and the corresponding headers, version 2.1 or above (available as libgsl-dev on Debian-based, and as gsl-devel on RHEL/CentOS-based distros)
  • FFTW and the corresponding headers, version 3 or above (available as libfftw3-dev on Debian-based, and as fftw-devel on RHEL/CentOS-based distros)
  • libconfig

Then clone this repository:

git clone https://github.com/JCGoran/coffe

then change directory to it:

cd coffe

Linux (CentOS/RHEL based)

Run the script:

bash scripts/install_other.sh gsl fftw libconfig

Linux (Debian/Ubuntu based)

Run the following command:

sudo apt install libgsl-dev libfftw3-dev libconfig-dev

and follow the instructions from the prompt.

MacOS (Homebrew)

You can install the necessary prerequisites using Homebrew:

brew install gsl fftw libconfig

NOTE: as a technical aside, Homebrew-installed packages (whether installed as pre-build binaries or from source) are built for the current version of your operating system. This means that they CANNOT be used to create a redistributable Python wheel, i.e. a wheel that works on any older version of MacOS.

MacOS (Conan)

As an alternative to Homebrew, one can use Conan to build the dependencies.

First install Conan using:

pip install conan

Then, generate a profile:

conan profile detect

Finally, install all of the dependencies in the _build directory:

conan install . --output-folder=_build --build=missing

Note that this may take a while as the packages are usually built from source.

IMPORTANT NOTE: Due to the fact that newer Apple devices have dual architectures (both arm64 and x86_64), it is recommended to not mix these together, i.e. you should re-run all of the above in clean arm64 and x86_64 environments (terminals) in separate COFFE directories to avoid any issues.

Installing CLASS and CUBA

COFFE also depends on the CLASS and CUBA libraries, which are not available on Homebrew or Conan, or the default Linux package repositories. To install them, one needs to install automake, either via Homebrew (brew install automake) or via some other package manager. They can then be built and installed by running:

bash scripts/install_other.sh class cuba

This will install the two packages in the directories /opt/cuba_[ARCH] and /opt/class_public_[ARCH], where arch is either x86_64 or arm64 depending on your CPU architecture.

Installing COFFE

Now that the prerequisites are installed, you can install COFFE using:

pip install .

If you would additionally like to install all of the various tools for testing, generating docs, and development, you can additionally run:

pip install '.[all]'

Documentation

The documentation for the latest version is available here. To build the documentation, you can run bash scripts/generate_docs.sh, after which the documentation will be available under docs/.

Bug reports and feature requests

Please use the issue tracker to submit any bug reports and feature requests.

License

COFFE is licensed under the GNU GPL 3.0. See the LICENSE file for more information.

Citations

If you use COFFE in a publication, we kindly ask that you cite the original paper describing the code, located at arXiv:1806.11090. A bibTeX entry is provided below for convenience.

@article{coffe:v1,
      author         = "Tansella, Vittorio and Jelic-Cizmek, Goran and Bonvin,
                        Camille and Durrer, Ruth",
      title          = "{COFFE: a code for the full-sky relativistic galaxy
                        correlation function}",
      year           = "2018",
      eprint         = "1806.11090",
      archivePrefix  = "arXiv",
      primaryClass   = "astro-ph.CO",
      SLACcitation   = "%%CITATION = ARXIV:1806.11090;%%"
}

Development

Testing COFFE

If you would like to test COFFE, you can do so in two ways: using either pytest, or cmake (deprecated).

Testing with pytest

To run the tests via pytest, first install COFFE using the instructions above, and then run:

python -m pytest tests/

Testing with cmake (deprecated)

If you do not want to build COFFE using pip install, you can instead use cmake, which is installable via pip install cmake. To do so, follow all of the above instructions, but instead of doing pip install ., you can instead do:

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=./install -DCOFFE_ENABLE_PYTHON=ON -DCOFFE_ENABLE_CLASS=ON -DCOFFE_ENABLE_CUBA=ON -DCOFFE_ENABLE_MATHOPTS=ON -DCOFFE_ENABLE_TESTS=ON ..

In case of issues with missing detection of GSL, FFTW, etc., which can happen when using Conan on MacOS, you can use:

cmake -DCMAKE_INSTALL_PREFIX=./install -DCOFFE_ENABLE_PYTHON=ON -DCOFFE_ENABLE_CLASS=ON -DCOFFE_ENABLE_CUBA=ON -DCOFFE_ENABLE_MATHOPTS=ON -DCOFFE_ENABLE_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=../_build/conan_toolchain.cmake -DCOFFE_PYTHON_MINOR_VERSION=[VERSION] ..

where you must replace [VERSION] with whatever minor version of Python you are using (for instance, when using Python 3.9, replace [VERSION] with 9). Then you can build COFFE tests using:

make

NOTE: if you have Ninja installed, you can additionally pass -G Ninja to the above cmake command, and then run ninja build instead of make.

Finally, run the tests using:

ctest

Building Python wheels

The building of wheels is done using the cibuildwheel utility. To install it, run:

pip install cibuildwheel

Linux

Building of wheels on Linux requires a container engine like Docker or Podman. Once one of those is installed, the wheels can be built using:

cibuildwheel --platform linux

The wheels will then be available in the wheelhouse subdirectory, and can then be uploaded to PyPI.

MacOS

The MacOS wheels require an official Python installer; the ones from Homebrew, Conda, etc. will most likely not work. To build the wheels, run:

cibuildwheel --platform macos

The wheels will then be available in the wheelhouse subdirectory, and can then be uploaded to PyPI.

IMPORTANT NOTE: if you installed GSL, FFTW, or libconfig via Brew, make sure to unlink them first using:

brew unlink gsl fftw libconfig

because otherwise cibuildwheel (or rather, auditwheel) may complain about mismatching OS versions.

Releasing Python wheels

To automate the tedious task of building the wheels, they are now setup in the CI.

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

coffe-3.0.1-cp312-cp312-manylinux_2_28_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ x86-64

coffe-3.0.1-cp312-cp312-macosx_11_0_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12 macOS 11.0+ x86-64

coffe-3.0.1-cp312-cp312-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

coffe-3.0.1-cp311-cp311-manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

coffe-3.0.1-cp311-cp311-macosx_11_0_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11 macOS 11.0+ x86-64

coffe-3.0.1-cp311-cp311-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

coffe-3.0.1-cp310-cp310-manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

coffe-3.0.1-cp310-cp310-macosx_11_0_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

coffe-3.0.1-cp310-cp310-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

coffe-3.0.1-cp39-cp39-manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

coffe-3.0.1-cp39-cp39-macosx_11_0_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

coffe-3.0.1-cp39-cp39-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

coffe-3.0.1-cp38-cp38-manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

coffe-3.0.1-cp38-cp38-macosx_11_0_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.8 macOS 11.0+ x86-64

coffe-3.0.1-cp38-cp38-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

File details

Details for the file coffe-3.0.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 92441ec6b36d9a1b67c6342b336729e1157856637a1df7bd3822a77516196b13
MD5 164d00c8293a5f6cd8df9e8e1d3f2f23
BLAKE2b-256 ed4345d1743dffbf2a9e59620529f7af0dae78e9d0a06f5f25101944628ab4d3

See more details on using hashes here.

File details

Details for the file coffe-3.0.1-cp312-cp312-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 3c22bcd97566190de28eda67c1d72ed5ef92c4798d768c30371510c1dcf30a10
MD5 ea0fd5b74688a57fad1855550f2fa9de
BLAKE2b-256 6736cfcfc964b2b7db0b0d3095640bb47f659adce03bd683c42b02b4c7adef4e

See more details on using hashes here.

File details

Details for the file coffe-3.0.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 453412771e53ecaeee5e4842e4b1ec88b06ab7a5e65cfd8470193a5b6235bf39
MD5 99867515ea307d305ac6a924cef214c6
BLAKE2b-256 ad2b7996abf4a00087139ed9ed218ab80b43487d48f80ac4fb33a7ed8cba63f0

See more details on using hashes here.

File details

Details for the file coffe-3.0.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 51109b3c5920fbd4e0a9ec898ff5255391915db023dc4432d48aa351265b58fa
MD5 f0b077afd6aa29b5a7de17f96a3cde2d
BLAKE2b-256 db5b87799241574702eb4ca88d5a614beb12e80389bd3c028b54b4ff85a3453c

See more details on using hashes here.

File details

Details for the file coffe-3.0.1-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 9229905b6ae23b225067c007596f3d19db1444b8bb31b655c06b2f0f0a133470
MD5 32c1646c8d04bf55340a45ee2e7de605
BLAKE2b-256 f0a19c205ec2fc4666f0392b6a26e5b261c019d16d5b572251a1c74c45f3d16e

See more details on using hashes here.

File details

Details for the file coffe-3.0.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 707bb3bdb11f3120b13be6818d6c4f2dca764c91884a2ef350b11d49f755aeb7
MD5 63828a301332b13735795e19581e9253
BLAKE2b-256 0c267606e7fa6aa4161d77d465bc6c4c2b4d96a47a6163f25a9dbe753c861ea1

See more details on using hashes here.

File details

Details for the file coffe-3.0.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b128c215bd3f734d46183477cffecb73be420c5a4f9886e8b4ef93e28dc4815d
MD5 917ce07223d7871a3354939b2ca22acd
BLAKE2b-256 1f127ffbd9002ba10c95c69bf7565f38ceeaefda22203a631b4f53ea991f5d41

See more details on using hashes here.

File details

Details for the file coffe-3.0.1-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 71030afce2538d3cdcdc8235955df7f2a53212897fd196e6da000a0785727c79
MD5 9011c2806292801d617acd739db8706a
BLAKE2b-256 cac23d467f8d578f1f1b9796b6b58de14b74a0ba4ccc76d8033092712fc84965

See more details on using hashes here.

File details

Details for the file coffe-3.0.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eb19ddc5c878c32344682e743f193494663d8ffd1c472a3fb7b4216f1b8bcfdb
MD5 5b3c6baa581483316e12c11a09470712
BLAKE2b-256 dd45783df5161444f0d50e92091b1dea3ffa3cf5fe1b38c70184eff275b9c73f

See more details on using hashes here.

File details

Details for the file coffe-3.0.1-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 667480313478c87619ee6c7a492abe1a334afb57b153ac2ad9248abddd36c5c5
MD5 350ae8e30e66c0bd7f634be1b291a5c1
BLAKE2b-256 25feb6cf979253aaf38220aa41723ee63ae79c5efecdfd36b46914fde21c4384

See more details on using hashes here.

File details

Details for the file coffe-3.0.1-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 1657be9e327628992aac9dac71b5b22456f933dd1381dede5ad1117d022cc5f7
MD5 a6a0d225a849955b9c116fa1a52a3d9c
BLAKE2b-256 5a16060ecd440b1d30a3eae4620d578ec9ae7a47c7767b59f7a49900006baebb

See more details on using hashes here.

File details

Details for the file coffe-3.0.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8d7cb8ab5f3267cde3cfc69b88c5590463ec15f0692b5b8f72c5542c9993b127
MD5 ee393ff6ca1545b31d966db18136cc25
BLAKE2b-256 11724f2a0443e89b36207ab482bf26b6f3f6ae18347830f0e6c9296796278f6b

See more details on using hashes here.

File details

Details for the file coffe-3.0.1-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d12451d1385419ff048c359c4fd91da098f6f8007f56b49211ebe77afce64812
MD5 8d7d104dd830bb62a179d7ff7ebe9436
BLAKE2b-256 de137cca523c8db4226c6feeb84f1feda8d859a71d681fb12be579da57ed9c9f

See more details on using hashes here.

File details

Details for the file coffe-3.0.1-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 88cc5b1c073e3e35c399d33c91de0d85e66c8411e911ef8a0f7db64ea56cbd32
MD5 d8e9505cf415efaf4b4e46c19a07f002
BLAKE2b-256 a5fadac79cedc0132a9a8303bb4f158097fb873ce52628ca8668418453a91ac8

See more details on using hashes here.

File details

Details for the file coffe-3.0.1-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for coffe-3.0.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 380c1288f28dc0c0a1e90d1fccae339d4aedaebbab753ea0068a097f50c28c53
MD5 d1979b7260456ff8c87e348996936ef9
BLAKE2b-256 3883de617521388d91ec123747e6c2c8f073e83911837a128a5f82e8ff3cb34b

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