diff --git a/tests/test_instrument.py b/tests/test_instrument.py index 148506f326f7bc94723d883e63207c7b73b37fbf..6373126ce1ad4614f9924bff425f12a030df856a 100755 --- a/tests/test_instrument.py +++ b/tests/test_instrument.py @@ -3,6 +3,7 @@ # pylint: disable=missing-module-docstring import pytest +import h5py from lisainstrument import Instrument @@ -74,3 +75,27 @@ def test_locking(): Instrument(size=100, lock='N7-12') with pytest.raises(ValueError): Instrument(size=100, lock='N1-67') + +def test_initial_telemetry_size(): + """Test that simulations can run with a nonzero initial telemetry size.""" + + orbit_paths = [ + 'tests/keplerian-orbits-1-0-2.h5', + 'tests/esa-orbits-1-0-2.h5', + 'tests/keplerian-orbits-2-0.h5', + 'tests/esa-trailing-orbits-2-0.h5', + ] + + for orbit_path in orbit_paths: + + # Read orbit file t0 and leave room for initial telemetry + with h5py.File(orbit_path, 'r') as orbitf: + t0 = orbitf.attrs['t0'] + 1E6 + instru = Instrument( + initial_telemetry_size=10, + telemetry_downsampling=100, + orbits=orbit_path, + size=100, + t0=t0) + instru.simulate() + instru.write(mode='w')