Skip to main content

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.

Metadata

Release files for coffe 3.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for coffe 3.0.1
File
coffe-3.0.1-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
coffe-3.0.1-cp312-cp312-macosx_11_0_x86_64.whl CPython 3.12 CPython 3.12 macOS 11.0+ x86-64 Details
coffe-3.0.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
coffe-3.0.1-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details
coffe-3.0.1-cp311-cp311-macosx_11_0_x86_64.whl CPython 3.11 CPython 3.11 macOS 11.0+ x86-64 Details
coffe-3.0.1-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
coffe-3.0.1-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details
coffe-3.0.1-cp310-cp310-macosx_11_0_x86_64.whl CPython 3.10 CPython 3.10 macOS 11.0+ x86-64 Details
coffe-3.0.1-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
coffe-3.0.1-cp39-cp39-manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.28+ x86-64 Details
coffe-3.0.1-cp39-cp39-macosx_11_0_x86_64.whl CPython 3.9 CPython 3.9 macOS 11.0+ x86-64 Details
coffe-3.0.1-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details
coffe-3.0.1-cp38-cp38-manylinux_2_28_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.28+ x86-64 Details
coffe-3.0.1-cp38-cp38-macosx_11_0_x86_64.whl CPython 3.8 CPython 3.8 macOS 11.0+ x86-64 Details
coffe-3.0.1-cp38-cp38-macosx_11_0_arm64.whl CPython 3.8 CPython 3.8 macOS 11.0+ ARM64 Details

Total release size: 30.7 MB

Release files / coffe-3.0.1-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL coffe-3.0.1-cp312-cp312-manylinux_2_28_x86_64.whl
Size 3.1 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
92441ec6b36d9a1b67c6342b336729e1157856637a1df7bd3822a77516196b13
BLAKE2b-256 checksum
How to use checksums
ed4345d1743dffbf2a9e59620529f7af0dae78e9d0a06f5f25101944628ab4d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / coffe-3.0.1-cp312-cp312-macosx_11_0_x86_64.whl

Download URL coffe-3.0.1-cp312-cp312-macosx_11_0_x86_64.whl
Size 1.6 MB
Tags CPython 3.12 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
3c22bcd97566190de28eda67c1d72ed5ef92c4798d768c30371510c1dcf30a10
BLAKE2b-256 checksum
How to use checksums
6736cfcfc964b2b7db0b0d3095640bb47f659adce03bd683c42b02b4c7adef4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.7

Release files / coffe-3.0.1-cp312-cp312-macosx_11_0_arm64.whl

Download URL coffe-3.0.1-cp312-cp312-macosx_11_0_arm64.whl
Size 1.3 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
453412771e53ecaeee5e4842e4b1ec88b06ab7a5e65cfd8470193a5b6235bf39
BLAKE2b-256 checksum
How to use checksums
ad2b7996abf4a00087139ed9ed218ab80b43487d48f80ac4fb33a7ed8cba63f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / coffe-3.0.1-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL coffe-3.0.1-cp311-cp311-manylinux_2_28_x86_64.whl
Size 3.2 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
51109b3c5920fbd4e0a9ec898ff5255391915db023dc4432d48aa351265b58fa
BLAKE2b-256 checksum
How to use checksums
db5b87799241574702eb4ca88d5a614beb12e80389bd3c028b54b4ff85a3453c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / coffe-3.0.1-cp311-cp311-macosx_11_0_x86_64.whl

Download URL coffe-3.0.1-cp311-cp311-macosx_11_0_x86_64.whl
Size 1.6 MB
Tags CPython 3.11 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
9229905b6ae23b225067c007596f3d19db1444b8bb31b655c06b2f0f0a133470
BLAKE2b-256 checksum
How to use checksums
f0a19c205ec2fc4666f0392b6a26e5b261c019d16d5b572251a1c74c45f3d16e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.7

Release files / coffe-3.0.1-cp311-cp311-macosx_11_0_arm64.whl

