diff --git a/notebooks_tsqr/ExposureDetail.ipynb b/notebooks_tsqr/ExposureDetail.ipynb index aa704be..43f849c 100644 --- a/notebooks_tsqr/ExposureDetail.ipynb +++ b/notebooks_tsqr/ExposureDetail.ipynb @@ -39,11 +39,11 @@ "if os.environ.get(\"EXTERNAL_INSTANCE_URL\"):\n", " dev_msg = (\n", " 'Installing \"lsst.ts.logging_and_reporting\" from github using \"prototype\" branch. \\n'\n", - " 'TODO: Make the need for this go away by getting Logging_and_Reporting installed in RSP.'\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", "else:\n", - " dev_msg = 'Imported lsst.ts.logging_and_reporting from local packages.'\n", + " dev_msg = \"Imported lsst.ts.logging_and_reporting from local packages.\"\n", "#! import lsst.ts.logging_and_reporting.source_adapters as sad\n", "import lsst.ts.logging_and_reporting.utils as ut\n", "from lsst.ts.logging_and_reporting.reports import md\n", @@ -68,9 +68,9 @@ ") # TODO try with \"usdf\" before push (else \"summit\")\n", "\n", "# Normalize Parameters (both explicit Times Squares params and implicit ones)\n", - "observation_reason = None if observation_reason=='ALL' else observation_reason\n", - "observation_type = None if observation_type=='ALL' else observation_type\n", - "science_program = None if science_program=='ALL' else science_program\n", + "observation_reason = None if observation_reason == \"ALL\" else observation_reason\n", + "observation_type = None if observation_type == \"ALL\" else observation_type\n", + "science_program = None if science_program == \"ALL\" else science_program\n", "params = dict(\n", " day_obs=day_obs,\n", " instrument=instrument,\n", @@ -91,7 +91,7 @@ "date = ut.get_datetime_from_dayobs_str(day_obs)\n", "# date: is EXCLUSIVE (upto, but not including)\n", "days = 1\n", - "verbose=False\n", + "verbose = False\n", "\n", "# Thus: [min_day_obs,max_day_obs)\n", "# Format: string, YYYY-MM-DD\n", @@ -114,7 +114,7 @@ " server_url=server,\n", " min_dayobs=min_day_obs,\n", " max_dayobs=max_day_obs,\n", - " verbose=verbose, \n", + " verbose=verbose,\n", " limit=5000,\n", ")\n", "allrep = AllReports(allsrc=allsrc)\n", @@ -138,18 +138,19 @@ "metadata": {}, "outputs": [], "source": [ - "df = src_exp.exposure_detail(instrument=instrument,\n", - " science_program=science_program,\n", - " observation_reason=observation_reason,\n", - " observation_type=observation_type\n", - " )\n", + "df = src_exp.exposure_detail(\n", + " instrument=instrument,\n", + " science_program=science_program,\n", + " observation_reason=observation_reason,\n", + " observation_type=observation_type,\n", + ")\n", "if observation_reason:\n", - " md(f'# Observation Reason: {observation_reason}')\n", + " md(f\"# Observation Reason: {observation_reason}\")\n", "if observation_type:\n", - " md(f'# Observation Type: {observation_type}')\n", + " md(f\"# Observation Type: {observation_type}\")\n", "if science_program:\n", - " md(f'# Science Program: {science_program}')\n", - "md(f'The number of exposures in this filtered result is {len(df.index)}')\n", + " md(f\"# Science Program: {science_program}\")\n", + "md(f\"The number of exposures in this filtered result is {len(df.index)}\")\n", "display(HTML(df.to_html(index=False)))" ] }, @@ -188,9 +189,9 @@ "metadata": {}, "outputs": [], "source": [ - "display(params) \n", + "display(params)\n", "print(src_exp)\n", - "print(f'{instrument=}, {science_program=}, {observation_reason=}, {observation_type=}')" + "print(f\"{instrument=}, {science_program=}, {observation_reason=}, {observation_type=}\")" ] }, { @@ -200,7 +201,7 @@ "metadata": {}, "outputs": [], "source": [ - "print({k: len(v) for k,v in src_exp.exposures.items()})" + "print({k: len(v) for k, v in src_exp.exposures.items()})" ] }, { @@ -210,7 +211,7 @@ "metadata": {}, "outputs": [], "source": [ - "#src_exp.exposures['LATISS']" + "# src_exp.exposures['LATISS']" ] }, { diff --git a/notebooks_tsqr/NightLog.ipynb b/notebooks_tsqr/NightLog.ipynb index 41c6720..8988b3e 100644 --- a/notebooks_tsqr/NightLog.ipynb +++ b/notebooks_tsqr/NightLog.ipynb @@ -61,11 +61,11 @@ "if os.environ.get(\"EXTERNAL_INSTANCE_URL\"):\n", " dev_msg = (\n", " 'Installing \"lsst.ts.logging_and_reporting\" from github using \"prototype\" branch. \\n'\n", - " 'TODO: Make the need for this go away by getting Logging_and_Reporting installed in RSP.'\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", "else:\n", - " dev_msg = 'Imported lsst.ts.logging_and_reporting from local packages.'\n", + " dev_msg = \"Imported lsst.ts.logging_and_reporting from local packages.\"\n", "from lsst.ts.logging_and_reporting.all_sources import AllSources\n", "from lsst.ts.logging_and_reporting.all_reports import AllReports\n", "import lsst.ts.logging_and_reporting.utils as ut\n", @@ -83,8 +83,8 @@ "# Set default env to \"usdf\" and try before PUSH to repo.\n", "# The default provided here is for local testing. Under Times Square it is ignored.\n", "server = os.environ.get(\n", - " \"EXTERNAL_INSTANCE_URL\", \n", - " ut.Server.usdf) # TODO try with \"usdf\" before push (also \"summit\")" + " \"EXTERNAL_INSTANCE_URL\", ut.Server.usdf\n", + ") # TODO try with \"usdf\" before push (also \"summit\")" ] }, { @@ -99,10 +99,10 @@ "if error:\n", " print(error)\n", "\n", - "date = ut.get_datetime_from_dayobs_str(usable['day_obs'])\n", + "date = ut.get_datetime_from_dayobs_str(usable[\"day_obs\"])\n", "# date: is EXCLUSIVE (upto, but not including)\n", - "days = usable['number_of_days']\n", - "verbose = usable['verbose']\n", + "days = usable[\"number_of_days\"]\n", + "verbose = usable[\"verbose\"]\n", "\n", "# Thus: [min_day_obs,max_day_obs)\n", "# Format: string, YYYY-MM-DD\n", @@ -125,9 +125,9 @@ " server_url=server,\n", " min_dayobs=min_day_obs,\n", " max_dayobs=max_day_obs,\n", - " verbose=verbose, \n", + " verbose=verbose,\n", " limit=5000,\n", - " exclude_instruments = [] # TODO change to empty list before push\n", + " exclude_instruments=[], # TODO change to empty list before push\n", ")\n", "allrep = AllReports(allsrc=allsrc)" ] @@ -149,7 +149,9 @@ "source": [ "instrum_str = \", \".join(list(allsrc.exp_src.instruments.keys()))\n", "md(f\"# Showing data for {min_date.date()} to {max_date.date()} for {instrum_str}\")\n", - "md(f\"Most recently run on: **{dt.datetime.now().replace(microsecond=0).isoformat(sep=' ')}**\")" + "md(\n", + " f\"Most recently run on: **{dt.datetime.now().replace(microsecond=0).isoformat(sep=' ')}**\"\n", + ")" ] }, { @@ -384,12 +386,12 @@ "source": [ "# Exposure Report\n", "for instrum in allsrc.exp_src.exposures.keys():\n", - " md(f'#### {instrum}: {len(allsrc.exp_src.exposures[instrum])} total exposures')\n", + " md(f\"#### {instrum}: {len(allsrc.exp_src.exposures[instrum])} total exposures\")\n", " df_dict = allsrc.fields_count_exposure(instrum)\n", - " for field_name,df in df_dict.items():\n", + " for field_name, df in df_dict.items():\n", " if df.empty:\n", " continue\n", - " md('##### ' + field_name.title().replace('_',' '))\n", + " md(\"##### \" + field_name.title().replace(\"_\", \" \"))\n", " display(HTML(df.style.hide().to_html(escape=False)))" ] }, @@ -481,7 +483,8 @@ "- {have_consdb = }\n", "- {dev_msg}\n", "- {allsrc.nig_src.timeout=}\n", - "\"\"\")" + "\"\"\"\n", + ")" ] }, { @@ -501,10 +504,7 @@ "outputs": [], "source": [ "df = pd.DataFrame(allsrc.get_data_status())\n", - "table = df.to_html(\n", - " index=False, \n", - " render_links=True,\n", - " escape=False)\n", + "table = df.to_html(index=False, render_links=True, escape=False)\n", "display(HTML(table))" ] }, @@ -601,7 +601,7 @@ "metadata": {}, "outputs": [], "source": [ - "print(f'Elapsed time (excluding code import): {timer.toc:.1f} seconds')\n", + "print(f\"Elapsed time (excluding code import): {timer.toc:.1f} seconds\")\n", "print(f\"Finished {str(dt.datetime.now().replace(microsecond=0))} UTC\")" ] } diff --git a/notebooks_tsqr/dashboard.ipynb b/notebooks_tsqr/dashboard.ipynb index e2a7541..9c42ac3 100644 --- a/notebooks_tsqr/dashboard.ipynb +++ b/notebooks_tsqr/dashboard.ipynb @@ -35,13 +35,13 @@ "source": [ "# Narrativelog components\n", "dash = Dashboard()\n", - "endpoint = 'https://usdf-rsp-dev.slac.stanford.edu/narrativelog/messages'\n", + "endpoint = \"https://usdf-rsp-dev.slac.stanford.edu/narrativelog/messages\"\n", "fields = [\n", - " 'components',\n", - " 'primary_software_components',\n", - " 'primary_hardware_components',\n", + " \"components\",\n", + " \"primary_software_components\",\n", + " \"primary_hardware_components\",\n", "]\n", - "samples = dash.get_big_sample(endpoint,10000,fields)\n", + "samples = dash.get_big_sample(endpoint, 10000, fields)\n", "len(samples)" ] },