3 """Make a catalog of fakes that are highly blended.""" 5 from builtins
import range
6 from __future__
import (division, print_function)
13 from astropy.table
import Table, Column
17 """Disturb the coordinate a little bit.""" 18 return (np.random.normal(mu, sigma, num) / 3600.0)
23 """Make a highly blended version of fake catalog.""" 25 if not os.path.isfile(fakeCat):
26 raise Exception(
'# Can not find input fake catalog : %s' % fakeCat)
28 fakeTab = Table.read(fakeCat, format=
'fits')
30 print(
"# There are %d fake galaxies in the catalog" % nFake)
32 blendTab = fakeCat.replace(
'.fits',
'_highb.fits')
35 if not os.path.isfile(realCat):
36 raise Exception(
'# Can not find input real catalog : %s' % realCat)
38 realTab = Table.read(realCat, format=
'fits')
40 print(
"# There are %d real galaxies in the catalog" % nReal)
43 indices = random.sample(list(range(nReal)), nFake)
46 fakeTab.add_column(Column(realTab[indices][raCol], name=
'RA_ori'))
47 fakeTab.add_column(Column(realTab[indices][decCol], name=
'Dec_ori'))
49 fakeTab[
'RA'] = (realTab[indices][raCol] +
disturbRaDec(nFake,
52 fakeTab[
'Dec'] = (realTab[indices][decCol] +
disturbRaDec(nFake,
57 fakeTab.write(blendTab, format=
'fits', overwrite=
True)
62 if __name__ ==
'__main__':
64 parser = argparse.ArgumentParser()
65 parser.add_argument(
"fakeCat", help=
"Input catalog of fake objects")
66 parser.add_argument(
"realCat", help=
"Catalog of real objects")
67 parser.add_argument(
'--ra',
'--raCol', dest=
'raCol',
68 help=
'Column for RA in realCat',
70 parser.add_argument(
'--dec',
'--decCol', dest=
'decCol',
71 help=
'Column for DEC in realCat',
73 parser.add_argument(
'--mu', dest=
'mu',
74 help=
'mu of a normal distribution',
75 default=0.6, type=float)
76 parser.add_argument(
'--sigma', dest=
'sigma',
77 help=
'sigma of a normal distribution',
78 default=0.6, type=float)
80 args = parser.parse_args()
83 raCol=args.raCol, decCol=args.decCol,
84 sigma=args.sigma, mu=args.mu)
def makeBlendedCat(fakeCat, realCat, raCol='ra', decCol='dec', sigma=0.6, mu=0.6)
def disturbRaDec(num, mu=0.6, sigma=0.6)