def test_reflection_coefficient(self): self.assertRaises(ZeroDivisionError, reflection_coefficient, -50) self.assertEqual(reflection_coefficient(50), 0) self.assertEqual(reflection_coefficient(75), 0.2)
def vswr_transformed(cls, z, ratio=49) -> float: refl = reflection_coefficient(z / ratio) mag = abs(refl) if mag == 1: return 1 return (1 + mag) / (1 - mag)