# Burst waveform

[![Build Status](https://git.ligo.org/yumeng.xu/burst_waveform/badges/main/pipeline.svg)](https://git.ligo.org/yumeng.xu/burst_waveform/-/pipelines)
[![PyPI version](https://badge.fury.io/py/burst-waveform.svg)](https://badge.fury.io/py/burst-waveform)
[![License](https://img.shields.io/badge/license-GPLv3-blue)](https://git.ligo.org/yumeng.xu/pycwb/-/blob/main/LICENSE)

This package hosts the python version of the burst waveform used in coherentWaveBurst(cWB) search.

## Installation

### Using pip

```bash
pip install burst-waveform
```

### from source

```bash
make install
```

## Usage

The `Burst-Waveform` package provides four burst waveform models: `SineGaussian`, `SineGaussianQ`, `WhiteNoiseBurst`,
and `Ringdown`. 

The waveforms can be generated by calling the instance of the waveform model after initializing it with the desired
parameters.

For example, to generate a `SineGaussianQ` waveform,

```python
from burst_waveform.models import SineGaussianQ
from matplotlib import pyplot as plt

params = {
    "amplitude": 1.0,
    "frequency": 300.0,
    "Q": 9
}

model = SineGaussianQ(params)
strain = model()

plt.plot(strain)
plt.show()
```

For `WhiteNoiseBurst` waveform,

```python
from burst_waveform.models import WhiteNoiseBurst
import matplotlib.pyplot as plt

params = {
    'frequency': 300,
    'bandwidth': 50,
    'duration': 0.005,
    'inj_length': 1,
    'mode': 1
}

WNB = WhiteNoiseBurst(params)
wnb_strain = WNB()

plt.plot(wnb_strain)
plt.xlim(0.5 - 10 * params['duration'], 0.5 + 10 * params['duration'])
plt.show()
```

For `Ringdown` waveform,

```python
from burst_waveform.models import Ringdown
from matplotlib import pyplot as plt

params = {
    "tau": 0.3,
    "frequency": 10.0,
    "iota": 90.0,
}

model = Ringdown(params)
hp, hc = model()

plt.plot(hp)
plt.plot(hc)
plt.show()
```