From cca18f1a128d938cd5df3a90c11000b916e7c355 Mon Sep 17 00:00:00 2001 From: Valerie Becker Date: Wed, 18 Sep 2024 23:55:55 +0000 Subject: [PATCH] looping over provided instruments --- notebooks_tsqr/consdb/assorted_plots.ipynb | 80 ++++++++++++---------- 1 file changed, 42 insertions(+), 38 deletions(-) diff --git a/notebooks_tsqr/consdb/assorted_plots.ipynb b/notebooks_tsqr/consdb/assorted_plots.ipynb index add6b45..7d64afb 100644 --- a/notebooks_tsqr/consdb/assorted_plots.ipynb +++ b/notebooks_tsqr/consdb/assorted_plots.ipynb @@ -53,36 +53,17 @@ }, { "cell_type": "markdown", - "id": "656dd809", + "id": "4", "metadata": {}, "source": [] }, { "cell_type": "code", "execution_count": null, - "id": "4", + "id": "5", "metadata": {}, "outputs": [], "source": [ - "\n", - "psf_query = f'''\n", - " SELECT psf_area FROM cdb_lsstcomcamsim.ccdvisit1_quicklook\n", - " where day_obs = {day_obs_int}\n", - "'''\n", - "\n", - "sky_brightness_query = f'''\n", - "'''\n", - "\n", - "zero_point_query = f'''\n", - " SELECT zero_point FROM cdb_lsstcomcamsim.ccdvisit1_quicklook\n", - " where day_obs = {day_obs_int}\n", - "'''\n", - "\n", - "ra_dec_query = f'''\n", - " SELECT s_ra, s_dec FROM cdb_lsstcomcamsim.ccdvisit1_quicklook\n", - " where day_obs = {day_obs_int}\n", - "'''\n", - "\n", "plt.style.use('seaborn-v0_8-bright')\n", "def plot(y, x):\n", " # plot\n", @@ -95,15 +76,16 @@ { "cell_type": "code", "execution_count": null, - "id": "5", + "id": "6", "metadata": {}, "outputs": [], "source": [ "day_obs_int = int(day_obs.replace('-', ''))\n", "\n", - "instrument_list = instruments.split(',',' ')\n", + "instrument_list = [ins.strip() for ins in instruments.split(',')]\n", "\n", "for instrument in instrument_list:\n", + " print(f'instrumental {instrument}')\n", " ccdvisit1_quicklook = f'''\n", " SELECT * FROM cdb_{instrument}.ccdvisit1_quicklook\n", " '''\n", @@ -119,18 +101,24 @@ " visits = visits.join(quicklook, on='visit_id',lsuffix='',rsuffix='_q')\n", "\n", " # If we see data exist in psf, zero, then we should pare down like visits_today below\n", - " visits_w_psf = visits[visits['psf_area'].notna()]\n", - " time = visits_w_psf['obs_start']\n", - " print(f'length of visits with psf_area populated {len(visits_w_psf)}')\n", - " display_markdown('# psf_area vs obs_start', raw=True)\n", - " plot(time, visits_w_psf['psf_area'])\n", - "\n", - " visits_w_zero = visits[visits['zero_point'].notna()]\n", - " time = visits_w_zero['obs_start']\n", - " print(f'length of visits with zero_point populated {len(visits_w_zero)}')\n", - " display_markdown('# zero_point vs obs_start', raw=True)\n", - " plot(time, visits_w_zero['zero_point'])\n", - "\n", + " try:\n", + " visits_w_psf = visits[visits['psf_area'].notna()]\n", + " time = visits_w_psf['obs_start']\n", + " print(f'length of visits with psf_area populated {len(visits_w_psf)}')\n", + " display_markdown('# psf_area vs obs_start', raw=True)\n", + " plot(time, visits_w_psf['psf_area'])\n", + " except KeyError as err:\n", + " print(\"No psf\")\n", + " \n", + " try:\n", + " visits_w_zero = visits[visits['zero_point'].notna()]\n", + " time = visits_w_zero['obs_start']\n", + " print(f'length of visits with zero_point populated {len(visits_w_zero)}')\n", + " display_markdown('# zero_point vs obs_start', raw=True)\n", + " plot(time, visits_w_zero['zero_point'])\n", + " except KeyError as err:\n", + " print(\"No zero_point\")\n", + " \n", " # Pare down to only day obs\n", " visits_today = visits[(visits['day_obs'] == day_obs_int)]\n", "\n", @@ -139,13 +127,29 @@ " display_markdown('# Ra Dec proof they populated', raw=True)\n", " plot(ra, dec)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { "kernelspec": { - "display_name": "logrep", + "display_name": "LSST", "language": "python", - "name": "python3" + "name": "lsst" }, "language_info": { "codemirror_mode": { @@ -157,7 +161,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.5" + "version": "3.11.9" } }, "nbformat": 4,