Skip to content

Commit

Permalink
Merge pull request #8 from gwastro/add-ci-tests
Browse files Browse the repository at this point in the history
Add ci tests
  • Loading branch information
WuShichao committed May 13, 2024
2 parents be97c96 + 1057c96 commit f981313
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
unittests:
name: Tests - Python ${{ matrix.python-version }}

strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/mikekatz04/BBHx.git@dd4c1f5b5a180ca10e699bd0317238be7480f28b
pip install .
pip install pytest
- name: Test with pytest
run: |
python -m pytest -v tests.py
32 changes: 32 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import numpy as np
from pycbc.waveform import get_fd_det_waveform
import pytest


@pytest.mark.parametrize("ref_frame", ["SSB", "LISA"])
def test_get_fd_det_waveform(ref_frame):
params = {}
params["ref_frame"] = ref_frame
params["approximant"] = "BBHX_PhenomD"
params["coa_phase"] = 0.0
params["mass1"] = 1e6
params["mass2"] = 8e5
params["spin1z"] = 0.0
params["spin2z"] = 0.0
params["distance"] = 410
params["inclination"] = np.pi / 2
params["t_obs_start"] = 31536000
params["delta_f"] = 1.0 / params["t_obs_start"]
params["f_lower"] = 1e-4
params["f_ref"] = 8e-4
params["f_final"] = 0.1
params["delta_t"] = 1 / 0.2
params["t_offset"] = 9206958.120016199
params["tc"] = 4799624.274911478
params["eclipticlongitude"] = 0.5
params["eclipticlatitude"] = 0.23
params["polarization"] = 0.1
wf = get_fd_det_waveform(ifos=["LISA_A", "LISA_E", "LISA_T"], **params)

# Check all 3 ifos are returned
assert len(wf) == 3

0 comments on commit f981313

Please sign in to comment.