added pulse_envelope convenience function

This commit is contained in:
2024-02-12 09:26:04 +01:00
parent 2e7aa800fc
commit 52efa5186b
2 changed files with 46 additions and 0 deletions

11
tests/test_pulse.py Normal file
View File

@@ -0,0 +1,11 @@
import numpy as np
import pytest
import scgenerator as sc
def test_pulse_envelope():
t = np.linspace(-100, 100, 2049)
assert np.trapz(sc.pulse.pulse_envelope(t, 10, energy=3) ** 2, x=t) == pytest.approx(3)
assert (sc.pulse.pulse_envelope(t, 10, peak_power=3) ** 2).max() == pytest.approx(3)