Skip to main content

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! 🪐

Metadata

Release files for cosmoGW 0.0.40

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

Source distribution (sdist)

Source distribution for cosmoGW 0.0.40
File Size Uploaded
cosmogw-0.0.40.tar.gz 5.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for cosmoGW 0.0.40
File Interpreter ABI Platform
cosmogw-0.0.40-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 MB

Release files / cosmogw-0.0.40.tar.gz

Download URL cosmogw-0.0.40.tar.gz
Size 5.8 MB
Tags Source
SHA-256 checksum
How to use checksums
59bee7769513945eb6f07e5da44247ee04d5f7b638c63ae75acf9884c5ddcc22
BLAKE2b-256 checksum
How to use checksums
acf31b605c1546cf6257905660f5a415f76c15c29f52eac0ed22a2ecf8c5da26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.2

Release files / cosmogw-0.0.40-py3-none-any.whl

Download URL cosmogw-0.0.40-py3-none-any.whl
Size 5.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4422810a47bda90f440b7a17f92d2b02af826752f168e6097bb61e20e72f7443
BLAKE2b-256 checksum
How to use checksums
a8317558eaefde42921cbd4b1242751f3b26ac70a9c3eb680c2b41c0aab76a9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.2
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