Skip to content

Commit

Permalink
Change download file to include tutorial_path
Browse files Browse the repository at this point in the history
  • Loading branch information
Deech08 committed May 4, 2018
1 parent 71a733f commit 20dd162
Showing 1 changed file with 100 additions and 39 deletions.
139 changes: 100 additions & 39 deletions tutorials/notebooks/Spectral-FITS-Data/Spectral-FITS-Data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@
"\n",
"from specutils import Spectrum1D\n",
"\n",
"%matplotlib inline"
"%matplotlib inline\n",
"\n",
"# Set tutorial path for data files\n",
"tutorial_path = ''"
]
},
{
Expand All @@ -83,7 +86,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"catalog_name = 'J/ApJS/212/1/wisecat'\n",
Expand All @@ -104,7 +109,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"catalog_sample = catalog_sample_list[0]\n",
Expand Down Expand Up @@ -136,7 +143,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#Lift the row limit for the astroquery Vizier class\n",
Expand All @@ -160,7 +169,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#Delete extra columns of information we don't need\n",
Expand All @@ -182,7 +193,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#Create SkyCoord objects of the coordinates\n",
Expand Down Expand Up @@ -215,25 +228,38 @@
"## Download and visualize the WHAM all-sky map\n",
"\n",
"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",
"\n"
"\n",
"For ease of use - this file is also available through this tutorial directly, so we can download the file from there.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#Download the wham integrate FITS image\n",
"'''\n",
"# Download the wham integrated FITS image from the UW-Madison host\n",
"\n",
"wham_image_file = download_file(\n",
" 'http://www.astro.wisc.edu/wham/ss/wham-ss-DR1-v161116-170912-int-grid.fits',\n",
" cache=True, show_progress = True)"
" cache=True, show_progress = True)\n",
"'''\n",
"\n",
"#Download the wham integrated FITS image\n",
"wham_image_file = download_file(tutorialpath + \n",
" 'wham-ss-DR1-v161116-170912-int-grid.fits',\n",
" cache=True, show_progress = True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Open the FITS file for reading\n",
Expand All @@ -253,7 +279,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Access and store the data and header\n",
Expand Down Expand Up @@ -284,7 +312,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Initiate a matplotlib figure object\n",
Expand Down Expand Up @@ -328,7 +358,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"'''\n",
Expand Down Expand Up @@ -374,6 +406,9 @@
"## Examine the WHAM Kinematic Data\n",
"\n",
"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",
"\n",
"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",
"\n",
"<a id='ex2'></a>\n",
"### Exercise 2: Download the survey file to cache open it to display some info\n",
"\n",
Expand All @@ -387,22 +422,19 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"'''\n",
"Temporarily have solution here for notebook testing\n",
"'''\n",
"\n",
"# Download the Kinematic Data Table\n",
"wham_data_file = download_file('http://www.astro.wisc.edu/wham/ss/wham-ss-DR1-v161116-170912.fits',\n",
" cache=True, show_progress = True)\n",
" \n",
"'''\n",
"Using a local file for now to make my life easy as I write this without an internet connection...\n",
"\n",
"wham_data_file = '/Volumes/DK_Storage/Data/wham/wham-ss-DR1-v161116-170912.fits'\n",
"'''\n",
"wham_data_file = download_file(tutorial_path + \n",
" 'wham-ss-DR1-v161116-170912.fits',\n",
" cache=True, show_progress = True)\n",
"\n",
"# Open the FITS file for reading\n",
"wham_data_hdu = fits.open(wham_data_file)"
Expand All @@ -411,7 +443,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Display some basic information on the FITS image file\n",
Expand All @@ -428,7 +462,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# View the Primary Header\n",
Expand All @@ -438,7 +474,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# View the Table Header\n",
Expand All @@ -455,7 +493,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"wham_data_hdu[1].columns"
Expand All @@ -471,7 +511,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#Read in data as a Table\n",
Expand Down Expand Up @@ -519,7 +561,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"wham_data"
Expand Down Expand Up @@ -555,7 +599,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Match our catalogs\n",
Expand All @@ -577,7 +623,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Create a sub Table of the WHAM matched data\n",
Expand All @@ -598,7 +646,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Construct a new Table from the two existing Tables\n",
Expand Down Expand Up @@ -653,7 +703,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Calculate H-Alpha rest wavelength\n",
Expand Down Expand Up @@ -710,7 +762,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Function to convert H-Alpha intensity to an Emission Measure\n",
Expand Down Expand Up @@ -765,7 +819,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Display our final Table\n",
Expand Down Expand Up @@ -793,7 +849,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Write data to file \n",
Expand Down Expand Up @@ -915,7 +973,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Initiate a matplotlib figure object\n",
Expand Down Expand Up @@ -960,8 +1020,9 @@
"outputs": [],
"source": [
"# Download the Kinematic Data Table\n",
"wham_data_file = download_file('http://www.astro.wisc.edu/wham/ss/wham-ss-DR1-v161116-170912.fits',\n",
" cache=True, show_progress = True)\n",
"wham_data_file = download_file(tutorial_path + \n",
" 'wham-ss-DR1-v161116-170912.fits',\n",
" cache=True, show_progress = True)\n",
"\n",
"# Open the FITS file for reading\n",
"wham_data_hdu = fits.open(wham_data_file)"
Expand Down

0 comments on commit 20dd162

Please sign in to comment.