In [1]:
import heroespy.util.meta as meta
from astropy.units import Unit as u
from astropy.units import Quantity
In [9]:
import pandas
import numpy
In [1]:
from heroespy.payload import payload
heroes = payload()
In [5]:
heroes.telescope[0].detector.plate_scale
Out[5]:
In [7]:
for telescope in heroes.telescope:
events = telescope.detector.get_events
In [15]:
df = pandas.DataFrame(numpy.arange(1,6), index=pandas.date_range('1/1/2011', periods=5, freq='H'))
In [30]:
n = df.reindex(pandas.date_range('1/1/2011', periods=10, freq='30T')).interpolate()
In [31]:
n[pandas.date_range('1/1/2011', periods=10, freq='30T')]
In [16]:
x, y = g(d['rawx'], d['rawy'])
In [1]:
import heroespy.aspect
pyas_aspect = heroespy.aspect.get_pyas_aspect()
In [2]:
from astropy.time import Time
Time("2013-09-21T11:58:00.0", format='isot', scale='utc')
Out[2]:
In [3]:
pyas_aspect
Out[3]:
In [6]:
In [2]:
path = '/Applications/exelis/idl83/help/online_help/IDL/Content/Resources/Images/ColorTableWaves.bmp'
In [3]:
In [65]:
import numpy as np
from datetime import datetime, timedelta
from scipy import misc
from astropy.io import fits
image = misc.imread(path, flatten=0)
utcoffset = 6
exp = 0.01
preamp_gain = 3
analog_gain = 2
exposure_usec = 1000
target = 'Laser'
lat = 38.995317
lon = -76.856603
location = 'Greenbelt, MD'
def get_utc_now():
return datetime.now() + timedelta(hours=utcoffset)
def datetime_to_str(d):
return d.strftime("%Y%m%d_%H%M%S")
def create_filename():
return 'FOXSI_SAAS_' + datetime_to_str(get_utc_now()) + '.fits'
prihdu = fits.PrimaryHDU()
image_hdr = fits.Header()
header_dict = {'TELESCOP': ('FOXSI', 'Name of source telescope package'),
'ORIGIN': ('Macbook Pro Laptop', 'Location where file was made'),
'WAVELNTH': (6300, 'Wavelength of the observation (ang)'),
'WAVE_STR': ('630 Nm', 'Wavelength of observation string'),
'INSTRUME': ('SAAS', 'Name of the instrument'),
'OBSERVER': ('Steven D. Christe', 'Name of the observer'),
'WAVEUNIT': ('angstrom', 'Units of WAVELNTH'),
'PIXLUNIT': ('DN', 'Pixel units'),
'IMG_TYPE': ('LIGHT', 'Image type'),
'RSUN_REF': (6.96e8, ''),
'LVL_NUM': (0, 'Level of data'),
'EXPTIME': (exp/1e6, "Exposure time in seconds"),
'DATE_OBS': (get_utc_now().isoformat(), "Date and time when observation of this image started (UTC)"),
'GAIN_PRE': (preamp_gain, 'Preamp gain of CCD'),
'GAIN_ANA': (analog_gain, 'Analog gain of CCD'),
'DATAMIN': (np.min(image), 'Minimum value of data'),
'DATAMAX': (np.max(image), 'Maxmimum value of data'),
'EXPOSURE': (exposure_usec, "Exposure time in usec"),
'FILENAME': (create_filename(), 'Name of the data file'),
'TARGNAME': (target, 'Name of the target'),
'GPS_LAT': (lat, 'GPS latitude (degrees)'),
'GPS_LON': (lon, 'GPS longitude (degrees)'),
'LOCATION': (location, 'Location string'),
'CONTENT': ('CCD Image', 'Description of data'),
'CUNIT1': ('arcsec', ''),
'CUNIT2': ('arcsec', ''),
'WCSNAME': ('Helioprojective-cartesian', 'WCS Coordinate system'),
'CTYPE1': ('HPLN-TAN', ''),
'CTYPE2': ('HPLT-TAN', ''),
'CRPIX1': (2044.574341, ''),
'CRPIX2': (2043.035889, ''),
'CRVAL1': (0, ''),
'CRVAL2': (0, ''),
'CDELT1': (0, ''),
'CDELT2': (0, '')
}
for key in header_dict:
image_hdr[key] = header_dict[key]
imghdu = fits.ImageHDU(data=image, header=image_hdr)
hdulist = fits.HDUList([prihdu, imghdu])
hdulist.writeto(create_filename(), clobber=True, checksum=True)
In [66]:
f = fits.open('new.fits')
f[0].header
Out[66]:
In [67]:
f[0].data
In [68]:
f[1].header
Out[68]:
In [69]:
file = ' /Users/schriste/FOXSI_SAAS_20141015_173630.fits'
f = fits.open(file)
f[0].header
Out[69]:
In [70]:
f[1].header
Out[70]:
In [72]:
f[1].data.shape
Out[72]:
In [73]:
f = '/Users/schriste/FOXSI_SAAS_20141016_051040.fits'
In [74]:
f = fits.open(f)
In [80]:
f[1].data[2].max()
Out[80]:
In [ ]: