def bg_only(): psf = PSF([1.0, 0.6], [1.0, 4.0]) sf = StarField(psf, 200, 200) sf.generate_bg_stars(100, p=0, f0=1) sf.save("bg.h5")
def gaussian_and_bg(): psf = PSF([1.0, 0.6], [1.0, 4.0]) sf = StarField(psf, 200, 200) sf.generate_bg_stars(100) sf.generate_gaussian_stars(50, 95, 83.5, [[8.**2, 0], [0, 8.**2]]) s = time.time() img = sf.image() print sf.lnlike(img) print "Generating an image w/ %d stars took: %.4f seconds"\ %(len(sf.catalog), time.time()-s) fig = pl.figure(figsize=(8,8)) ax = fig.add_subplot(111, aspect="equal") ax.pcolor(-img, cmap="gray") pl.savefig("cluster.png") sf.save("cluster.h5") sf.save("cluster.fits")