File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 55
55
"cell_type" : " code" ,
56
56
"collapsed" : false ,
57
57
"input" : [
58
- " import urllib2, tarfile\n " ,
58
+ " import tarfile\n " ,
59
+ " from astropy.utils.data import download_file\n " ,
59
60
" url = 'http://python4astronomers.github.io/_downloads/astropy_UVES.tar.gz'\n " ,
60
- " tarfile.open(fileobj=urllib2.urlopen (url), mode='r|*').extractall( )\n " ,
61
- " cd UVES \n " ,
62
- " ls "
61
+ " f = tarfile.open(download_file (url, cache=True ), mode='r|*')\n " ,
62
+ " location_for_data_file = '.' # CHANGE TO WHEREVER YOU WANT THE DATA TO BE EXTRACTED \n " ,
63
+ " f.extractall(path=location_for_data_file) "
63
64
],
64
65
"language" : " python" ,
65
66
"metadata" : {},
148
149
" from astropy.io import fits\n " ,
149
150
" \n " ,
150
151
" # glob searches through directories similar to the Unix shell\n " ,
151
- " filelist = glob('*.fits')\n " ,
152
+ " filelist = glob('UVES/ *.fits')\n " ,
152
153
" # sort alphabetically - given the way the filenames are\n " ,
153
154
" # this also sorts in time\n " ,
154
155
" filelist.sort()\n " ,
1475
1476
"metadata" : {}
1476
1477
}
1477
1478
]
1478
- }
1479
+ }
You can’t perform that action at this time.
0 commit comments