In [66]:
import numpy as np
# Set up matplotlib and use a nicer set of plot parameters
%config InlineBackend.rc = {}
import matplotlib
matplotlib.rc_file("../templates/matplotlibrc")
import matplotlib.pyplot as plt
%matplotlib inline
In [67]:
from astropy.utils.data import download_file
In [68]:
from astropy.io import fits
In [69]:
image_file = '../datasets/sm/example.fits'
In [70]:
hdu_list = fits.open(image_file)
hdu_list.info()
# Gaia SM images are binned by 2 in AC direction( hence AC dim = 990 )
# Gaia SM images are binned by 2 in AL direction( hence AL dim = 2543 )
In [71]:
image_data = hdu_list[0].data
In [72]:
print(type(image_data))
print(image_data.shape)
In [73]:
hdu_list.close()
In [74]:
from matplotlib.colors import LogNorm
plt.imshow(image_data, cmap='gray', norm=LogNorm())
plt.colorbar()
# To see more color maps
# http://wiki.scipy.org/Cookbook/Matplotlib/Show_colormaps
Out[74]:
In [64]:
print('Min:', np.min(image_data))
print('Max:', np.max(image_data))
print('Mean:', np.mean(image_data))
print('Stdev:', np.std(image_data))
In [92]:
# Rotate and Strech color
import scipy
from scipy import ndimage
rotated_img = scipy.ndimage.rotate(image_data, 90)
plt.xlabel('Time [TDI units]')
plt.ylabel('AC')
plt.imshow(rotated_img, cmap='gray', vmin=512, vmax=3000)
Out[92]:
In [93]:
# Interactive Plot
plt.ion()
ax=plt.gca()
ax.imshow(rotated_img, cmap='gray', vmin=512, vmax=3000)
plt.xlabel('Time [TDI units]')
plt.ylabel('AC')
plt.draw()
In [ ]: