CoCalc Public Filesastroalign-124 / sep.ipynbOpen in CoCalc with one click!
Author: Harald Schilly

Python 3 SEP

In [1]:
import numpy as np import matplotlib.pyplot as plt from astropy.io import fits fits_image_filename = fits.util.get_testdata_filepath('test0.fits')
In [2]:
fits_image_filename
'/usr/local/lib/python3.5/dist-packages/astropy/io/fits/tests/data/test0.fits'
In [3]:
data2 = fits.open(fits_image_filename)
In [4]:
data =data2[-3].data
In [5]:
m, s = np.mean(data), np.std(data) plt.imshow(data, interpolation='nearest', cmap='gray', vmin=m-s, vmax=m+s, origin='lower') plt.colorbar();
In [6]:
import sep
In [7]:
data_sep = data.byteswap().newbyteorder().astype('float') bkg = sep.Background(data_sep)
In [8]:
m, s = np.mean(bkg), np.std(bkg) plt.imshow(bkg, interpolation='nearest', cmap='gray', vmin=m-s, vmax=m+s, origin='lower') plt.colorbar();
In [ ]:
In [ ]:
In [ ]: