Skip to content

Commit

Permalink
tally_exposure_flags, drill-down links
Browse files Browse the repository at this point in the history
  • Loading branch information
pothiers committed Oct 29, 2024
1 parent e44d240 commit 725fb0d
Show file tree
Hide file tree
Showing 7 changed files with 342 additions and 124 deletions.
145 changes: 145 additions & 0 deletions notebooks_tsqr/ExposureDetail.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "0",
"metadata": {},
"outputs": [],
"source": [
"# Parameters.\n",
"# Times Square replaces this cell with the user's parameters.\n",
"# So, don't put anything else here!\n",
"\n",
"# 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",
"\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",
"\n",
"instrument = \"LSSTComCam\"\n",
"obs_reason = \"ALL\"\n",
"obs_type = \"ALL\"\n",
"science_program = \"ALL\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import pandas as pd\n",
"\n",
"# When running under Times Square, install pkg from github.\n",
"# Otherwise use what is installed locally (intended to be dev editiable pkg)\n",
"if os.environ.get(\"EXTERNAL_INSTANCE_URL\"):\n",
" print(\n",
" 'Installing \"lsst.ts.logging_and_reporting\" from github using \"prototype\" branch....'\n",
" )\n",
" print(\n",
" \"TODO: Make the need for this go away by getting Logging_and_Reporting installed in RSP.\"\n",
" )\n",
" !pip install --upgrade git+https://github.com/lsst-ts/ts_logging_and_reporting.git@prototype > /dev/null 2>&1\n",
"import lsst.ts.logging_and_reporting.source_adapters as sad\n",
"import lsst.ts.logging_and_reporting.utils as ut\n",
"\n",
"# Set default env to \"usdf\" and try before PUSH to repo.\n",
"\n",
"# The default provided here is for local testing.\n",
"# Under Times Square it is ignored.\n",
"server = os.environ.get(\n",
" \"EXTERNAL_INSTANCE_URL\", ut.Server.summit\n",
") # TODO try with \"usdf\" before push (else \"summit\")\n",
"\n",
"# Normalize Parameters (both explicit Times Squares params and implicit ones)\n",
"obs_reason = None if obs_reason == \"ALL\" else obs_reason\n",
"obs_type = None if obs_type == \"ALL\" else obs_type\n",
"science_program = None if science_program == \"ALL\" else science_program"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2",
"metadata": {},
"outputs": [],
"source": [
"src_exp = sad.ExposurelogAdapter(\n",
" server_url=server,\n",
" min_dayobs=None, # INCLUSIVE: default=Yesterday\n",
" max_dayobs=None, # EXCLUSIVE: default=Today other=YYYY-MM-DD\n",
" limit=5000,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3",
"metadata": {},
"outputs": [],
"source": [
"instrument, science_program, obs_reason, obs_type"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4",
"metadata": {},
"outputs": [],
"source": [
"src_exp.exposure_detail(\n",
" instrument=instrument,\n",
" science_program=science_program,\n",
" observation_reason=obs_reason,\n",
" observation_type=obs_type,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5",
"metadata": {},
"outputs": [],
"source": [
"# src_exp.exposures[instrument]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
45 changes: 45 additions & 0 deletions notebooks_tsqr/ExposureDetail.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# For use with a Times Square notebook
title: Exposure Detail
description: Details of Nightly Exposures
authors:
- name: Steve Pothier
slack: Steve Pothier
tags:
- reporting
- prototype
- exposure
parameters:
day_obs:
type: string
description: >
The last observing night to report on. (Allowed: YYYY-MM-DD,
TODAY, YESTERDAY) You probably want YESTERDAY. A value of TODAY
means the last night shown will be the one that starts tonight.`
default: "YESTERDAY"
number_of_days:
type: integer
description: >
Number of days (nights) to show in the report.
default: 1
minimum: 1
maximum: 9
instrument:
type: string
description: >
Instrument used for exposures.
default: "LSSTComCam"
obs_reason:
type: string
description: >
Observation reason.
default: "ALL"
obs_type:
type: string
description: >
Observation reason.
default: "ALL"
science_program:
type: string
description: >
Science Program
default: "ALL"
Loading

0 comments on commit 725fb0d

Please sign in to comment.