Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pothiers committed Dec 17, 2024
1 parent 78849b3 commit 55e6f27
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 71 deletions.
53 changes: 17 additions & 36 deletions notebooks_tsqr/ExposureDetail.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"# 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-12-05\" # TODO Change to 'YESTERDAY' to test with default before push\n",
"day_obs = \"2024-09-25\" # TODO Change to 'YESTERDAY' to test with default before push\n",
"instrument = \"LSSTComCam\" # LSSTComCam, LATISS\n",
"observation_reason = \"ALL\"\n",
"observation_type = \"science\" # TODO: \"science\", \"acq\", default=\"ALL\"\n",
"observation_type = \"flat\" # TODO: \"science\", \"acq\", default=\"ALL\"\n",
"science_program = \"ALL\""
]
},
Expand Down Expand Up @@ -114,10 +114,9 @@
" min_dayobs=min_day_obs,\n",
" max_dayobs=max_day_obs,\n",
" verbose=False, # TODO change to False before push\n",
" warning=False, # TODO change to True before push\n",
" limit=5000,\n",
")\n",
"#!allrep = AllReports(allsrc=allsrc)\n",
"#!src_exp = allsrc.exp_src"
")"
]
},
{
Expand All @@ -126,26 +125,6 @@
"id": "5",
"metadata": {},
"outputs": [],
"source": [
"#! allrep.exp_rep.time_log_as_markdown()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6",
"metadata": {},
"outputs": [],
"source": [
"#! display(HTML(allsrc.cdb_src.get_exposures(instrument).to_html()))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7",
"metadata": {},
"outputs": [],
"source": [
"if observation_reason:\n",
" md(f\"# Observation Reason: {observation_reason}\")\n",
Expand All @@ -161,13 +140,12 @@
")\n",
"\n",
"md(f\"The number of exposures in this filtered result is {len(df.index)}\")\n",
"display(HTML(df.to_html(index=False)))\n",
"#!print(f'{df.columns.to_list()=}')"
"display(HTML(df.to_html(index=False)))"
]
},
{
"cell_type": "markdown",
"id": "8",
"id": "6",
"metadata": {},
"source": [
"| Symbol | Meaning |\n",
Expand All @@ -179,15 +157,15 @@
},
{
"cell_type": "markdown",
"id": "9",
"id": "7",
"metadata": {},
"source": [
"-----------------"
]
},
{
"cell_type": "markdown",
"id": "10",
"id": "8",
"metadata": {},
"source": [
"# Developer Only Section"
Expand All @@ -196,7 +174,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "11",
"id": "9",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -208,7 +186,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "12",
"id": "10",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -218,20 +196,23 @@
{
"cell_type": "code",
"execution_count": null,
"id": "13",
"id": "11",
"metadata": {},
"outputs": [],
"source": [
"# src_exp.exposures['LATISS']"
"allsrc"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "14",
"id": "12",
"metadata": {},
"outputs": [],
"source": []
"source": [
"print(f\"Elapsed time (excluding code import): {timer.toc:.1f} seconds\")\n",
"print(f\"Finished {str(dt.datetime.now().replace(microsecond=0))} UTC\")"
]
}
],
"metadata": {
Expand Down
52 changes: 34 additions & 18 deletions notebooks_tsqr/NightLog.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"***What are we missing?*** See the slack *#ts-logging* channel for discussion about this page. Use it to report problems, ask questions, and make requests for changes. \n",
"\n",
"## What is new in this application?(newest change at top of list)\n",
"- Stakeholders decided that supported instruments will be: LSSTComCam, LSSTCam, and LATISS. Of those, LSSTCam is not supported in ConsDB and limitations in LATISS will force some of the requested fields for ExposureDetail to be given as NA.\n",
"- Added optional WARNING behavior to alert when no records are found, instruments are excluded from results, etc.\n",
"- Name change of this page to *Nightly Digest* (but file name remains the same)\n",
"- Added Merged time-log with compaction. Merges all sources by time and compacts them into a single time period (currently 4 hour). Rendering of DataFrame is now done via a jinja2 Template which gives much greater (largely unrealized) control over display.\n",
"- Added initial Consolidated Database section\n",
"- Add section for \"Links to related resources\". Let us know is other links should be added.\n",
Expand Down Expand Up @@ -47,7 +50,7 @@
"# day_obs values: TODAY, v, YYYY-MM-DD\n",
"# Report on observing nights that start upto but not included this day.\n",
"# day_obs = '2024-09-25' # 2024-12-05 Value to use for local testing (Summit)\n",
"day_obs = \"2024-12-15\" # TODO Change to 'YESTERDAY' and 'TODAY' to test with default before push\n",
"day_obs = \"2024-09-25\" # TODO Change to 'YESTERDAY' and 'TODAY' 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 Expand Up @@ -144,6 +147,7 @@
" min_dayobs=min_day_obs,\n",
" max_dayobs=max_day_obs,\n",
" verbose=verbose,\n",
" warning=False, # TODO change to True before push\n",
" limit=5000,\n",
" exclude_instruments=[], # TODO change to empty list before push\n",
")\n",
Expand Down Expand Up @@ -520,21 +524,33 @@
"metadata": {},
"outputs": [],
"source": [
"display(HTML(tl.sutl(allsrc, delta=\"3h\")))"
"allsrc"
]
},
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"id": "34",
"metadata": {},
"outputs": [],
"source": [
"# from importlib import reload\n",
"# reload(tl)\n",
"display(HTML(tl.sutl(allsrc, delta=\"3h\", verbose=False)))"
]
},
{
"cell_type": "markdown",
"id": "35",
"metadata": {},
"source": [
"-----------\n",
"------------"
]
},
{
"cell_type": "markdown",
"id": "35",
"id": "36",
"metadata": {},
"source": [
"# Developer Only Section <font style=\"background-color:red; olor:black; font-size:20px\">REMOVE</font>\n",
Expand All @@ -545,7 +561,7 @@
},
{
"cell_type": "markdown",
"id": "36",
"id": "37",
"metadata": {},
"source": [
"## Overview \n"
Expand All @@ -554,7 +570,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "37",
"id": "38",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -587,7 +603,7 @@
},
{
"cell_type": "markdown",
"id": "38",
"id": "39",
"metadata": {},
"source": [
"## Data Status\n",
Expand All @@ -597,7 +613,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "39",
"id": "40",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -608,7 +624,7 @@
},
{
"cell_type": "markdown",
"id": "40",
"id": "41",
"metadata": {},
"source": [
"## This report uses the following data sources\n",
Expand All @@ -623,7 +639,7 @@
},
{
"cell_type": "markdown",
"id": "41",
"id": "42",
"metadata": {},
"source": [
"## Where was this run?\n",
Expand All @@ -638,7 +654,7 @@
},
{
"cell_type": "markdown",
"id": "42",
"id": "43",
"metadata": {},
"source": [
"## Available Consolidated Database fields\n",
Expand All @@ -652,7 +668,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "43",
"id": "44",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -670,7 +686,7 @@
},
{
"cell_type": "markdown",
"id": "44",
"id": "45",
"metadata": {},
"source": [
"## Section overviews moved here"
Expand All @@ -679,7 +695,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "45",
"id": "46",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -694,7 +710,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "46",
"id": "47",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -708,7 +724,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "47",
"id": "48",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -718,7 +734,7 @@
},
{
"cell_type": "markdown",
"id": "48",
"id": "49",
"metadata": {},
"source": [
"## Finale"
Expand All @@ -727,7 +743,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "49",
"id": "50",
"metadata": {},
"outputs": [],
"source": [
Expand Down
2 changes: 1 addition & 1 deletion notebooks_tsqr/NightLog.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# For use with a Times Square notebook
title: Night Summary
title: Nightly Digest
description: Combined report from Summit logs
authors:
- name: Steve Pothier
Expand Down
10 changes: 7 additions & 3 deletions python/lsst/ts/logging_and_reporting/all_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ def __init__(
min_dayobs=None, # INCLUSIVE: default=(max_dayobs - one_day)
limit=None,
verbose=False,
warning=True,
exclude_instruments=None,
):
self.verbose = verbose
self.warning = warning
self.exclude_instruments = exclude_instruments or []
ut.tic()
# Load data for all needed sources for the selected dayobs range.
Expand All @@ -76,8 +78,8 @@ def __init__(
server_url=server_url,
min_dayobs=min_dayobs,
max_dayobs=max_dayobs,
warning=warning,
)

self.alm_src = alm.Almanac(
min_dayobs=min_dayobs,
max_dayobs=max_dayobs,
Expand Down Expand Up @@ -505,8 +507,10 @@ def exposure_detail(
)

if 0 == len(crecs) + len(erecs):
msg = f"No records found for ConsDB or ExposureLog for {instrument=}."
warnings.warn(msg, category=ex.NoRecordsWarning, stacklevel=2)
if self.warning:
msg = "No records found for ConsDB or ExposureLog "
msg += f"for {instrument=}."
warnings.warn(msg, category=ex.NoRecordsWarning, stacklevel=2)
return pd.DataFrame() # empty

# Join records by c.exposure_id = e.id (using Pandas)
Expand Down
Loading

0 comments on commit 55e6f27

Please sign in to comment.