In [1]:
from sunpy.map import MapCubed
from sunpy.map import Map
import glob
import astropy.units as u
from sunpy.time import parse_time
import numpy as np


/Users/schriste/anaconda/lib/python2.7/site-packages/Glymur-0.8.0-py2.7.egg/glymur/lib/config.py:151: UserWarning: Neither the openjp2 nor the openjpeg library could be loaded.  
  warnings.warn(msg)

In [2]:
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.rc('image', interpolation='nearest')
%matplotlib inline
%config InlineBackend.figure_format = 'svg'

In [3]:
data_dir = '/Users/schriste/Data/FOXSI-2-flight/aia/'
str_indices = {'94':'0094', '335':'0335', '193':'0193', '171':'0171', '131':'0131'}
file_list = {}
maps = {}

for key in str_indices:
    file_list.update({key: glob.glob(data_dir + '*' + str_indices[key] + '.fits')})

these_files = file_list['94'][0:10]
print(these_files)

maps = []

for f in these_files:
    maps.append(Map(f))

cubed = MapCubed(maps)


['/Users/schriste/Data/FOXSI-2-flight/aia/AIA20141211_191101_0094.fits', '/Users/schriste/Data/FOXSI-2-flight/aia/AIA20141211_191113_0094.fits', '/Users/schriste/Data/FOXSI-2-flight/aia/AIA20141211_191125_0094.fits', '/Users/schriste/Data/FOXSI-2-flight/aia/AIA20141211_191137_0094.fits', '/Users/schriste/Data/FOXSI-2-flight/aia/AIA20141211_191149_0094.fits', '/Users/schriste/Data/FOXSI-2-flight/aia/AIA20141211_191201_0094.fits', '/Users/schriste/Data/FOXSI-2-flight/aia/AIA20141211_191213_0094.fits', '/Users/schriste/Data/FOXSI-2-flight/aia/AIA20141211_191225_0094.fits', '/Users/schriste/Data/FOXSI-2-flight/aia/AIA20141211_191237_0094.fits', '/Users/schriste/Data/FOXSI-2-flight/aia/AIA20141211_191249_0094.fits']

In [4]:
cubed.data.shape


Out[4]:
(4096, 4096, 10)

In [5]:
cubed.dtype


Out[5]:
dtype('float32')

In [6]:
cubed[0]


Out[6]:
SunPy AIAMap
---------
Observatory:	 SDO
Instrument:	 AIA 4
Detector:	 AIA
Measurement:	 94.0 Angstrom
Wavelength:	 94.0 Angstrom
Obs Date:	 2014-12-11 19:11:01
dt:		 2.902037 s
Dimension:	 [ 4096.  4096.] pix
scale:		 [ 0.60000002  0.60000002] arcsec / pix

array([[-7., -7., -7., ..., -7., -7., -7.],
       [-7., -7., -7., ..., -7., -7., -7.],
       [-7., -7., -7., ..., -7., -7., -7.],
       ..., 
       [ 0.,  1.,  0., ..., -7., -7., -7.],
       [ 0.,  1.,  1., ..., -7., -7., -7.],
       [ 0.,  0.,  0., ..., -7., -7., -7.]], dtype=float32)

In [7]:
cubed


Out[7]:
SunPy MapCubed
---------
Observatory:	 SDO
Instrument:	 AIA 4
Detector:	 AIA
Measurement:	 94.0 Angstrom
Wavelength:	 94.0 Angstrom
Obs. Start:	 2014-12-11 19:11:01
Obs. End:	 2014-12-11 19:12:49
Num. of Frames:	 10
Dimensions:	 [ 4096.  4096.]
Scale:		 [ 0.60000002  0.60000002] arcsec / pix
array([[[ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        ..., 
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.]],

       [[ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        ..., 
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.]],

       [[ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        ..., 
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.]],

       ..., 
       [[  0.,  -1.,   0., ...,   0.,   0.,  -2.],
        [  1.,   0.,   1., ...,   0.,   0.,   0.],
        [  0.,   1.,   1., ...,   1.,   1.,   0.],
        ..., 
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.]],

       [[  0.,   0.,   0., ...,   0.,   0.,   0.],
        [  1.,   0.,   1., ...,  -1.,  -1.,   0.],
        [  1.,   1.,   0., ...,  -1.,   0.,   0.],
        ..., 
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.]],

       [[  0.,   0.,   0., ...,   0.,   0.,  -1.],
        [  0.,   0.,   0., ...,  -1.,  -1.,   0.],
        [  0.,   0.,   0., ...,  -1.,   0.,   0.],
        ..., 
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.],
        [ -7.,  -9.,  -9., ...,  -9., -10.,  -7.]]], dtype=float32)

