From 7d166644db70d1412b1bea35e203d638cd79c9e7 Mon Sep 17 00:00:00 2001 From: Steve Pothier Date: Fri, 27 Dec 2024 16:50:56 -0700 Subject: [PATCH] DM-48131 add time-loss from narrativelog API --- notebooks_tsqr/dashboard.ipynb | 8 ++++++++ .../lsst/ts/logging_and_reporting/all_sources.py | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/notebooks_tsqr/dashboard.ipynb b/notebooks_tsqr/dashboard.ipynb index e52e431..c8ce831 100644 --- a/notebooks_tsqr/dashboard.ipynb +++ b/notebooks_tsqr/dashboard.ipynb @@ -149,6 +149,14 @@ "source": [ "print(f\"Finished {str(datetime.now())}\")" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "13", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/python/lsst/ts/logging_and_reporting/all_sources.py b/python/lsst/ts/logging_and_reporting/all_sources.py index 999c557..1496020 100644 --- a/python/lsst/ts/logging_and_reporting/all_sources.py +++ b/python/lsst/ts/logging_and_reporting/all_sources.py @@ -258,8 +258,20 @@ def night_tally_observation_gaps(self, verbose=False): # These need join between exposures and messages. # But in messages, they aren't reliable numbers anyhow. # TODO despite unreliability, use messages values. - loss_fault = pd.NA # hours - loss_weather = pd.NA # hours + ltypes = set([r["time_lost_type"] for r in self.nar_src.records]) + ltime = defaultdict(int) + for t in ltypes: + for r in self.nar_src.records: + ltime[t] += r["time_lost"] + if "fault" in ltypes: + loss_fault = ltime["fault"] # hours + else: + loss_fault = pd.NA # hours + + if "weather" in ltypes: + loss_weather = ltime["weather"] # hours + else: + loss_weather = pd.NA # hours used_hours = exposure_hours + readout_hours if pd.notna(slew_hours):