Skip to content

Commit 7d45a1d

Browse files
updating stamps nb
1 parent 47b1256 commit 7d45a1d

1 file changed

Lines changed: 41 additions & 68 deletions

File tree

DP1/100_How_to_Use_RSP_Tools/103_Image_access_and_display/103_9_Image_stamps.ipynb

Lines changed: 41 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
"id": "114a1c30-b0f0-4bb8-a867-1cbec46f63b9",
226226
"metadata": {},
227227
"source": [
228-
"Within that folder, create a sub-folder named `dp02_13a_temp` in which to save files created by this tutorial.\n",
228+
"Within that folder, create a sub-folder named `dp1_103_9_temp` in which to save files created by this tutorial.\n",
229229
"At the end of the notebook, the last cell will clear the contents and remove this temporary folder."
230230
]
231231
},
@@ -236,7 +236,7 @@
236236
"metadata": {},
237237
"outputs": [],
238238
"source": [
239-
"tempdir = userdir + '/dp1_103_5_temp'\n",
239+
"tempdir = userdir + '/dp1_103_9_temp'\n",
240240
"if not os.path.exists(tempdir):\n",
241241
" os.makedirs(tempdir)\n",
242242
" print('Created ', tempdir)\n",
@@ -369,12 +369,11 @@
369369
" #axes = axes.flatten() if n_subplots > 1 else [axes]\n",
370370
"\n",
371371
" for ax in axes:\n",
372-
" ax.axis(\"off\") # ← removes frame, ticks, labels, everything\n",
372+
" ax.axis(\"off\")\n",
373373
"\n",
374374
" for ax in axes[n_subplots:]:\n",
375375
" ax.remove()\n",
376376
"\n",
377-
" \n",
378377
" return fig, axes[:n_subplots]"
379378
]
380379
},
@@ -706,7 +705,8 @@
706705
"ax2.coords['dec'].set_axislabel('Declination')\n",
707706
"ax2.coords['dec'].set_axislabel_position('r')\n",
708707
"ax2.coords['dec'].set_ticklabel_position('r')\n",
709-
"ax2.set_title('Template Image')\n"
708+
"ax2.set_title('Template Image')\n",
709+
"plt.show()"
710710
]
711711
},
712712
{
@@ -734,28 +734,28 @@
734734
"metadata": {},
735735
"outputs": [],
736736
"source": [
737-
"num_visits = len(scitab['t_max'])\n",
738-
"#print('number of visits:', num_visits)\n",
739-
"#for i in range(num_visits):\n",
740-
"# plt.title(f\"MJD {np.round(scitab['t_max'][i], 4)}\")\n",
737+
"num_visits = 20 #len(scitab['t_max'])\n",
738+
"print('number of visits:', num_visits)\n",
739+
"for i in range(num_visits):\n",
740+
" plt.title(f\"MJD {np.round(scitab['t_max'][i], 4)}\")\n",
741741
"\n",
742-
"# dl_result_sci = DatalinkResults.from_result_url(scitab['access_url'][i],\n",
743-
"# session=get_pyvo_auth())\n",
742+
" dl_result_sci = DatalinkResults.from_result_url(scitab['access_url'][i],\n",
743+
" session=get_pyvo_auth())\n",
744744
"\n",
745-
"# sci, scihdul = get_cutout(dl_result_sci, ra, dec, get_pyvo_auth(), fov)\n",
746-
"# sci_hdu = scihdul[1]\n",
747-
"# sci_header = scihdul[1].header\n",
748-
"# scidata = scihdul[1].data\n",
749-
"# sciwcs = WCS(scihdul[1].header)\n",
750-
"# reproj_scidata, footprint = reproject_interp((scidata, sciwcs), refwcs)\n",
745+
" sci, scihdul = get_cutout(dl_result_sci, ra, dec, get_pyvo_auth(), fov)\n",
746+
" sci_hdu = scihdul[1]\n",
747+
" sci_header = scihdul[1].header\n",
748+
" scidata = scihdul[1].data\n",
749+
" sciwcs = WCS(scihdul[1].header)\n",
750+
" reproj_scidata, footprint = reproject_interp((scidata, sciwcs), refwcs)\n",
751751
"\n",
752-
"# plt.imshow(reproj_scidata, origin='lower', vmin=np.nanpercentile(reproj_scidata, 1),\n",
753-
"# vmax=np.nanpercentile(reproj_scidata, 99))\n",
752+
" plt.imshow(reproj_scidata, origin='lower', vmin=np.nanpercentile(reproj_scidata, 1),\n",
753+
" vmax=np.nanpercentile(reproj_scidata, 99))\n",
754754
"\n",
755-
"# figname = os.path.join(tempdir, 'cutout_' + str(i) + '.png')\n",
756-
"# if os.path.isfile(figname):\n",
757-
"# os.remove(figname)\n",
758-
"# plt.savefig(figname)\n"
755+
" figname = os.path.join(tempdir, 'cutout_' + str(i) + '.png')\n",
756+
" if os.path.isfile(figname):\n",
757+
" os.remove(figname)\n",
758+
" plt.savefig(figname)\n"
759759
]
760760
},
761761
{
@@ -773,37 +773,15 @@
773773
"metadata": {},
774774
"outputs": [],
775775
"source": [
776-
"fig, axes = make_subplot_grid(100)\n",
776+
"fig, axes = make_subplot_grid(num_visits)\n",
777777
"for i, ax in enumerate(axes):\n",
778778
"\n",
779-
" j = i #+ 5\n",
779+
" j = i\n",
780780
" figname = os.path.join(tempdir, 'cutout_' + str(j) + '.png')\n",
781781
" img = mpimg.imread(figname)\n",
782782
"\n",
783-
"# 2. Display the image\n",
784-
"# imshow interprets the array as an image\n",
785783
" ax.imshow(img)\n",
786784
"\n",
787-
" #ax.set_title(f\"MJD {np.round(scitab['t_max'][j], 4)}\")\n",
788-
"\n",
789-
" #dl_result_sci = DatalinkResults.from_result_url(scitab['access_url'][j],\n",
790-
" # session=get_pyvo_auth())\n",
791-
"\n",
792-
" #sci, scihdul = get_cutout(dl_result_sci, ra, dec, get_pyvo_auth(), fov)\n",
793-
" #sci_hdu = scihdul[1]\n",
794-
" #sci_header = scihdul[1].header\n",
795-
" #scidata = scihdul[1].data\n",
796-
" #sciwcs = WCS(scihdul[1].header)\n",
797-
" #reproj_scidata, footprint = reproject_interp((scidata, sciwcs), refwcs)\n",
798-
"\n",
799-
" #ax.imshow(reproj_scidata, origin='lower', vmin=np.nanpercentile(reproj_scidata, 1),\n",
800-
" # vmax=np.nanpercentile(reproj_scidata, 99))\n",
801-
"\n",
802-
" #figname = os.path.join(tempdir, 'cutout_' + str(i) + '.png')\n",
803-
" #if os.path.isfile(figname):\n",
804-
" # os.remove(figname)\n",
805-
" #plt.savefig(figname)\n",
806-
"\n",
807785
"plt.tight_layout()\n",
808786
"plt.show()"
809787
]
@@ -813,7 +791,7 @@
813791
"id": "2b54d1d3-9564-4836-8265-4c8eedc4502a",
814792
"metadata": {},
815793
"source": [
816-
"> **Figure 3**: Many cutouts of the science visit images of the DIA object, in chronological order, after being reprojected onto the same WCS as the template image cutout (right). Every Nth visit of the 117 existing visits is plotted for brevity.\n"
794+
"> **Figure 3**: Many cutouts of the science visit images of the DIA object, in chronological order, after being reprojected onto the same WCS as the template image cutout (right). "
817795
]
818796
},
819797
{
@@ -829,43 +807,38 @@
829807
]
830808
},
831809
{
832-
"cell_type": "code",
833-
"execution_count": null,
810+
"cell_type": "markdown",
811+
"id": "1c07a8b1-f24a-4c03-a56b-515a381cfa42",
812+
"metadata": {},
813+
"source": [
814+
"> **Figure 4**: A gif animation generated from the reproject visit images in Figure 3."
815+
]
816+
},
817+
{
818+
"cell_type": "markdown",
834819
"id": "172dc7bb-67ee-49f9-bee1-a6f50ad96c89",
835820
"metadata": {},
836-
"outputs": [],
837-
"source": []
821+
"source": [
822+
"## 4. Future functionality\n",
823+
"\n",
824+
"when rotate, don't do grid in final version, then get to a releasable version if you explain that the wcs rotate and just produce a rotated image (png, no wcs info) rotated visit image stamp that you can make a png image out of. Say a few things about how we're working on how to overplot grid lines and wcs functionality. this gets us to a publishable thing "
825+
]
838826
},
839827
{
840828
"cell_type": "markdown",
841829
"id": "a8eb043b-5afe-4990-9050-bd059aaf5abf",
842830
"metadata": {},
843831
"source": [
844832
"\n",
845-
"when rotate, don't do grid in final version, then get to a releasable version if you explain that the wcs rotate and just produce a rotated image (png, no wcs info) rotated visit image stamp that you can make a png image out of. Say a few things about how we're working on how to overplot grid lines and wcs functionality. this gets us to a publishable thing \n",
833+
"\n",
846834
"\n",
847835
"only for epochs where it was detected in visit images. users can extrapolate to get all images. \n",
848836
"\n",
849837
"show how to do smaller more constrained part (i.e timeline over which visits are retrieved; where a dia ). \n",
850838
"\n",
851839
"\n",
852-
" We want to show how to store a bunch of png files. Once you have those on file then you can just use a simple\n",
853-
" function to make the gif\n",
854-
"\n",
855-
"\n",
856-
" note: store png files to scratch directory\n",
857-
" cutouts could be even smaller than this.\n",
858-
"\n",
859840
"start with an ra/dec and date range where you already know. don't even need to refer to the other notebook\n"
860841
]
861-
},
862-
{
863-
"cell_type": "markdown",
864-
"id": "1c07a8b1-f24a-4c03-a56b-515a381cfa42",
865-
"metadata": {},
866-
"source": [
867-
"> **Figure 4**: A gif animation generated from the reproject visit images in Figure 3."
868-
]
869842
}
870843
],
871844
"metadata": {

0 commit comments

Comments
 (0)