-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsoho_eit_304.py
41 lines (34 loc) · 1.04 KB
/
soho_eit_304.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
import numpy as np
from scipy import ndimage
from matplotlib import pyplot as pl
from astropy.io import fits
# files found using VSO
url = 'https://sohodata.nascom.nasa.gov//archive/soho/private/data/processed/eit/lz/2016/11/efz20161101.131938'
datafile = 'data/soho_eit_304.fits'
try:
data = fits.open(datafile)[0].data
except IOError:
try:
from urllib2 import urlopen
except ImportError:
from urllib.request import urlopen
response = urlopen(url)
with open(datafile, 'wb') as f:
f.write(response.read())
response.close()
data = fits.open(datafile)[0].data
# tips for stripping everything but image:
# https://stackoverflow.com/a/9295367/1299112
data = data[2:-2, 2:-2]
size = (6.0, 6.0)
dpi = len(data)/size[0]
fig = pl.figure()
fig.set_size_inches(size)
ax = pl.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
pl.imshow(np.log10(data), vmin=2.917, vmax=3.0, cmap='hot')
pl.savefig('soho_eit_304.png', dpi=dpi)
pl.savefig('soho_eit_304.jpg', dpi=dpi)
pl.show()