In [8]:
cubed._get_map(0)


Out[8]:
SunPy AIAMap
---------
Observatory:	 SDO
Instrument:	 AIA 4
Detector:	 AIA
Measurement:	 94.0 Angstrom
Wavelength:	 94.0 Angstrom
Obs Date:	 2014-12-11 19:11:01
dt:		 2.902037 s
Dimension:	 [ 4096.  4096.] pix
scale:		 [ 0.60000002  0.60000002] arcsec / pix

array([[-7., -7., -7., ..., -7., -7., -7.],
       [-7., -7., -7., ..., -7., -7., -7.],
       [-7., -7., -7., ..., -7., -7., -7.],
       ..., 
       [ 0.,  1.,  0., ..., -7., -7., -7.],
       [ 0.,  1.,  1., ..., -7., -7., -7.],
       [ 0.,  0.,  0., ..., -7., -7., -7.]], dtype=float32)

In [9]:
cubed.date


Out[9]:
[datetime.datetime(2014, 12, 11, 19, 11, 1, 120000),
 datetime.datetime(2014, 12, 11, 19, 11, 13, 120000),
 datetime.datetime(2014, 12, 11, 19, 11, 25, 120000),
 datetime.datetime(2014, 12, 11, 19, 11, 37, 120000),
 datetime.datetime(2014, 12, 11, 19, 11, 49, 120000),
 datetime.datetime(2014, 12, 11, 19, 12, 1, 140000),
 datetime.datetime(2014, 12, 11, 19, 12, 13, 120000),
 datetime.datetime(2014, 12, 11, 19, 12, 25, 120000),
 datetime.datetime(2014, 12, 11, 19, 12, 37, 120000),
 datetime.datetime(2014, 12, 11, 19, 12, 49, 120000)]

In [10]:
for d in cubed.date:
    print(d)


2014-12-11 19:11:01.120000
2014-12-11 19:11:13.120000
2014-12-11 19:11:25.120000
2014-12-11 19:11:37.120000
2014-12-11 19:11:49.120000
2014-12-11 19:12:01.140000
2014-12-11 19:12:13.120000
2014-12-11 19:12:25.120000
2014-12-11 19:12:37.120000
2014-12-11 19:12:49.120000

In [11]:
cubed.scale


Out[11]:
Pair(x=<Quantity 0.600000023842 arcsec / pix>, y=<Quantity 0.600000023842 arcsec / pix>)

In [12]:
x_range = u.Quantity([-900, 0], 'arcsec')
y_range = u.Quantity([-700, 200], 'arcsec')

In [13]:
scubed = cubed.submap(x_range, y_range)

In [14]:
scubed.data.shape


Out[14]:
(1500, 1500, 10)

In [15]:
cubed.meta('exptime')


Out[15]:
[2.902037,
 2.90204,
 2.90204,
 2.90204,
 2.902038,
 2.90204,
 2.90204,
 2.902038,
 2.902037,
 2.902039]

In [ ]:


In [16]:
scubed.mean().plot()
plt.colorbar()


Out[16]:
<matplotlib.colorbar.Colorbar at 0x109385090>

In [17]:
scubed.std().plot()
plt.colorbar()


Out[17]:
<matplotlib.colorbar.Colorbar at 0x171869690>

In [18]:
scubed.min().plot()
plt.colorbar()


Out[18]:
<matplotlib.colorbar.Colorbar at 0x123a64b90>

In [19]:
scubed.max().plot()
plt.colorbar()


Out[19]:
<matplotlib.colorbar.Colorbar at 0x123e71d10>

In [20]:
scubed.scale


Out[20]:
Pair(x=<Quantity 0.600000023842 arcsec / pix>, y=<Quantity 0.600000023842 arcsec / pix>)

In [21]:
scubed.dimensions


Out[21]:
(1500, 1500)

In [22]:
sscubed = scubed.superpixel(u.Quantity([15 * u.pixel, 15 * u.pixel]))


[ 0.  0.] pix

In [23]:
sscubed.scale


Out[23]:
Pair(x=<Quantity 9.00000035763 arcsec / pix>, y=<Quantity 9.00000035763 arcsec / pix>)

In [24]:
sscubed[0].plot()
plt.colorbar()


Out[24]:
<matplotlib.colorbar.Colorbar at 0x124272e90>

In [25]:
sscubed.std().plot()
plt.colorbar()


Out[25]:
<matplotlib.colorbar.Colorbar at 0x1243aa1d0>

In [26]:
sscubed.lightcurve(2,0).plot()
sscubed.lightcurve(10,0).plot()
sscubed.lightcurve(20,0).plot()


Out[26]:
<matplotlib.axes._subplots.AxesSubplot at 0x124006a90>

In [ ]: