Skip to main content

code for cosmological gravitational wave backgrounds

Project description

License: GPL v3 PyPI version

CosmoGW v1.0

CosmoGW is a Python package for the analysis and modeling of cosmological gravitational wave (GW) backgrounds from different sources in the early Universe, including analytical models, templates, and data analysis routines.

v1.0 (August 2025) focuses on the production of GWs from sound waves and MHD turbulence from cosmological phase transitions.

Other sources of GWs will be included in future versions, contact me if you are interested in contributing and becoming a developer.

CosmoGW is an extension of GW_turbulence, created in December 2021, used for calculations of GWs produced by MHD turbulence.


Contact

Author: Alberto Roper Pol
Email: alberto.roperpol@unige.ch
GitHub: albertoroperpol

If you use any of the cosmoGW results, please cite this repository, the [manual] (coming soon) and the relevant references listed in the routines.

Feel free to reach out for questions, issues, or collaboration! I would also love to hear about your interest for this project and your work, so feel free to reach out for questions, issues, or collaboration!


Installation

CosmoGW is a Python package that can be installed using pip from PyPI:

pip install cosmoGW

Or directly from GitHub (last version but not necessarily stable):

pip install git+https://github.com/cosmoGW/cosmoGW.git

Requirements:
Python >= 3.8, numpy, scipy, matplotlib, astropy, pandas

To use the plotting routines available in the tutorials and in plot_sets, make sure to install LaTeX for Python:

LaTeX on Ubuntu/Debian:

sudo apt-get update
sudo apt-get install -y cm-super dvipng texlive-latex-extra texlive-latex-recommended

LaTeX on macOS (using Homebrew):

brew install --cask mactex

File Structure

The main routines of cosmoGW are stored under src/cosmoGW:

  • analysis.py: Analysis of GWs detectability with LISA.
  • cosmology.py: Cosmological calculations.
  • GW_analytical.py: Analytical calculations and mathematical functions.
  • GW_back.py: Functions for cosmological GW backgrounds.
  • GW_models.py: Theoretical and numerical models for sources of GWs.
  • GW_templates.py: Templates for GW backgrounds from different sources.
  • hydro_bubbles.py: Fluid perturbations from bubbles in first-order phase transitions.
  • interferometry.py: Response and sensitivity functions for GW detectors (LISA, Taiji).
  • utils.py: Utility functions and reference values for CosmoGW.
  • tests/: Unit tests and example data.
  • resources/: Data files used in the code (numerical data, sensitivity curves, ...)
  • tutorials/: Tutorials showing how to use CosmoGW for different applications.

Documentation

Comprehensive documentation is available at Read the Docs.

  • API Reference: Detailed documentation for all modules and functions.
  • Tutorials: Step-by-step guides and example workflows.
  • Theory: Background information and mathematical details.

To build the documentation locally:

cd docs
make html

Tutorials

Tutorials and example notebooks are available in the tutorials/ directory:

  • GWs_sound-waves: Tutorial showing different templates of GWs from sound waves and non-linear compressional fluid perturbations from first-order phase transitions.
  • GWs_MF_from_FOPT: Tutorial showing the analysis of GWs from sound waves and turbulence from first-order phase transitions with LISA in connection to primordial magnetic fields.

These tutorials can be run from Google Colab by loading the notebooks from GitHub.

When using Colab, latex needs to be installed, together with CosmoGW, for plotting routines. For the installation, uncomment and execute the first cell of the tutorials:

pip install cosmoGW
sudo apt-get update
sudo apt-get install -y cm-super dvipng texlive-latex-extra texlive-latex-recommended

Tests

Unit tests are provided in the tests/ directory.

To run all tests (from cosmoGW directory):

pytest

Make sure pytest is installed and that all required test data files are present in the tests directory.

Further test is available using the tutorial notebooks (see [python-package_nbs.yml]). To test the output plots and results from the notebooks run (e.g. from GWs_sound-waves tutorial):

pytest --nbval tutorials/GWs_sound-waves.ipynb

Make sure to have installed pytest, nbval and LaTeX:

LaTeX on Ubuntu/Debian:

pip install pytest nbval
sudo apt-get update
sudo apt-get install -y cm-super dvipng texlive-latex-extra texlive-latex-recommended

LaTeX on macOS (using Homebrew):

pip install pytest nbval
brew install --cask mactex

Resources

Data files are available in cosmoGW that are required by some of the libraries.

They are stored in src/cosmoGW/resources:

  • cosmology: Cosmological evolution files and Friedmann equation tutorial.
  • interferometry: Space-based GW interferometry calculations and tutorials.
  • detector_sensitivity: Sensitivity of various detectors; see the README.
  • higgsless: Data sets from Higgsless simulations of phase transitions.

📄 License

This project is licensed under the GNU General Public License v3 (GPLv3).


🚀 Enjoy exploring the early Universe with gravitational waves! 🪐

Project details


Download files

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

Source Distribution

cosmogw-0.0.39.tar.gz (5.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cosmogw-0.0.39-py3-none-any.whl (5.8 MB view details)

Uploaded Python 3

File details

Details for the file cosmogw-0.0.39.tar.gz.

File metadata

  • Download URL: cosmogw-0.0.39.tar.gz
  • Upload date:
  • Size: 5.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for cosmogw-0.0.39.tar.gz
Algorithm Hash digest
SHA256 ceabd4d7f2ca1a7548cb078405004619322ff1a2aa556009148147247b53b0f3
MD5 856f4830e7855df40f615544074d3ddc
BLAKE2b-256 0fe06bea8282f6ca412bcc8584c696ccad8d870e435cd9910e06a935af01c7ed

See more details on using hashes here.

File details

Details for the file cosmogw-0.0.39-py3-none-any.whl.

File metadata

  • Download URL: cosmogw-0.0.39-py3-none-any.whl
  • Upload date:
  • Size: 5.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for cosmogw-0.0.39-py3-none-any.whl
Algorithm Hash digest
SHA256 c2d4e4ab8c98a7770be710e5ce591565780285501304c2a04086aa119a4eaee1
MD5 0fc57d9c3b0bb9468d9f5b20ddd8f366
BLAKE2b-256 fa63012604f2b842eaa98151010a340475c5aac7a93d7c5b7c58f98e20850507

See more details on using hashes here.

Supported by

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