Skip to content

Commit

Permalink
draft to match Storyboard for Wednesday meeting
Browse files Browse the repository at this point in the history
  • Loading branch information
pothiers committed Oct 29, 2024
1 parent 36c44e3 commit 899bd0b
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 54 deletions.
2 changes: 1 addition & 1 deletion notebooks_tsqr/ExposureDetail.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"# day_obs values: TODAY, YESTERDAY, YYYY-MM-DD\n",
"# Report on observing nights that start upto but not included this day.\n",
"#!day_obs = '2024-09-25' # Value to use for local testing (Summit)\n",
"day_obs = \"2024-09-25\" # TODO Change to 'YESTERDAY' to test with default before push\n",
"day_obs = \"TODAY\" # TODO Change to 'YESTERDAY' to test with default before push\n",
"\n",
"# Total number of days of data to display (ending on day_obs)\n",
"number_of_days = \"1\" # TODO Change to '1' to test with default before push\n",
Expand Down
105 changes: 57 additions & 48 deletions notebooks_tsqr/NightLog.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
{
"cell_type": "markdown",
"id": "0",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"# Initialize\n",
"This section is a developer aid; TODO remove later!\n",
"*Align with [storyboard Version 33](https://rubinobs.atlassian.net/wiki/pages/viewpage.action?pageId=132612364&pageVersion=33)*"
"*Align with [storyboard Version 37](https://rubinobs.atlassian.net/wiki/pages/viewpage.action?pageId=132612364&pageVersion=37)*"
]
},
{
Expand Down Expand Up @@ -172,20 +174,18 @@
"* [Night Report](#Night-Report)\n",
" - AuxTel\n",
" - Simonyi\n",
"* [Almanac](#almanac)\n",
"* [Summary plots of whole night](#Summary-Plots)\n",
"* [Time Accounting](#Time Accounting)\n",
"* [Almanac](#Almanac)\n",
"* [Summary plots of whole night](#Summary-plots-of-whole-night)\n",
"* [Time Accounting](#Time-Accounting)\n",
"* [Jira Tickets](#Jira-Tickets)\n",
" - AuxTel\n",
" - Simonyi\n",
"* [BLOCKS Observed](#BLOCKS-Observed)\n",
" - AuxTel\n",
" - Simonyi\n",
"* [Exposure Log](#Exposure-Log)\n",
" - AuxTel\n",
" - Simonyi\n",
"* [Data Log](#Data-Log)\n",
"* [Narrative Log](#Narrative-Log)\n",
"* [Developer Only](#dev-only)"
"* [Developer Only Section](#Developer-Only-Section)"
]
},
{
Expand All @@ -200,11 +200,7 @@
"cell_type": "code",
"execution_count": null,
"id": "10",
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"metadata": {},
"outputs": [],
"source": [
"# Night Report\n",
Expand All @@ -217,7 +213,6 @@
"id": "11",
"metadata": {},
"source": [
"<a id=\"almanac\"></a>\n",
"## Almanac"
]
},
Expand All @@ -242,7 +237,6 @@
"id": "13",
"metadata": {},
"source": [
"<a id=\"Summary-Plots\"></a>\n",
"## Summary plots of whole night "
]
},
Expand All @@ -258,11 +252,7 @@
"cell_type": "code",
"execution_count": null,
"id": "15",
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"metadata": {},
"outputs": [],
"source": [
"# Plot Observation (Exposure) gaps\n",
Expand All @@ -275,9 +265,7 @@
"id": "16",
"metadata": {},
"source": [
"<a id=\"Time Accounting\"></a>\n",
"## Time Accounting\n",
"**NEW**: Added \"Total (fault, etc) loss\". Source=Narrativelog"
"## Time Accounting"
]
},
{
Expand All @@ -298,7 +286,8 @@
"id": "18",
"metadata": {},
"source": [
"## Jira Tickets (Observing Operations - OBS)\n",
"## Jira Tickets \n",
"(Observing Operations - OBS)\n",
"(TODO: better tickets using Jira API)"
]
},
Expand Down Expand Up @@ -349,7 +338,7 @@
"id": "21",
"metadata": {},
"source": [
"## BLOCKS observed\n",
"## BLOCKS Observed\n",
"(TODO: BLOCKS observed) "
]
},
Expand All @@ -359,7 +348,8 @@
"metadata": {},
"source": [
"## Data Log\n",
"*modified all_sources.py:uniform_field_counts()*"
"NOTE: *modified all_sources.py:uniform_field_counts()*\n",
"NOTE: Each tally count is now a link to a detailed table of exposures."
]
},
{
Expand Down Expand Up @@ -396,6 +386,8 @@
"id": "24",
"metadata": {},
"source": [
"## TODO According to Storybaord, this section should be removed ...\n",
"... and replaced with a simple table tally of Good, Questionable, and Junk exposures per instrument. (that tally has been added below)\n",
"| Symbol | Meaning |\n",
"|:---|:---|\n",
"| <font style=\"background-color:green; color:white; font-size:20px\">&nbsp;G&nbsp;</font>| Good |\n",
Expand All @@ -414,21 +406,31 @@
"allrep.exp_rep.time_log_as_markdown()"
]
},
{
"cell_type": "markdown",
"id": "26",
"metadata": {},
"source": [
"Note: *Added counts of Exposures with messages*"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "26",
"id": "27",
"metadata": {},
"outputs": [],
"source": [
"for instrum, recs in allsrc.exp_src.exposures.items():\n",
" md(f\"**{instrum} {len(recs)} Exposures with messages**\")\n",
" allsrc.tally_exposure_flags(instrum)"
" if len(recs) > 0:\n",
" df = allsrc.tally_exposure_flags(instrum)\n",
" display(df.style.hide(axis=\"index\"))"
]
},
{
"cell_type": "markdown",
"id": "27",
"id": "28",
"metadata": {},
"source": [
"## Narrative Log"
Expand All @@ -437,7 +439,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "28",
"id": "29",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -448,21 +450,28 @@
},
{
"cell_type": "markdown",
"id": "29",
"id": "30",
"metadata": {},
"source": [
"-----------\n",
"------------"
]
},
{
"cell_type": "markdown",
"id": "31",
"metadata": {},
"source": [
"<a id=\"dev-only\"></a>\n",
"------------\n",
"------------\n",
"\n",
"# Developer Only Section \n",
"Contains stuff only expected to be useful to developers.\n",
"\n",
"May also contain sections that have moved out of he user section because they are not defined in the Storyboard."
"May also contain sections that have moved out of the user section because they are no longer defined in the Storyboard."
]
},
{
"cell_type": "markdown",
"id": "30",
"id": "32",
"metadata": {},
"source": [
"## Overview \n"
Expand All @@ -471,7 +480,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "31",
"id": "33",
"metadata": {
"jupyter": {
"source_hidden": true
Expand All @@ -497,7 +506,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "32",
"id": "34",
"metadata": {
"jupyter": {
"source_hidden": true
Expand All @@ -519,7 +528,7 @@
},
{
"cell_type": "markdown",
"id": "33",
"id": "35",
"metadata": {},
"source": [
"## This report uses the following data sources\n",
Expand All @@ -534,7 +543,7 @@
},
{
"cell_type": "markdown",
"id": "34",
"id": "36",
"metadata": {},
"source": [
"## DDV "
Expand All @@ -543,7 +552,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "35",
"id": "37",
"metadata": {
"jupyter": {
"source_hidden": true
Expand All @@ -561,7 +570,7 @@
},
{
"cell_type": "markdown",
"id": "36",
"id": "38",
"metadata": {},
"source": [
"## Where was this run?\n",
Expand All @@ -576,7 +585,7 @@
},
{
"cell_type": "markdown",
"id": "37",
"id": "39",
"metadata": {},
"source": [
"## Section overviews moved here"
Expand All @@ -585,7 +594,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "38",
"id": "40",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -600,7 +609,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "39",
"id": "41",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -613,7 +622,7 @@
},
{
"cell_type": "markdown",
"id": "40",
"id": "42",
"metadata": {},
"source": [
"## Finale"
Expand All @@ -622,7 +631,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "41",
"id": "43",
"metadata": {
"jupyter": {
"source_hidden": true
Expand Down
8 changes: 6 additions & 2 deletions python/lsst/ts/logging_and_reporting/all_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import lsst.ts.logging_and_reporting.efd as efd
import lsst.ts.logging_and_reporting.source_adapters as sad
import lsst.ts.logging_and_reporting.utils as ut
import pandas as pd
from lsst.ts.logging_and_reporting.utils import hhmmss


Expand Down Expand Up @@ -276,8 +277,11 @@ def get_slews(self):
pass

def tally_exposure_flags(self, instrument):
fc = facet_counts(self.exp_src.records, fieldnames=["exposure_flag"])
return fc
# ... make sure we have counts for all three
tally = Counter(good=0, questionable=0, junk=0)
tally.update([r["exposure_flag"] for r in self.exp_src.messages[instrument]])
df = pd.DataFrame.from_dict(tally, orient="index").T
return df # .style.hide(axis="index")

@property
def urls(self):
Expand Down
13 changes: 10 additions & 3 deletions python/lsst/ts/logging_and_reporting/source_adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,12 @@ def exposure_detail(
)
]
if len(recs) == 0:
return "No matching records"
msg = (
f"No matching records after appling filters "
f"to {len(self.exposures[instrument])} exposures "
f"for {instrument=!r}."
)
return msg

# #!df = pd.DataFrame(self.exposures[instrument])[fields]
df = pd.DataFrame(recs)[fields]
Expand Down Expand Up @@ -883,8 +888,10 @@ def get_records(

self.keep_fields(recs, self.outfields)
self.records = recs
# messages[instrument] => dict[obsid] => rec
self.messages = {r["instrument"]: {r["obs_id"]: r} for r in recs}
# messages[instrument] => [rec, ...]
self.messages = dict()
for instrum in set([r["instrument"] for r in recs]):
self.messages[instrum] = [r for r in recs if instrum == r["instrument"]]

status = dict(
endpoint_url=url,
Expand Down

0 comments on commit 899bd0b

Please sign in to comment.