In [1]:
file = '/Users/schriste/Downloads/go06940108.fits'
In [ ]:
from matplotlib import pyplot as plt
In [ ]:
%pylab inline
In [ ]:
import pandas as pd
In [2]:
from astropy.io import fits as pyfits
In [ ]:
from sunpy.time import parse_time
In [ ]:
from datetime import timedelta
In [3]:
fits = pyfits.open(file)
In [4]:
fits[0].header
Out[4]:
In [5]:
fits[0].data
Out[5]:
In [8]:
seconds = fits[0].data[0]
In [13]:
parse_time(fits[0].header['TIMEZERO'])
Out[13]:
In [14]:
start_time = parse_time(fits[0].header['TIMEZERO'])
In [23]:
(seconds[0] - np.floor(seconds[0])) * 1e6
Out[23]:
In [43]:
times = [start_time + timedelta(seconds = int(np.floor(s)), microseconds = int((s - np.floor(s))*1e6)) for s in seconds]
In [92]:
times[-1]
Out[92]:
In [72]:
xrsa = fits[0].data[1]
In [73]:
xrsb = fits[0].data[2]
In [85]:
xrsb[xrsb == -99999] = np.nan
In [86]:
xrsa[xrsa == -99999] = np.nan
In [87]:
newxrsa = xrsa.byteswap().newbyteorder()
newxrsb = xrsb.byteswap().newbyteorder()
In [88]:
d = {'xrsa': newxrsa, 'xrsb': newxrsb}
In [89]:
goes = pd.DataFrame(d, index=times)
In [90]:
plt.figure()
Out[90]:
In [91]:
goes.plot()
Out[91]:
In [ ]: