%matplotlib inline import numpy as np from fitsio import read import sep from matplotlib import pyplot as plt data = read("/home/kyle/code/sep/data/image.fits") fig = plt.figure(figsize=(10., 10.)) plt.imshow(data, cmap='gray', vmin=6500., vmax=7000., interpolation='nearest') bkg = sep.Background(data) # measure background bkg.globalback, bkg.globalrms # global statistics bkgim = bkg.back() # evaluate background # plot background fig = plt.figure(figsize=(10., 10.)) plt.imshow(bkgim, cmap='gray') bkg.subfrom(data) # subtract background directly from data; no intermediate array # detect objects objects = sep.extract(data, 1.5 * bkg.globalrms) # objects is a numpy structured array len(objects) # position of 31st object objects[30]['x'], objects[30]['y'] # fields available objects.dtype.names # circular aperture photometry: radius=3 pixels, background annulus between 5 pixels and 8 pixels flux, fluxerr, flags = sep.sum_circle(data, objects['x'], objects['y'], 3.0, bkgann=(5., 8.)) flux !cd /home/kyle/code/sep/ && bench.py