CANDELS-like correlation function example

This is a short example that takes you from galaxy catalog file and FITS weight file to a correlation function. We'll use a single CANDELS tile as the mask (the tile weight file with the name "hlsp_candels_hst_wfc3_gs-tot-sect33_f160w_v1.0_wht.fits" can be found here. It is too large to be included in the github repository so it must be downloaded and placed in the examples folder). We'll read in a randomly generated catalog that has been saved and included.


In [3]:
import AngularCatalog_class as ac
import astropy.io.fits as fits
from astropy.io import ascii
from numpy import ma

In [4]:
#Read in the galaxy catalog
data = ascii.read('example_data.dat')

#Generate an AngularCatalog with the ImageMask from the appropriate weight file
weight_file = 'hlsp_candels_hst_wfc3_gs-tot-sect33_f160w_v1.0_wht.fits'
cat = ac.AngularCatalog(data['ra'], data['dec'], weight_file = weight_file)


weight file
Trying to make the image mask
make_mask_from_weights says: generating an image mask from a weight file
make_mask_from_weights says: switching FITS file endianness
make_mask_from_weights says: getting random subsample and calculating stats on random subsample
Calculating the footprint of the mask
return_completenesses says: I have 100000 points that are actually on the image
return_completenesses says: I have 100000 points that are actually on the image

In [7]:
#Generate the random sample
cat.generate_random_sample(number_to_make=1e4)

#Set the theta binning
cat.set_theta_bins(10, 350, 7)


return_completenesses says: I have 10000 points that are actually on the image
ImageMask.generate_random_sample says:  We made 8020 and we need 10000.
ImageMask.generate_random_sample says: I have made too few objects within the target area. Making more.
return_completenesses says: I have 1979 points that are actually on the image
ImageMask.generate_random_sample says:  We made 1603 and we need 1980.
ImageMask.generate_random_sample says: I have made too few objects within the target area. Making more.
return_completenesses says: I have 377 points that are actually on the image
ImageMask.generate_random_sample says:  We made 302 and we need 377.
ImageMask.generate_random_sample says: I have made too few objects within the target area. Making more.
return_completenesses says: I have 74 points that are actually on the image
ImageMask.generate_random_sample says:  We made 60 and we need 75.
ImageMask.generate_random_sample says: I have made too few objects within the target area. Making more.
return_completenesses says: I have 15 points that are actually on the image
ImageMask.generate_random_sample says:  We made 11 and we need 15.
ImageMask.generate_random_sample says: I have made too few objects within the target area. Making more.
return_completenesses says: I have 4 points that are actually on the image
ImageMask.generate_random_sample says:  We made 3 and we need 4.
ImageMask.generate_random_sample says: I have made too few objects within the target area. Making more.
return_completenesses says: I have 1 points that are actually on the image
ImageMask.generate_random_sample says:  We made 1 and we need 1.
make_randomtree says: Computing the BallTree for randoms.

In [9]:
#Do the correlation function
cat.cf_bootstrap(n_boots=20, clobber=True, name="single_gal_cf")


CorrelationFunction.__init__ says: you did not provide any info on Gp.  Leaving it for later
CorrelationFunction.__init__ says: you gave me a valid ThetaBin object.  Storing
AngularCatalog.cf_bootstrap says: doing a bootstrap CF calculation
calculating boot 0
calculating boot 1
calculating boot 2
calculating boot 3
calculating boot 4
calculating boot 5
calculating boot 6
calculating boot 7
calculating boot 8
calculating boot 9
calculating boot 10
calculating boot 11
calculating boot 12
calculating boot 13
calculating boot 14
calculating boot 15
calculating boot 16
calculating boot 17
calculating boot 18
calculating boot 19

In [ ]:
#Plot correlation function
cat.plot_cfs(which_cfs=['single_gal_cf'], labels=["Single gal bootstrap"], fmt='o-')

In [ ]: