Error when using orbit files v2.0
Running a simple simulation with the new orbit files yields an error (see below).
We should
- fix the issue by explicitly converting spacecraft indices from string to int
- prevent the double warning for orbit file development version
- make sure that unit tests capture errors like this
>>> from lisainstrument import Instrument
>>> i = Instrument(orbits='/Users/j2b/Downloads/keplerian-orbits.h5', size=1000)
You are using an orbit file in a development version
You are using an orbit file in a development version
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 i = Instrument(orbits='/Users/j2b/Downloads/keplerian-orbits.h5', size=1000)
File ~/Developer/lisa-simulation/instrument/lisainstrument/instrument.py:337, in Instrument.__init__(self, size, dt, t0, physics_upsampling, aafilter, orbits, orbit_dataset, gws, interpolation, glitches, lock, offsets_freqs, laser_asds, central_freq, modulation_asds, modulation_freqs, tdir_tone, clock_asds, clock_offsets, clock_freqoffsets, clock_freqlindrifts, clock_freqquaddrifts, clockinv_tolerance, clockinv_maxiter, backlink_asds, backlink_fknees, testmass_asds, testmass_fknees, oms_asds, oms_fknees, ttl_coeffs, sc_jitter_asds, mosa_jitter_asds, mosa_angles, dws_asds, ranging_biases, ranging_asds)
334 self.offsets_freqs = ForEachMOSA(offsets_freqs)
336 # Orbits, gravitational waves, glitches
--> 337 self.init_orbits(orbits, orbit_dataset)
338 self.init_gws(gws)
339 self.init_glitches(glitches)
File ~/Developer/lisa-simulation/instrument/lisainstrument/instrument.py:484, in Instrument.init_orbits(self, orbits, orbit_dataset)
482 self.init_orbits_file_1_0(orbitf)
483 elif version in SpecifierSet('== 2.*', True):
--> 484 self.init_orbits_file_2_0(orbitf)
485 else:
486 raise ValueError(f"unsupported orbit file version '{version}'")
File ~/Developer/lisa-simulation/instrument/lisainstrument/instrument.py:552, in Instrument.init_orbits_file_2_0(self, orbitf)
550 else:
551 dataset = orbitf['tcb/delta_tau']
--> 552 self.tps_proper_time_deviations = ForEachSC(lambda sc: interpolate(dataset[:, sc - 1], self.physics_t))
553 except ValueError as error:
554 logger.error("Missing orbit information at \n%s", self.physics_t)
File ~/Developer/lisa-simulation/instrument/lisainstrument/containers.py:31, in ForEachObject.__init__(self, values)
29 self.dict = {mosa: values[mosa] for mosa in self.indices()}
30 elif callable(values):
---> 31 self.dict = {mosa: values(mosa) for mosa in self.indices()}
32 elif isinstance(values, h5py.Dataset):
33 self.dict = {mosa: values[mosa] for mosa in self.indices()}
File ~/Developer/lisa-simulation/instrument/lisainstrument/containers.py:31, in <dictcomp>(.0)
29 self.dict = {mosa: values[mosa] for mosa in self.indices()}
30 elif callable(values):
---> 31 self.dict = {mosa: values(mosa) for mosa in self.indices()}
32 elif isinstance(values, h5py.Dataset):
33 self.dict = {mosa: values[mosa] for mosa in self.indices()}
File ~/Developer/lisa-simulation/instrument/lisainstrument/instrument.py:552, in Instrument.init_orbits_file_2_0.<locals>.<lambda>(sc)
550 else:
551 dataset = orbitf['tcb/delta_tau']
--> 552 self.tps_proper_time_deviations = ForEachSC(lambda sc: interpolate(dataset[:, sc - 1], self.physics_t))
553 except ValueError as error:
554 logger.error("Missing orbit information at \n%s", self.physics_t)
TypeError: unsupported operand type(s) for -: 'str' and 'int'
Edited by Jean-Baptiste Bayle