LSSTApplications  20.0.0
LSSTDataManagementBasePackage
Functions | Variables
lsst.synpipe.makeBlendedCat Namespace Reference

Functions

def disturbRaDec (num, mu=0.6, sigma=0.6)
 
def makeBlendedCat (fakeCat, realCat, raCol='ra', decCol='dec', sigma=0.6, mu=0.6)
 

Variables

 parser
 
 args
 

Detailed Description

Make a catalog of fakes that are highly blended.

Function Documentation

◆ disturbRaDec()

def lsst.synpipe.makeBlendedCat.disturbRaDec (   num,
  mu = 0.6,
  sigma = 0.6 
)
Disturb the coordinate a little bit.

Definition at line 11 of file makeBlendedCat.py.

11 def disturbRaDec(num, mu=0.6, sigma=0.6):
12  """Disturb the coordinate a little bit."""
13  return (np.random.normal(mu, sigma, num) / 3600.0)
14 
15 

◆ makeBlendedCat()

def lsst.synpipe.makeBlendedCat.makeBlendedCat (   fakeCat,
  realCat,
  raCol = 'ra',
  decCol = 'dec',
  sigma = 0.6,
  mu = 0.6 
)
Make a highly blended version of fake catalog.

Definition at line 16 of file makeBlendedCat.py.

16 def makeBlendedCat(fakeCat, realCat, raCol='ra', decCol='dec',
17  sigma=0.6, mu=0.6):
18  """Make a highly blended version of fake catalog."""
19  # Fake catalog
20  if not os.path.isfile(fakeCat):
21  raise Exception('# Can not find input fake catalog : %s' % fakeCat)
22  else:
23  fakeTab = Table.read(fakeCat, format='fits')
24  nFake = len(fakeTab)
25  print("# There are %d fake galaxies in the catalog" % nFake)
26  # Name of the output catalog
27  blendTab = fakeCat.replace('.fits', '_highb.fits')
28 
29  # Real catalog
30  if not os.path.isfile(realCat):
31  raise Exception('# Can not find input real catalog : %s' % realCat)
32  else:
33  realTab = Table.read(realCat, format='fits')
34  nReal = len(realTab)
35  print("# There are %d real galaxies in the catalog" % nReal)
36 
37  # Randomly select nFake galaxies from the realCat
38  indices = random.sample(list(range(nReal)), nFake)
39 
40  # Replace the RA, DEC with a small shift
41  fakeTab.add_column(Column(realTab[indices][raCol], name='RA_ori'))
42  fakeTab.add_column(Column(realTab[indices][decCol], name='Dec_ori'))
43 
44  fakeTab['RA'] = (realTab[indices][raCol] + disturbRaDec(nFake,
45  mu=mu,
46  sigma=sigma))
47  fakeTab['Dec'] = (realTab[indices][decCol] + disturbRaDec(nFake,
48  mu=mu,
49  sigma=sigma))
50 
51  # Save the new catalog
52  fakeTab.write(blendTab, format='fits', overwrite=True)
53 
54  return fakeTab
55 
56 

Variable Documentation

◆ args

lsst.synpipe.makeBlendedCat.args

Definition at line 75 of file makeBlendedCat.py.

◆ parser

lsst.synpipe.makeBlendedCat.parser

Definition at line 59 of file makeBlendedCat.py.

lsst.synpipe.makeBlendedCat.disturbRaDec
def disturbRaDec(num, mu=0.6, sigma=0.6)
Definition: makeBlendedCat.py:11
list
daf::base::PropertyList * list
Definition: fits.cc:913
lsst.synpipe.makeBlendedCat.makeBlendedCat
def makeBlendedCat(fakeCat, realCat, raCol='ra', decCol='dec', sigma=0.6, mu=0.6)
Definition: makeBlendedCat.py:16