diff --git a/lisainstrument/instrument.py b/lisainstrument/instrument.py index 7ae2f0803126295acfdec8683aa052062792c25a..bce2bbc72997f42eaf1a5a9fefc47920cc6e7848 100644 --- a/lisainstrument/instrument.py +++ b/lisainstrument/instrument.py @@ -550,6 +550,7 @@ class Instrument: self.gw_file = gws with File(self.gw_file, 'r') as gwf: version = gwf.attrs['version'] + logger.debug("Using GW file version %s", version) if version in SpecifierSet('~= 0.1') or version in SpecifierSet('~= 1.0'): self.gws = ForEachMOSA(lambda mosa: InterpolatedUnivariateSpline( gwf['t'][:], gwf[f'l_{mosa}'][:], k=5, ext='zeros')(self.physics_t) @@ -578,16 +579,21 @@ class Instrument: self.glitch_file = glitches logger.info("Interpolating glitch signals from glitch file '%s'", self.glitch_file) with File(self.glitch_file, 'r') as glitchf: - self.glitch_tms = ForEachMOSA(lambda mosa: - 0 if f'tm_{mosa}' not in glitchf else \ - InterpolatedUnivariateSpline( - glitchf['t'][:], glitchf[f'tm_{mosa}'][:], k=5, ext='const')(self.physics_t) - ) - self.glitch_lasers = ForEachMOSA(lambda mosa: - 0 if f'laser_{mosa}' not in glitchf else \ - InterpolatedUnivariateSpline( - glitchf['t'][:], glitchf[f'laser_{mosa}'][:], k=5, ext='const')(self.physics_t) - ) + version = glitchf.attrs['version'] + logger.debug("Using glitch file version %s", version) + if version in SpecifierSet('~= 1.0'): + self.glitch_tms = ForEachMOSA(lambda mosa: + 0 if f'tm_{mosa}' not in glitchf else \ + InterpolatedUnivariateSpline( + glitchf['t'][:], glitchf[f'tm_{mosa}'][:], k=5, ext='const')(self.physics_t) + ) + self.glitch_lasers = ForEachMOSA(lambda mosa: + 0 if f'laser_{mosa}' not in glitchf else \ + InterpolatedUnivariateSpline( + glitchf['t'][:], glitchf[f'laser_{mosa}'][:], k=5, ext='const')(self.physics_t) + ) + else: + raise ValueError(f"unsupported glitch file version '{version}'") elif glitches is None: logger.debug("No glitches") self.glitch_file = None