LSSTApplications  16.0-10-g9d3e444,16.0-11-g09ed895+3,16.0-11-g12e47bd+4,16.0-11-g9bb73b2+10,16.0-12-g5c924a4+10,16.0-15-g7af1f30,16.0-15-gdd5ca33+2,16.0-16-gf0259e2+1,16.0-17-g31abd91+11,16.0-17-g5cf0468+3,16.0-18-g51a54b3+3,16.0-18-ga4d4bcb+5,16.0-18-gcf94535+2,16.0-19-g9d290d5+2,16.0-2-g0febb12+22,16.0-2-g9d5294e+73,16.0-2-ga8830df+7,16.0-21-g3d035912+2,16.0-26-g8e79609,16.0-28-gfc9ea6c+9,16.0-29-ge8801f9+4,16.0-3-ge00e371+38,16.0-4-g18f3627+17,16.0-4-g5f3a788+21,16.0-4-ga3eb747+11,16.0-4-gabf74b7+33,16.0-4-gb13d127+7,16.0-5-g27fb78a+11,16.0-5-g6a53317+38,16.0-5-gb3f8a4b+91,16.0-51-gbbe9c988+3,16.0-6-g9321be7+5,16.0-6-gcbc7b31+47,16.0-6-gf49912c+33,16.0-7-gd2eeba5+56,16.0-75-gbf7a9a820,16.0-8-g21fd5fe+34,16.0-8-g3a9f023+24,16.0-9-gf3bc169+2,16.0-9-gf5c1f43+12,master-gd73dc1d098+5,w.2019.02
LSSTDataManagementBasePackage
Functions | Variables
lsst.synpipe.compareModel Namespace Reference

Functions

def getParams (record, galType='sersic')
 
def getMag (record, fluxType='cmodel')
 
def writeNumpyTable (fakeTable)
 
def main (root, visit, ccds, galType='sersic', output='outputs/')
 

Variables

 parser = argparse.ArgumentParser()
 
 help
 
 type
 
 int
 
 nargs
 
 str
 
 dest
 
 choices
 
 args = parser.parse_args()
 
 ccd
 
 galType
 
 output
 

Detailed Description

Compare the input fake galaxy model to the output one

Function Documentation

◆ getMag()

def lsst.synpipe.compareModel.getMag (   record,
  fluxType = 'cmodel' 
)
return the magnitude and error

Definition at line 33 of file compareModel.py.

33 def getMag(record, fluxType='cmodel'):
34  """
35  return the magnitude and error
36  """
37  flux, fluxerr = record.get(fluxType), record.get(fluxType+'.err')
38  mag, magerr = -2.5 * np.log10(flux), 2.5/np.log(10.0)*fluxerr/flux
39  mag += record.get('zeropoint')
40  return mag, magerr
41 
42 
def getMag(record, fluxType='cmodel')
Definition: compareModel.py:33

◆ getParams()

def lsst.synpipe.compareModel.getParams (   record,
  galType = 'sersic' 
)
return the semi-major axis, axis ratio and position angle (in degrees)

Definition at line 17 of file compareModel.py.

