def main(N=20, serial=False, use_dask=False, nworkers=os.cpu_count()): hdu = datasets.load_star_image() dataset = [hdu.data] * N obj = Parallelize(dataset) if not serial: obj.run_parallel(use_dask=use_dask, nworkers=nworkers) else: obj.run_serial() return obj
def generate_dataset(N): """ Use the photutils.dataset module to load in some example data. Parameters ---------- N : Number of images to generate for this dataset Returns ------- A list of FITS images """ hdu = datasets.load_star_image() dataset = [hdu.data] * N return dataset
#!/usr/bin/env python import sys try: sys.path.remove('/home/astro/phsgan/Python64/lib/python/site-packages/astropy-0.3.2-py2.6-linux-x86_64.egg') except (ValueError): print "No need to fix sys.path" import astropy import photutils import matplotlib.pyplot import numpy as np from photutils import datasets print "Python version:", sys.version print "Astropy version:", astropy.__version__ hdu = datasets.load_star_image() image = hdu.data[500:700, 500:700] image = hdu.data print np.median(image) image -= np.median(image) from photutils import daofind from astropy.stats import median_absolute_deviation as mad bkg_sigma = 1.48 * mad(image) sources = daofind(image, fwhm=4.0, threshold=3*bkg_sigma) print sources for s in sources: print s
import photutils import numpy as np from photutils import datasets import matplotlib.pyplot as plt import cv2 import pandas as pd from photutils import aperture_photometry, CircularAperture %matplotlib inline hdu = datasets.load_star_image() image = hdu.data[500:700, 500:700].astype(float) image -= np.median(image) from photutils import DAOStarFinder from astropy.stats import mad_std bkg_sigma = mad_std(image) daofind = DAOStarFinder(fwhm=.4, threshold = 3.*bkg_sigma) sources = daofind(image) positions = np.transpose((sources['xcentroid'], sources['ycentroid'])) apertures = CircularAperture(positions, r=4.) phot_table = aperture_photometry(image, apertures) plt.figure(figsize=(40,40)) plt.imshow(img, cmap='gray_r') apertures.plot(color='b', lw=1.5, alpha=0.5) img = cv2.imread('./data/pixel-4-astrophotography-2.jpg')