Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/WDoyle123/GravAD

Gravitational Wave Analysis using Auto Differentiation with JAX
https://github.com/WDoyle123/GravAD

astrophysics cosmology gravitational-waves jax python

Last synced: 3 months ago
JSON representation

Gravitational Wave Analysis using Auto Differentiation with JAX

Awesome Lists containing this project

README

        


Logo

GravAD



Gravitational Wave Analysis using Auto Differentiation with JAX


Report Bug
·
Request Feature

[![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://forthebadge.com)

---

## Table of Contents

- [Info](#info)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Screenshots](#screenshots)
- [Authors](#authors)
- [Citing](#citing)
- [Acknowledgements](#acknowledgements)
- [License](#license)

---

## Info

GravAD offers a cutting-edge approach to gravitational wave detection, leveraging Automatic Differentiation (AD), [JAX](https://github.com/google/jax), and [Ripple](https://github.com/tedwards2412/ripple) for template generation via IMRPhenomD. GravAD quickly pinpoints potential gravitational wave events in detector data by optimising the matched filtering process. Despite using fewer templates and significantly reducing computational time, it achieves nearly equivalent results to the established LIGO pipelines. This efficiency positions GravAD as an ideal preliminary tool in gravitational wave research, quickly sifting through data to highlight promising candidates for detailed analysis. GravAD also serves as an additional validator to existing search pipelines, fortifying their credibility.

## Features

- Dynamic Template Generation
- Optimised for GPUs
- Graphs and Results
- Works using real LIGO data
- Works with simulated signals

## Installation

### Prerequisites

This software requires Python 3.11.3 or newer, and has dependencies that can be installed via pip. You can view the full list of dependencies in the `requirements.txt` file. Note, this requirements.txt is for the CPU version of JAX. For GPU version of JAX please install separately following their guides.

### Installation via GitHub

1. Clone the GravAD repository to your local machine:
```
git clone https://github.com/WDoyle123/GravAD.git
```
2. Navigate to the cloned repository:
```
cd GravAD
```
3, Install the required packages:
```
pip install -r requirements.txt
```

## Usage

Once you have installed all the prerequisites and set up GravAD, you can start using it for gravitational wave analysis.

Simply run ```python main.py```.

Here is a simple example of how you might use GravAD:

### Changing the constants

Navigate to the ```constants.py``` file.
You can alter the detection frequencies, number of iteration GravAD runs for (how many templates), aswell as adjusting the simulated annealing optimisation.

```
# Constants
SAMPLING_RATE = 2048
LOW_FREQ_CUTOFF = 20.
HIGH_FREQ_CUTOFF = 1000.
MAX_ITERS = 100
TEMPERATURE = 1 # Initial Temperature
ADV_TEMPERATURE = 2 # Advanced Temperature
ANNEALING_RATE = 0.99
LRU = 1.5 # Learning Rate Upper
LRL = 5.5 # Learning Rate Lower
SEED = 1
```

You can alter which signals you want to detect and from which detector.

```
STRAINS = ['H1', 'L1']
EVENTS = ["GW150914", "GW151012", "GW151226", "GW170104", "GW170608", "GW170729", "GW170809",
"GW170814", "GW170817", "GW170818", "GW170823"]
```

### Adjusting the Optimisers

in ```GravAD.py```, navigate to:
```
def get_optimal_mass(init_mass1, init_mass2, freqs, params, data, psd, delta_f, signal_type, optimiser='sgd_adam'):
```
From here you can select the optimiser from.

Currently available optimisers:

sgd - Stochastic Gradient Descent

sgd_sa - Stochastic Gradient Descent + Simulated Annealing

sgd_p - Stochastic Gradient Descent + Momentum

sgd_sa_p - Stochastic Gradient Descent + Simulated Annealing + Momentum

sgd_sa_adam - Stochastic Gradient Descent + Simulated Annealing + Adam

sgd_adam - Stochastic Gradient Descent + Adam

### Real and Simulated Signals

In the ```main``` function in ```main.py``` you will find:
```
# Analyse real signals
if True:
real_signals()
plotter(pattern_real, folder_results_real, folder_max_snr_real)

# Analyse simulated signals (WIP)
if False:
simulated_signals()
plotter(pattern_simu, folder_results_sim, folder_max_snr_sim)
```
Simply change the ```True``` or ```False``` to enable real or simulated signals.

## Screenshots

![App Screenshot](figures/snr_vs_mass/SNR_vs_Combined_Mass_for_GW150914_H1_T_1.00_AR_0.990_MI_100_5.5_1.5_SEED1.png)
![App Screenshot](figures/snr_and_aligned//snr_and_aligned_GW150914_H1_T_1.00_AR_0.990_MI_100_5.5_1.5_SEED1.png)
![App Screenshot](figures/contours/contours_GW150914_H1_T_1.00_AR_0.990_MI_100_5.5_SEED1.5.png)

Check out [graphs](./figures) for more!

## Authors

- [@WDoyle123](https://github.com/WDoyle123)
- Supervisor [@andrew-lundgren](https://github.com/andrew-lundgren)

## Citing

If you use `GravAD` in your work, please cite [our paper](https://doi.org/10.59973/emjsr.10):

```
@article{Doyle_2023,
author={Doyle, William},
title={Searching For Black Holes Using Auto Differentiation},
url={https://ipipublishing.org/index.php/emjsr/article/view/10},
DOI={10.59973/emjsr.10},
journal={Emerging Minds Journal for Student Research},
volume={1},
year={2023},
month={Jul.},
pages={17–38}
}
```

## Acknowledgements

We would like to acknowledge the use of [ripple](https://github.com/tedwards2412/ripple) for template generation in this project.