def example(): """ This is just an example. Cut and paste that on the python prompt. It can also be run as specplot.example(). """ import numpy as np import matplotlib.pyplot as plt from astropy import wcs from astrodata import AstroData ad = AstroData('JHK.fits') x_values = np.arange(ad.get_key_value('NAXIS1')) wcs_ad = wcs.WCS(ad.header.tostring()) wlen = wcs_ad.wcs_pix2world(zip(x_values), 0) plt.plot(wlen, ad.data) plt.xlabel('Wavelength [Angstrom]') plt.ylabel('Counts') plt.axis('tight') plt.ylim(-100, 800) plt.show() ad.close() #plt.axis[[-100,1000,ymin,ymax]]
def test_method_get_key_val_8(): ad = AstroData(TESTFILE) with pytest.raises(AstroDataError): assert ad.get_key_value('BITPIX')
def test_method_get_key_val_7(): ad = AstroData(TESTFILE2) with pytest.raises(TypeError): assert ad.get_key_value()
def test_method_get_key_val_6(): ad = AstroData(TESTFILE2) assert ad.get_key_value('FOO') is None
def test_method_get_key_val_4(): ad = AstroData(TESTFILE2) assert ad.get_key_value('DATATYP') is None
def test_method_get_key_val_3(): ad = AstroData(TESTFILE2) assert isinstance(ad.get_key_value('CRVAL1'), float)
def test_method_get_key_val_2(): ad = AstroData(TESTFILE2) assert isinstance(ad.get_key_value('BITPIX'), int)
def test_method_get_key_val_1(): ad = AstroData(TESTFILE2) assert isinstance(ad.get_key_value('EXTNAME'), str)