Skip to content

Commit

Permalink
Print last guider measurement before removing NaNs
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Aug 11, 2023
1 parent f257a3e commit 40b0ad0
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/gort/devices/guider.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,26 @@ async def _monitor_task(self, timeout: float = 30):
lambda g: g.fillna(method="bfill", axis=0).iloc[0, :]
)

# Remove NaN rows.
df = df.dropna()

# Sort by frameno.
df = df.sort_values("frameno")

if "fwhm" not in df or "separation" not in df:
continue

# Calculate and report last.
last = df.tail(1)
sep_last = round(last.separation.values[0], 3)
fwhm_last = round(last.fwhm.values[0], 2)
mode_last = last["mode"].values[0]
self.write_to_log(
f"Last: sep={sep_last} arcsec; fwhm={fwhm_last} arcsec; "
f"mode={mode_last!r}",
"info",
)

# Remove NaN rows.
df = df.dropna()

# Calculate and report averages.
now = datetime.datetime.utcnow()
time_range = now - pandas.Timedelta(f"{timeout} seconds")
Expand All @@ -306,17 +317,6 @@ async def _monitor_task(self, timeout: float = 30):
"info",
)

# Calculate and report last.
last = df.tail(1)
sep_last = round(last.separation.values[0], 3)
fwhm_last = round(last.fwhm.values[0], 2)
mode_last = last["mode"].values[0]
self.write_to_log(
f"Last: sep={sep_last} arcsec; fwhm={fwhm_last} arcsec; "
f"mode={mode_last!r}",
"info",
)

except asyncio.CancelledError:
await cancel_task(task)
return
Expand Down

0 comments on commit 40b0ad0

Please sign in to comment.