17 def getParams(record, galType='sersic'):
18  """
19  return the semi-major axis, axis ratio and position angle (in degrees)
20  """
21  fluxType = {'dev': 'cmodel.dev',
22  'exp': 'cmodel.exp',
23  'sersic': 'cmodel',
24  'cmodel': 'cmodel'}[galType]
25 
26  e = lsst.afw.geom.ellipses.Axes(record.get(fluxType + '.ellipse'))
27  q = (e.getB() / e.getA())
28  reff = e.getA()
29  pa = (e.getTheta() * 180.0 / np.pi)
30  return reff, q, pa
31 
32 
def getParams(record, galType='sersic')
Definition: compareModel.py:17
An ellipse core for the semimajor/semiminor axis and position angle parametrization (a...
Definition: Axes.h:47

◆ main()

def lsst.synpipe.compareModel.main (   root,
  visit,
  ccds,
  galType = 'sersic',
  output = 'outputs/' 
)
main function for controlling fake source comparison
Examples:
forEachPixel.cc, image1.cc, image2.cc, imageStatistics.cc, maskedImage1.cc, maskedImage2.cc, and splineInterpolate.cc.

Definition at line 83 of file compareModel.py.

83 def main(root, visit, ccds, galType='sersic', output='outputs/'):
84  """
85  main function for controlling fake source comparison
86  """
87  butler = dafPersist.Butler(root)
88  fakeTable = None
89  for ccd in ccds:
90  dataId = {'visit': visit, 'ccd': ccd}
91  try:
92  temp = getFakeSources(butler, dataId, tol=1.0,
93  visit=True, ccd=True)
94  except Exception:
95  continue
96  if fakeTable is None:
97  fakeTable = temp.copy(True)
98  else:
99  fakeTable.extend(temp, True)
100 
101  npTable = writeNumpyTable(fakeTable)
102  rerunName = root.split('/')[-2]
103  tableFileName = output + '/' + rerunName + '_galMags.txt'
104  astropy.table.Table(npTable).write(tableFileName, format='ascii')
105 
106 
def getFakeSources(butler, dataId, tol=1.0, extraCols=('zeropoint', 'visit', 'ccd'), includeMissing=False, footprints=False, radecMatch=None, multiband=False, reffMatch=False, pix=0.168, minRad=None, raCol='RA', decCol='Dec')
Definition: matchFakes.py:219
def writeNumpyTable(fakeTable)
Definition: compareModel.py:43
def main(root, visit, ccds, galType='sersic', output='outputs/')
Definition: compareModel.py:83

◆ writeNumpyTable()

def lsst.synpipe.compareModel.writeNumpyTable (   fakeTable)
Writes output to numpy

Definition at line 43 of file compareModel.py.

43 def writeNumpyTable(fakeTable):
44  """Writes output to numpy
45  """
46  npTable = np.recarray(len(fakeTable),
47  dtype={'names': ['id', 'fakeid', 'visit', 'ccd',
48  'cmodelMag', 'expMag',
49  'devMag',
50  'expReff', 'devReff',
51  'expBA', 'devBA',
52  'expPosAng', 'devPosAng',
53  'cmodelMagErr', 'expMagErr',
54  'devMagErr', 'nchild', 'parent'],
55  'formats': [int, int, int, int,
56  float, float,
57  float, float, float, float,
58  float, float, float, float,
59  float, float, int, int]})
60  for indFake, fake in enumerate(fakeTable):
61  npTable[indFake]['id'] = fake.get('id')
62  npTable[indFake]['fakeid'] = fake.get('fakeId')
63  npTable[indFake]['ccd'] = fake.get('ccd')
64  npTable[indFake]['visit'] = fake.get('visit')
65  nameMatch = {'sersic': 'cmodel',
66  'exp': 'cmodel.exp',
67  'cmodel': 'cmodel',
68  'dev': 'cmodel.dev'}
69  for name in ('cmodel', 'exp', 'dev'):
70  m1, m2 = getMag(fake, nameMatch[name]+'.flux')
71  npTable[indFake][name+'Mag'] = m1
72  npTable[indFake][name+'MagErr'] = m2
73  for name in ('exp', 'dev'):
74  params = getParams(fake, name)
75  npTable[indFake][name+'Reff'] = params[0]
76  npTable[indFake][name+'BA'] = params[1]
77  npTable[indFake][name+'PosAng'] = params[2]
78  npTable[indFake]['nchild'] = fake.get('deblend.nchild')
79  npTable[indFake]['parent'] = fake.get('parent')
80  return npTable
81 
82 
def getMag(record, fluxType='cmodel')
Definition: compareModel.py:33
def getParams(record, galType='sersic')
Definition: compareModel.py:17
def writeNumpyTable(fakeTable)
Definition: compareModel.py:43

Variable Documentation

◆ args

lsst.synpipe.compareModel.args = parser.parse_args()

Definition at line 116 of file compareModel.py.

◆ ccd

lsst.synpipe.compareModel.ccd

Definition at line 118 of file compareModel.py.

◆ choices

lsst.synpipe.compareModel.choices

Definition at line 113 of file compareModel.py.

◆ dest

lsst.synpipe.compareModel.dest

Definition at line 112 of file compareModel.py.

◆ galType

lsst.synpipe.compareModel.galType

Definition at line 118 of file compareModel.py.

◆ help

lsst.synpipe.compareModel.help

Definition at line 109 of file compareModel.py.

◆ int

lsst.synpipe.compareModel.int

Definition at line 110 of file compareModel.py.

◆ nargs

lsst.synpipe.compareModel.nargs

Definition at line 111 of file compareModel.py.

◆ output

lsst.synpipe.compareModel.output

Definition at line 119 of file compareModel.py.

◆ parser

lsst.synpipe.compareModel.parser = argparse.ArgumentParser()

Definition at line 108 of file compareModel.py.

◆ str

lsst.synpipe.compareModel.str

Definition at line 112 of file compareModel.py.

◆ type

lsst.synpipe.compareModel.type

Definition at line 110 of file compareModel.py.