Download URL coffe-3.0.1-cp311-cp311-macosx_11_0_arm64.whl
Size 1.3 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
707bb3bdb11f3120b13be6818d6c4f2dca764c91884a2ef350b11d49f755aeb7
BLAKE2b-256 checksum
How to use checksums
0c267606e7fa6aa4161d77d465bc6c4c2b4d96a47a6163f25a9dbe753c861ea1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / coffe-3.0.1-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL coffe-3.0.1-cp310-cp310-manylinux_2_28_x86_64.whl
Size 3.2 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b128c215bd3f734d46183477cffecb73be420c5a4f9886e8b4ef93e28dc4815d
BLAKE2b-256 checksum
How to use checksums
1f127ffbd9002ba10c95c69bf7565f38ceeaefda22203a631b4f53ea991f5d41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / coffe-3.0.1-cp310-cp310-macosx_11_0_x86_64.whl

Download URL coffe-3.0.1-cp310-cp310-macosx_11_0_x86_64.whl
Size 1.6 MB
Tags CPython 3.10 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
71030afce2538d3cdcdc8235955df7f2a53212897fd196e6da000a0785727c79
BLAKE2b-256 checksum
How to use checksums
cac23d467f8d578f1f1b9796b6b58de14b74a0ba4ccc76d8033092712fc84965
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.7

Release files / coffe-3.0.1-cp310-cp310-macosx_11_0_arm64.whl

Download URL coffe-3.0.1-cp310-cp310-macosx_11_0_arm64.whl
Size 1.4 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
eb19ddc5c878c32344682e743f193494663d8ffd1c472a3fb7b4216f1b8bcfdb
BLAKE2b-256 checksum
How to use checksums
dd45783df5161444f0d50e92091b1dea3ffa3cf5fe1b38c70184eff275b9c73f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / coffe-3.0.1-cp39-cp39-manylinux_2_28_x86_64.whl

Download URL coffe-3.0.1-cp39-cp39-manylinux_2_28_x86_64.whl
Size 3.2 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
667480313478c87619ee6c7a492abe1a334afb57b153ac2ad9248abddd36c5c5
BLAKE2b-256 checksum
How to use checksums
25feb6cf979253aaf38220aa41723ee63ae79c5efecdfd36b46914fde21c4384
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / coffe-3.0.1-cp39-cp39-macosx_11_0_x86_64.whl

Download URL coffe-3.0.1-cp39-cp39-macosx_11_0_x86_64.whl
Size 1.6 MB
Tags CPython 3.9 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
1657be9e327628992aac9dac71b5b22456f933dd1381dede5ad1117d022cc5f7
BLAKE2b-256 checksum
How to use checksums
5a16060ecd440b1d30a3eae4620d578ec9ae7a47c7767b59f7a49900006baebb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.7

Release files / coffe-3.0.1-cp39-cp39-macosx_11_0_arm64.whl

Download URL coffe-3.0.1-cp39-cp39-macosx_11_0_arm64.whl
Size 1.3 MB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8d7cb8ab5f3267cde3cfc69b88c5590463ec15f0692b5b8f72c5542c9993b127
BLAKE2b-256 checksum
How to use checksums
11724f2a0443e89b36207ab482bf26b6f3f6ae18347830f0e6c9296796278f6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / coffe-3.0.1-cp38-cp38-manylinux_2_28_x86_64.whl

Download URL coffe-3.0.1-cp38-cp38-manylinux_2_28_x86_64.whl
Size 3.2 MB
Tags CPython 3.8 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
d12451d1385419ff048c359c4fd91da098f6f8007f56b49211ebe77afce64812
BLAKE2b-256 checksum
How to use checksums
de137cca523c8db4226c6feeb84f1feda8d859a71d681fb12be579da57ed9c9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / coffe-3.0.1-cp38-cp38-macosx_11_0_x86_64.whl

Download URL coffe-3.0.1-cp38-cp38-macosx_11_0_x86_64.whl
Size 1.6 MB
Tags CPython 3.8 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
88cc5b1c073e3e35c399d33c91de0d85e66c8411e911ef8a0f7db64ea56cbd32
BLAKE2b-256 checksum
How to use checksums
a5fadac79cedc0132a9a8303bb4f158097fb873ce52628ca8668418453a91ac8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.7

Release files / coffe-3.0.1-cp38-cp38-macosx_11_0_arm64.whl

Download URL coffe-3.0.1-cp38-cp38-macosx_11_0_arm64.whl
Size 1.4 MB
Tags CPython 3.8 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
380c1288f28dc0c0a1e90d1fccae339d4aedaebbab753ea0068a097f50c28c53
BLAKE2b-256 checksum
How to use checksums
3883de617521388d91ec123747e6c2c8f073e83911837a128a5f82e8ff3cb34b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page