1 """Make a catalog of fakes that are highly blended."""
8 from astropy.table
import Table, Column
12 """Disturb the coordinate a little bit."""
13 return (np.random.normal(mu, sigma, num) / 3600.0)
18 """Make a highly blended version of fake catalog."""
20 if not os.path.isfile(fakeCat):
21 raise Exception(
'# Can not find input fake catalog : %s' % fakeCat)
23 fakeTab = Table.read(fakeCat, format=
'fits')
25 print(
"# There are %d fake galaxies in the catalog" % nFake)
27 blendTab = fakeCat.replace(
'.fits',
'_highb.fits')
30 if not os.path.isfile(realCat):
31 raise Exception(
'# Can not find input real catalog : %s' % realCat)
33 realTab = Table.read(realCat, format=
'fits')
35 print(
"# There are %d real galaxies in the catalog" % nReal)
38 indices = random.sample(
list(range(nReal)), nFake)
41 fakeTab.add_column(Column(realTab[indices][raCol], name=
'RA_ori'))
42 fakeTab.add_column(Column(realTab[indices][decCol], name=
'Dec_ori'))
44 fakeTab[
'RA'] = (realTab[indices][raCol] +
disturbRaDec(nFake,
47 fakeTab[
'Dec'] = (realTab[indices][decCol] +
disturbRaDec(nFake,
52 fakeTab.write(blendTab, format=
'fits', overwrite=
True)
57 if __name__ ==
'__main__':
59 parser = argparse.ArgumentParser()
60 parser.add_argument(
"fakeCat", help=
"Input catalog of fake objects")
61 parser.add_argument(
"realCat", help=
"Catalog of real objects")
62 parser.add_argument(
'--ra',
'--raCol', dest=
'raCol',
63 help=
'Column for RA in realCat',
65 parser.add_argument(
'--dec',
'--decCol', dest=
'decCol',
66 help=
'Column for DEC in realCat',
68 parser.add_argument(
'--mu', dest=
'mu',
69 help=
'mu of a normal distribution',
70 default=0.6, type=float)
71 parser.add_argument(
'--sigma', dest=
'sigma',
72 help=
'sigma of a normal distribution',
73 default=0.6, type=float)
75 args = parser.parse_args()
78 raCol=args.raCol, decCol=args.decCol,
79 sigma=args.sigma, mu=args.mu)