Skip to content

Commit a2d7799

Browse files
Deech08adrn
authored andcommitted
Change download file to include tutorial_path
1 parent 60027df commit a2d7799

File tree

1 file changed

+100
-39
lines changed

1 file changed

+100
-39
lines changed

tutorials/notebooks/Spectral-FITS-Data/Spectral-FITS-Data.ipynb

+100-39
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@
6464
"\n",
6565
"from specutils import Spectrum1D\n",
6666
"\n",
67-
"%matplotlib inline"
67+
"%matplotlib inline\n",
68+
"\n",
69+
"# Set tutorial path for data files\n",
70+
"tutorial_path = ''"
6871
]
6972
},
7073
{
@@ -83,7 +86,9 @@
8386
{
8487
"cell_type": "code",
8588
"execution_count": null,
86-
"metadata": {},
89+
"metadata": {
90+
"collapsed": true
91+
},
8792
"outputs": [],
8893
"source": [
8994
"catalog_name = 'J/ApJS/212/1/wisecat'\n",
@@ -104,7 +109,9 @@
104109
{
105110
"cell_type": "code",
106111
"execution_count": null,
107-
"metadata": {},
112+
"metadata": {
113+
"collapsed": true
114+
},
108115
"outputs": [],
109116
"source": [
110117
"catalog_sample = catalog_sample_list[0]\n",
@@ -136,7 +143,9 @@
136143
{
137144
"cell_type": "code",
138145
"execution_count": null,
139-
"metadata": {},
146+
"metadata": {
147+
"collapsed": true
148+
},
140149
"outputs": [],
141150
"source": [
142151
"#Lift the row limit for the astroquery Vizier class\n",
@@ -160,7 +169,9 @@
160169
{
161170
"cell_type": "code",
162171
"execution_count": null,
163-
"metadata": {},
172+
"metadata": {
173+
"collapsed": true
174+
},
164175
"outputs": [],
165176
"source": [
166177
"#Delete extra columns of information we don't need\n",
@@ -182,7 +193,9 @@
182193
{
183194
"cell_type": "code",
184195
"execution_count": null,
185-
"metadata": {},
196+
"metadata": {
197+
"collapsed": true
198+
},
186199
"outputs": [],
187200
"source": [
188201
"#Create SkyCoord objects of the coordinates\n",
@@ -215,25 +228,38 @@
215228
"## Download and visualize the WHAM all-sky map\n",
216229
"\n",
217230
"An integrate FITS image of this survey is available online at [http://www.astro.wisc.edu/wham/ss/wham-ss-DR1-v161116-170912-int-grid.fits](http://www.astro.wisc.edu/wham/ss/wham-ss-DR1-v161116-170912-int-grid.fits). We can download this file directly and plot it, overlaying our identified HII region positions. \n",
218-
"\n"
231+
"\n",
232+
"For ease of use - this file is also available through this tutorial directly, so we can download the file from there.\n"
219233
]
220234
},
221235
{
222236
"cell_type": "code",
223237
"execution_count": null,
224-
"metadata": {},
238+
"metadata": {
239+
"collapsed": true
240+
},
225241
"outputs": [],
226242
"source": [
227-
"#Download the wham integrate FITS image\n",
243+
"'''\n",
244+
"# Download the wham integrated FITS image from the UW-Madison host\n",
245+
"\n",
228246
"wham_image_file = download_file(\n",
229247
" 'http://www.astro.wisc.edu/wham/ss/wham-ss-DR1-v161116-170912-int-grid.fits',\n",
230-
" cache=True, show_progress = True)"
248+
" cache=True, show_progress = True)\n",
249+
"'''\n",
250+
"\n",
251+
"#Download the wham integrated FITS image\n",
252+
"wham_image_file = download_file(tutorialpath + \n",
253+
" 'wham-ss-DR1-v161116-170912-int-grid.fits',\n",
254+
" cache=True, show_progress = True)"
231255
]
232256
},
233257
{
234258
"cell_type": "code",
235259
"execution_count": null,
236-
"metadata": {},
260+
"metadata": {
261+
"collapsed": true
262+
},
237263
"outputs": [],
238264
"source": [
239265
"# Open the FITS file for reading\n",
@@ -253,7 +279,9 @@
253279
{
254280
"cell_type": "code",
255281
"execution_count": null,
256-
"metadata": {},
282+
"metadata": {
283+
"collapsed": true
284+
},
257285
"outputs": [],
258286
"source": [
259287
"# Access and store the data and header\n",
@@ -284,7 +312,9 @@
284312
{
285313
"cell_type": "code",
286314
"execution_count": null,
287-
"metadata": {},
315+
"metadata": {
316+
"collapsed": true
317+
},
288318
"outputs": [],
289319
"source": [
290320
"# Initiate a matplotlib figure object\n",
@@ -328,7 +358,9 @@
328358
{
329359
"cell_type": "code",
330360
"execution_count": null,
331-
"metadata": {},
361+
"metadata": {
362+
"collapsed": true
363+
},
332364
"outputs": [],
333365
"source": [
334366
"'''\n",
@@ -374,6 +406,9 @@
374406
"## Examine the WHAM Kinematic Data\n",
375407
"\n",
376408
"The data is available as a FITS Table and can be downloaded directly from [http://www.astro.wisc.edu/wham/ss/wham-ss-DR1-v161116-170912.fits](http://www.astro.wisc.edu/wham/ss/wham-ss-DR1-v161116-170912.fits) and read in as an astropy Table. \n",
409+
"\n",
410+
"Once again for ease of use, this file is also available through this tutorial so we can download by just referring to the filename `wham-ss-DR1-v161116-170912.fits` with `tutorial_path + 'wham-ss-DR1-v161116-170912.fits'\n",
411+
"\n",
377412
"<a id='ex2'></a>\n",
378413
"### Exercise 2: Download the survey file to cache open it to display some info\n",
379414
"\n",
@@ -387,22 +422,19 @@
387422
{
388423
"cell_type": "code",
389424
"execution_count": null,
390-
"metadata": {},
425+
"metadata": {
426+
"collapsed": true
427+
},
391428
"outputs": [],
392429
"source": [
393430
"'''\n",
394431
"Temporarily have solution here for notebook testing\n",
395432
"'''\n",
396433
"\n",
397434
"# Download the Kinematic Data Table\n",
398-
"wham_data_file = download_file('http://www.astro.wisc.edu/wham/ss/wham-ss-DR1-v161116-170912.fits',\n",
399-
" cache=True, show_progress = True)\n",
400-
" \n",
401-
"'''\n",
402-
"Using a local file for now to make my life easy as I write this without an internet connection...\n",
403-
"\n",
404-
"wham_data_file = '/Volumes/DK_Storage/Data/wham/wham-ss-DR1-v161116-170912.fits'\n",
405-
"'''\n",
435+
"wham_data_file = download_file(tutorial_path + \n",
436+
" 'wham-ss-DR1-v161116-170912.fits',\n",
437+
" cache=True, show_progress = True)\n",
406438
"\n",
407439
"# Open the FITS file for reading\n",
408440
"wham_data_hdu = fits.open(wham_data_file)"
@@ -411,7 +443,9 @@
411443
{
412444
"cell_type": "code",
413445
"execution_count": null,
414-
"metadata": {},
446+
"metadata": {
447+
"collapsed": true
448+
},
415449
"outputs": [],
416450
"source": [
417451
"# Display some basic information on the FITS image file\n",
@@ -428,7 +462,9 @@
428462
{
429463
"cell_type": "code",
430464
"execution_count": null,
431-
"metadata": {},
465+
"metadata": {
466+
"collapsed": true
467+
},
432468
"outputs": [],
433469
"source": [
434470
"# View the Primary Header\n",
@@ -438,7 +474,9 @@
438474
{
439475
"cell_type": "code",
440476
"execution_count": null,
441-
"metadata": {},
477+
"metadata": {
478+
"collapsed": true
479+
},
442480
"outputs": [],
443481
"source": [
444482
"# View the Table Header\n",
@@ -455,7 +493,9 @@
455493
{
456494
"cell_type": "code",
457495
"execution_count": null,
458-
"metadata": {},
496+
"metadata": {
497+
"collapsed": true
498+
},
459499
"outputs": [],
460500
"source": [
461501
"wham_data_hdu[1].columns"
@@ -471,7 +511,9 @@
471511
{
472512
"cell_type": "code",
473513
"execution_count": null,
474-
"metadata": {},
514+
"metadata": {
515+
"collapsed": true
516+
},
475517
"outputs": [],
476518
"source": [
477519
"#Read in data as a Table\n",
@@ -519,7 +561,9 @@
519561
{
520562
"cell_type": "code",
521563
"execution_count": null,
522-
"metadata": {},
564+
"metadata": {
565+
"collapsed": true
566+
},
523567
"outputs": [],
524568
"source": [
525569
"wham_data"
@@ -555,7 +599,9 @@
555599
{
556600
"cell_type": "code",
557601
"execution_count": null,
558-
"metadata": {},
602+
"metadata": {
603+
"collapsed": true
604+
},
559605
"outputs": [],
560606
"source": [
561607
"# Match our catalogs\n",
@@ -577,7 +623,9 @@
577623
{
578624
"cell_type": "code",
579625
"execution_count": null,
580-
"metadata": {},
626+
"metadata": {
627+
"collapsed": true
628+
},
581629
"outputs": [],
582630
"source": [
583631
"# Create a sub Table of the WHAM matched data\n",
@@ -598,7 +646,9 @@
598646
{
599647
"cell_type": "code",
600648
"execution_count": null,
601-
"metadata": {},
649+
"metadata": {
650+
"collapsed": true
651+
},
602652
"outputs": [],
603653
"source": [
604654
"# Construct a new Table from the two existing Tables\n",
@@ -653,7 +703,9 @@
653703
{
654704
"cell_type": "code",
655705
"execution_count": null,
656-
"metadata": {},
706+
"metadata": {
707+
"collapsed": true
708+
},
657709
"outputs": [],
658710
"source": [
659711
"# Calculate H-Alpha rest wavelength\n",
@@ -710,7 +762,9 @@
710762
{
711763
"cell_type": "code",
712764
"execution_count": null,
713-
"metadata": {},
765+
"metadata": {
766+
"collapsed": true
767+
},
714768
"outputs": [],
715769
"source": [
716770
"# Function to convert H-Alpha intensity to an Emission Measure\n",
@@ -765,7 +819,9 @@
765819
{
766820
"cell_type": "code",
767821
"execution_count": null,
768-
"metadata": {},
822+
"metadata": {
823+
"collapsed": true
824+
},
769825
"outputs": [],
770826
"source": [
771827
"# Display our final Table\n",
@@ -793,7 +849,9 @@
793849
{
794850
"cell_type": "code",
795851
"execution_count": null,
796-
"metadata": {},
852+
"metadata": {
853+
"collapsed": true
854+
},
797855
"outputs": [],
798856
"source": [
799857
"# Write data to file \n",
@@ -915,7 +973,9 @@
915973
{
916974
"cell_type": "code",
917975
"execution_count": null,
918-
"metadata": {},
976+
"metadata": {
977+
"collapsed": true
978+
},
919979
"outputs": [],
920980
"source": [
921981
"# Initiate a matplotlib figure object\n",
@@ -960,8 +1020,9 @@
9601020
"outputs": [],
9611021
"source": [
9621022
"# Download the Kinematic Data Table\n",
963-
"wham_data_file = download_file('http://www.astro.wisc.edu/wham/ss/wham-ss-DR1-v161116-170912.fits',\n",
964-
" cache=True, show_progress = True)\n",
1023+
"wham_data_file = download_file(tutorial_path + \n",
1024+
" 'wham-ss-DR1-v161116-170912.fits',\n",
1025+
" cache=True, show_progress = True)\n",
9651026
"\n",
9661027
"# Open the FITS file for reading\n",
9671028
"wham_data_hdu = fits.open(wham_data_file)"

0 commit comments

Comments
 (0)