import astropy import numpy as np import matplotlib.pyplot as plt from astropy.visualization import astropy_mpl_style plt.style.use(astropy_mpl_style) from astropy.io import fits bdfile='http://www.astro.umd.edu/~jph/Python.d/BD30_STIS.d/sx2.d/o5ep03010_sx2.fits' im = fits.getdata(bdfile, ext=1) print(im.shape) plt.figure() plt.imshow(im, cmap='rainbow') z=np.log(im) plt.imshow(z, cmap='rainbow') run h_strip # the two density-dependant [O II] lines sp=h_strip(im,550,600) plt.figure() plt.plot(sp,'b') # the corresponding sp1 file file1='http://www.astro.umd.edu/~jph/Python.d/BD30_STIS.d/sx1.d/o5ep03010_sx1.fits' im1 = fits.getdata(file1,ext=1) fits.info(file1) plt.figure() wav1=(np.array(im1.WAVELENGTH))[0,:] flx1=(np.array(im1.FLUX))[0,:] plt.plot(wav1,flx1,'b') sp1=hstrip(im1,575,625) plt.figure() plt.plot(sp1,'b') np.sum(sp[764:774]) np.sum(sp[774:784]) sp2=h_strip(im,520,540) np.sum(sp2[764:774]) np.sum(sp2[774:784]) sp3=h_strip(im,630,650) np.sum(sp3[764:774]) np.sum(sp3[774:784])