From 027052142745a723ffdb1cc7a01ff91b2ff5e270 Mon Sep 17 00:00:00 2001 From: jrob93 Date: Wed, 14 Oct 2026 10:26:16 +0000 Subject: [PATCH 1/7] save to fits --- .../202_Images/202_1_Deep_coadds.ipynb | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb b/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb index c4d7e54a..fa41bbf8 100644 --- a/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb +++ b/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb @@ -1826,16 +1826,52 @@ "outputs": [], "source": [ "del ref, dataId, use_tract, use_patch, use_columns, objects, tx\n", - "del dataset_refs, deep_coadd" + "del dataset_refs" + ] + }, + { + "cell_type": "markdown", + "id": "c06ebdd7-482a-43a6-aed8-4ed053c8d184", + "metadata": {}, + "source": [ + "## 6. Save `deep_coadd` to file\n", + "`deep_coadd` is a `CellCoadd` object type and has an associated method to write the object to file, as described in the [API](https://images.lsst.io/api/lsst.images.cells.CellCoadd.html#lsst.images.cells.CellCoadd.write). Uncomment the following cell to save `deep_coadd` as a FITS file." ] }, { "cell_type": "code", "execution_count": null, + "id": "255b693c-4767-4152-addf-1d98a7276783", + "metadata": {}, + "outputs": [], + "source": [ + "# deep_coadd.image.write(\n", + "# \"deep_coadd_{}_{}_{}_{}.fits\".format(\n", + "# deep_coadd.skymap,\n", + "# deep_coadd.tract,\n", + "# deep_coadd.patch.id,\n", + "# deep_coadd.band\n", + "# )\n", + "# )" + ] + }, + { + "cell_type": "markdown", "id": "8270ac15-73ee-4e87-ab72-f0a12b3c455f", "metadata": {}, + "source": [ + "Clean up." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7cf73981-189c-401d-bde8-e6e8fc26b31e", + "metadata": {}, "outputs": [], - "source": [] + "source": [ + "del deep_coadd" + ] } ], "metadata": { From 719bb8e96630a57a6d3d544d20ec116b7c7d6fb2 Mon Sep 17 00:00:00 2001 From: jrob93 Date: Tue, 20 Oct 2026 14:54:41 +0000 Subject: [PATCH 2/7] retrigger checks From ed92f9e34bd813e433ea295eebcfd461252e6da6 Mon Sep 17 00:00:00 2001 From: jrob93 Date: Tue, 27 Oct 2026 16:47:58 +0000 Subject: [PATCH 3/7] save fits to scratch dir --- .../202_Images/202_1_Deep_coadds.ipynb | 51 +++++++++++++++---- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb b/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb index fa41bbf8..b79a8875 100644 --- a/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb +++ b/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb @@ -74,7 +74,7 @@ "### 1.1. Import packages\n", "\n", "From the LSST Science Pipelines import the packages for the Butler, 2-dimensional sky geometry, and for image display.\n", - "Also import the `numpy` package, `matplotlib` plotting tools, and `Astropy` coordinate utilities." + "Also import the `numpy` package, `matplotlib` plotting tools, `Astropy` coordinate utilities, and `getpass` for setting up a temporary directory." ] }, { @@ -92,7 +92,8 @@ "import astropy.units as u\n", "import matplotlib.pyplot as plt\n", "from matplotlib.collections import PatchCollection\n", - "import numpy as np" + "import numpy as np\n", + "import getpass" ] }, { @@ -1835,7 +1836,33 @@ "metadata": {}, "source": [ "## 6. Save `deep_coadd` to file\n", - "`deep_coadd` is a `CellCoadd` object type and has an associated method to write the object to file, as described in the [API](https://images.lsst.io/api/lsst.images.cells.CellCoadd.html#lsst.images.cells.CellCoadd.write). Uncomment the following cell to save `deep_coadd` as a FITS file." + "`deep_coadd` is a `CellCoadd` object type and has an associated method to write the object to file, as described in the [API](https://images.lsst.io/api/lsst.images.cells.CellCoadd.html#lsst.images.cells.CellCoadd.write). It is recommended for users to save temporary files in the shared scratch directory, `/deleted-sundays/`, in sub-directories named with their RSP username." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6f0887f4-b789-42d7-b1da-931d2e42e45b", + "metadata": {}, + "outputs": [], + "source": [ + "username = getpass.getuser()\n", + "print('username: ', username)\n", + "\n", + "userdir = '/deleted-sundays/' + username\n", + "if not os.path.exists(userdir):\n", + " os.makedirs(userdir)\n", + " print('Created ', userdir)\n", + "else:\n", + " print('Directory already existed: ', userdir)" + ] + }, + { + "cell_type": "markdown", + "id": "aa295f27-e9df-42cc-9911-192bb3798458", + "metadata": {}, + "source": [ + "Uncomment the following cell to save `deep_coadd` as a FITS file in the scratch directory." ] }, { @@ -1845,14 +1872,16 @@ "metadata": {}, "outputs": [], "source": [ - "# deep_coadd.image.write(\n", - "# \"deep_coadd_{}_{}_{}_{}.fits\".format(\n", - "# deep_coadd.skymap,\n", - "# deep_coadd.tract,\n", - "# deep_coadd.patch.id,\n", - "# deep_coadd.band\n", - "# )\n", - "# )" + "save_file = \"{}/deep_coadd_{}_{}_{}_{}.fits\".format(\n", + " userdir,\n", + " deep_coadd.skymap,\n", + " deep_coadd.tract,\n", + " deep_coadd.patch.id,\n", + " deep_coadd.band\n", + " )\n", + "\n", + "print(\"save file: {}\".format(save_file))\n", + "deep_coadd.image.write(save_file)" ] }, { From 29361956595cc39aaa28f355cf70e1c1dfdacd38 Mon Sep 17 00:00:00 2001 From: jrob93 Date: Tue, 27 Oct 2026 16:51:14 +0000 Subject: [PATCH 4/7] save fits to scratch dir --- .../202_Images/202_1_Deep_coadds.ipynb | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb b/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb index b79a8875..bf5df1f8 100644 --- a/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb +++ b/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb @@ -74,7 +74,7 @@ "### 1.1. Import packages\n", "\n", "From the LSST Science Pipelines import the packages for the Butler, 2-dimensional sky geometry, and for image display.\n", - "Also import the `numpy` package, `matplotlib` plotting tools, `Astropy` coordinate utilities, and `getpass` for setting up a temporary directory." + "Also import the `numpy` package, `matplotlib` plotting tools, and `Astropy` coordinate utilities. Import `os` and `getpass` for setting up a temporary directory to save files." ] }, { @@ -93,6 +93,7 @@ "import matplotlib.pyplot as plt\n", "from matplotlib.collections import PatchCollection\n", "import numpy as np\n", + "import os\n", "import getpass" ] }, @@ -1872,16 +1873,16 @@ "metadata": {}, "outputs": [], "source": [ - "save_file = \"{}/deep_coadd_{}_{}_{}_{}.fits\".format(\n", - " userdir,\n", - " deep_coadd.skymap,\n", - " deep_coadd.tract,\n", - " deep_coadd.patch.id,\n", - " deep_coadd.band\n", - " )\n", + "# save_file = \"{}/deep_coadd_{}_{}_{}_{}.fits\".format(\n", + "# userdir,\n", + "# deep_coadd.skymap,\n", + "# deep_coadd.tract,\n", + "# deep_coadd.patch.id,\n", + "# deep_coadd.band\n", + "# )\n", "\n", - "print(\"save file: {}\".format(save_file))\n", - "deep_coadd.image.write(save_file)" + "# print(\"save file: {}\".format(save_file))\n", + "# deep_coadd.image.write(save_file)" ] }, { From c344bc0f7b15f7a6e41f39782b9aed51d8f96036 Mon Sep 17 00:00:00 2001 From: jrob93 Date: Fri, 30 Oct 2026 17:07:28 +0000 Subject: [PATCH 5/7] Empty commit From 1b8f4321d7d1533fb78e32082e09c5e2fae545f2 Mon Sep 17 00:00:00 2001 From: jrob93 Date: Fri, 30 Oct 2026 19:47:14 +0000 Subject: [PATCH 6/7] garreth comments --- .../202_Images/202_1_Deep_coadds.ipynb | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb b/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb index 540db1c3..b6a040d6 100644 --- a/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb +++ b/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb @@ -1882,7 +1882,7 @@ "id": "aa295f27-e9df-42cc-9911-192bb3798458", "metadata": {}, "source": [ - "Uncomment the following cell to save `deep_coadd` as a FITS file in the scratch directory." + "Execute the following cell to save `deep_coadd` as a FITS file in the scratch directory." ] }, { @@ -1892,16 +1892,17 @@ "metadata": {}, "outputs": [], "source": [ - "# save_file = \"{}/deep_coadd_{}_{}_{}_{}.fits\".format(\n", - "# userdir,\n", - "# deep_coadd.skymap,\n", - "# deep_coadd.tract,\n", - "# deep_coadd.patch.id,\n", - "# deep_coadd.band\n", - "# )\n", + "file_name = \"deep_coadd_{}_{}_{}_{}.fits\".format(\n", + " deep_coadd.skymap,\n", + " deep_coadd.tract,\n", + " deep_coadd.patch.id,\n", + " deep_coadd.band\n", + " )\n", "\n", - "# print(\"save file: {}\".format(save_file))\n", - "# deep_coadd.image.write(save_file)" + "save_file = os.path.join(userdir,file_name)\n", + "\n", + "deep_coadd.image.write(save_file)\n", + "print(\"File saved as: {}\".format(save_file))" ] }, { @@ -1919,8 +1920,17 @@ "metadata": {}, "outputs": [], "source": [ + "os.remove(save_file)\n", "del deep_coadd" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "edc33099-b5d9-4e09-8d5d-4cc4a5526c3c", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { From 57d7b21088ddebaaaaf761d595e102c172377c5d Mon Sep 17 00:00:00 2001 From: jrob93 Date: Fri, 30 Oct 2026 19:49:03 +0000 Subject: [PATCH 7/7] garreth comments --- .../202_Images/202_1_Deep_coadds.ipynb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb b/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb index b6a040d6..3dd12b6a 100644 --- a/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb +++ b/DP2/200_Data_products/202_Images/202_1_Deep_coadds.ipynb @@ -1893,13 +1893,13 @@ "outputs": [], "source": [ "file_name = \"deep_coadd_{}_{}_{}_{}.fits\".format(\n", - " deep_coadd.skymap,\n", - " deep_coadd.tract,\n", - " deep_coadd.patch.id,\n", - " deep_coadd.band\n", - " )\n", + " deep_coadd.skymap,\n", + " deep_coadd.tract,\n", + " deep_coadd.patch.id,\n", + " deep_coadd.band\n", + ")\n", "\n", - "save_file = os.path.join(userdir,file_name)\n", + "save_file = os.path.join(userdir, file_name)\n", "\n", "deep_coadd.image.write(save_file)\n", "print(\"File saved as: {}\".format(save_file))"