Skip to content
Snippets Groups Projects
Commit 86425a9d authored by Jean-Baptiste Bayle's avatar Jean-Baptiste Bayle
Browse files

Read orbits from orbit file by default

parent 74274e60
No related branches found
No related tags found
1 merge request!32Resolve "Automatically set t0 matching the t0 of orbits"
Pipeline #109111 passed
...@@ -34,7 +34,7 @@ class Instrument: ...@@ -34,7 +34,7 @@ class Instrument:
SCS = ForEachSC.indices() SCS = ForEachSC.indices()
MOSAS = ForEachMOSA.indices() MOSAS = ForEachMOSA.indices()
def __init__(self, size=2592000, dt=1/4, t0=0, def __init__(self, size=2592000, dt=1/4, t0='orbits',
# Inter-spacecraft propagation # Inter-spacecraft propagation
orbits=None, gws=None, glitches=None, interpolation=('lagrange', 31), orbits=None, gws=None, glitches=None, interpolation=('lagrange', 31),
# Lasers # Lasers
...@@ -54,7 +54,7 @@ class Instrument: ...@@ -54,7 +54,7 @@ class Instrument:
Args: Args:
size: number of samples to generate size: number of samples to generate
dt: sampling period [s] dt: sampling period [s]
t0: initial time [s] t0: initial time [s], or 'orbits' to match that of the orbits
orbits: path to orbit file, or dictionary of scalars or time series for PPRs, orbits: path to orbit file, or dictionary of scalars or time series for PPRs,
or None for default set of PPRs corresponding to static arms fit from Keplerian orbits or None for default set of PPRs corresponding to static arms fit from Keplerian orbits
(from LISA Orbits v1.0) around t = 0 (from LISA Orbits v1.0) around t = 0
...@@ -89,7 +89,7 @@ class Instrument: ...@@ -89,7 +89,7 @@ class Instrument:
('kaiser', attenuation [dB], f1 [Hz], f2 [Hz]) with f1 < f2 the frequencies defining ('kaiser', attenuation [dB], f1 [Hz], f2 [Hz]) with f1 < f2 the frequencies defining
the transition band the transition band
""" """
# pylint: disable=too-many-arguments,too-many-statements # pylint: disable=too-many-arguments,too-many-statements,too-many-locals,too-many-branches
logger.info("Initializing instrumental simulation") logger.info("Initializing instrumental simulation")
self.git_url = 'https://gitlab.in2p3.fr/lisa-simulation/instrument' self.git_url = 'https://gitlab.in2p3.fr/lisa-simulation/instrument'
self.version = meta.__version__ self.version = meta.__version__
...@@ -98,7 +98,15 @@ class Instrument: ...@@ -98,7 +98,15 @@ class Instrument:
# Measurement sampling # Measurement sampling
self.size = int(size) self.size = int(size)
self.dt = float(dt) self.dt = float(dt)
self.t0 = float(t0) if t0 == 'orbits':
if isinstance(orbits, str):
logger.debug("Reading initial time from orbit file '%s'", orbits)
with h5py.File(orbits, 'r') as orbitf:
self.t0 = float(orbitf.attrs['tau0'])
else:
self.t0 = 0.0
else:
self.t0 = float(t0)
self.fs = 1 / self.dt self.fs = 1 / self.dt
logger.info("Computing measurement time vector (size=%s, dt=%s)", self.size, self.dt) logger.info("Computing measurement time vector (size=%s, dt=%s)", self.size, self.dt)
self.t = self.t0 + numpy.arange(self.size, dtype=numpy.float64) * self.dt self.t = self.t0 + numpy.arange(self.size, dtype=numpy.float64) * self.dt
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment