Skip to content

Commit

Permalink
Add unit tests for coherent_gain_loss()
Browse files Browse the repository at this point in the history
  • Loading branch information
mhostetter committed Feb 28, 2024
1 parent 9f1f0be commit 5f3aa92
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/link_budgets/test_coherent_gain_loss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import numpy as np
import pytest

import sdr


def test_scalar():
assert sdr.coherent_gain_loss(1e-3, 235) == pytest.approx(-0.8038919141626675)


def test_vector():
cgl = sdr.coherent_gain_loss(1e-3, [0, 100, 200, 300, 400, 500])
cgl_truth = np.array([0.0, -0.14335017, -0.57922366, -1.32626966, -2.42007077, -3.92239754])
assert isinstance(cgl, np.ndarray)
assert np.allclose(cgl, cgl_truth)

0 comments on commit 5f3aa92

Please sign in to comment.