Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-15244: Change fluxSigma to fluxErr and similarly for apCorr and covariances #97

Merged
merged 2 commits into from
Aug 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/lsst/meas/astrom/ScaledPolynomialTransformFitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class ScaledPolynomialTransformFitter {
* - ref_id: reference object ID
* - src_id: source ID from the match
* - src_{x,y}: source position in pixels
* - src_{xSigma,ySigma,x_y_Cov}: uncertainty on source positions,
* - src_{xErr,yErr,x_y_Cov}: uncertainty on source positions,
* including measurement errors and the inferred
* intrinsic scatter.
* - intermediate_{x,y}: reference positions in intermediate world
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/meas/astrom/fitSipDistortion.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def fitWcs(self, matches, initWcs, bbox=None, refCat=None, sourceCat=None, expos
If provided then coords are updated with the new WCS;
otherwise only the coords for sources in matches are updated.
Required input fields are "slot_Centroid_x", "slot_Centroid_y",
"slot_Centroid_xSigma", "slot_Centroid_ySigma", and optionally
"slot_Centroid_xErr", "slot_Centroid_yErr", and optionally
"slot_Centroid_x_y_Cov". The "coord_ra" and "coord_dec" fields
will be updated but are not used as input.
exposure : :cpp:class:`lsst::afw::image::Exposure`
Expand Down
8 changes: 4 additions & 4 deletions tests/test_astrometryTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ def testUsedFlag(self):
sourceCat.reserve(len(refCat))
sourceCentroidKey = afwTable.Point2DKey(sourceSchema["slot_Centroid"])
sourceFluxKey = sourceSchema["slot_ApFlux_flux"].asKey()
sourceFluxSigmaKey = sourceSchema["slot_ApFlux_fluxSigma"].asKey()
sourceFluxErrKey = sourceSchema["slot_ApFlux_fluxErr"].asKey()

for refObj in refCat:
src = sourceCat.addNew()
src.set(sourceCentroidKey, refObj.get(refCentroidKey))
src.set(sourceFluxKey, refObj.get(refFluxRKey))
src.set(sourceFluxSigmaKey, refObj.get(refFluxRKey)/100)
src.set(sourceFluxErrKey, refObj.get(refFluxRKey)/100)

results = solver.run(
sourceCat=sourceCat,
Expand Down Expand Up @@ -181,14 +181,14 @@ def makeSourceCat(self, distortedWcs):
sourceCat = afwTable.SourceCatalog(sourceSchema)
sourceCentroidKey = afwTable.Point2DKey(sourceSchema["slot_Centroid"])
sourceFluxKey = sourceSchema["slot_ApFlux_flux"].asKey()
sourceFluxSigmaKey = sourceSchema["slot_ApFlux_fluxSigma"].asKey()
sourceFluxErrKey = sourceSchema["slot_ApFlux_fluxErr"].asKey()

sourceCat.reserve(len(refCat))
for refObj in refCat:
src = sourceCat.addNew()
src.set(sourceCentroidKey, refObj.get(refCentroidKey))
src.set(sourceFluxKey, refObj.get(refFluxRKey))
src.set(sourceFluxSigmaKey, refObj.get(refFluxRKey)/100)
src.set(sourceFluxErrKey, refObj.get(refFluxRKey)/100)
return sourceCat


Expand Down
10 changes: 5 additions & 5 deletions tests/test_fitTanSipWcsTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def loadData(self, rangePix=3000, numPoints=25):
"""
if self.MatchClass == afwTable.ReferenceMatch:
refSchema = LoadReferenceObjectsTask.makeMinimalSchema(
filterNameList=["r"], addFluxSigma=True, addIsPhotometric=True)
filterNameList=["r"], addFluxErr=True, addIsPhotometric=True)
self.refCat = afwTable.SimpleCatalog(refSchema)
elif self.MatchClass == afwTable.SourceMatch:
refSchema = afwTable.SourceTable.makeMinimalSchema()
Expand All @@ -86,8 +86,8 @@ def loadData(self, rangePix=3000, numPoints=25):
SingleFrameMeasurementTask(schema=srcSchema)
self.srcCoordKey = afwTable.CoordKey(srcSchema["coord"])
self.srcCentroidKey = afwTable.Point2DKey(srcSchema["slot_Centroid"])
self.srcCentroidKey_xSigma = srcSchema["slot_Centroid_xSigma"].asKey()
self.srcCentroidKey_ySigma = srcSchema["slot_Centroid_ySigma"].asKey()
self.srcCentroidKey_xErr = srcSchema["slot_Centroid_xErr"].asKey()
self.srcCentroidKey_yErr = srcSchema["slot_Centroid_yErr"].asKey()
self.sourceCat = afwTable.SourceCatalog(srcSchema)

self.matches = []
Expand All @@ -98,8 +98,8 @@ def loadData(self, rangePix=3000, numPoints=25):
refObj = self.refCat.addNew()

src.set(self.srcCentroidKey, lsst.geom.Point2D(i, j))
src.set(self.srcCentroidKey_xSigma, 0.1)
src.set(self.srcCentroidKey_ySigma, 0.1)
src.set(self.srcCentroidKey_xErr, 0.1)
src.set(self.srcCentroidKey_yErr, 0.1)

c = self.tanWcs.pixelToSky(i, j)
refObj.setCoord(c)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_joinMatchListWithCatalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def testJoin(self):
self.assertEqual(matches2[i].first.get("i_flux"), matches[i].first.get("i_flux"))

def testJoinAllFluxes(self):
"""Test that we can read all the fluxes back from an a.n.d catalogue"""
"""Test that we can read all the fluxes from a reference catalog"""
res = self.getAstrometrySolution()

matches = res.matches
Expand All @@ -108,10 +108,10 @@ def testJoinAllFluxes(self):
self.assertGreater(len(matches2), 0)
ref = matches2[0][0]

names = ref.getSchema().getNames()
refSchema = ref.getSchema()
for b in ("u", "g", "r", "i", "z"):
self.assertIn("%s_flux" % (b,), names)
self.assertIn("%s_fluxSigma" % (b,), names)
self.assertIn("%s_flux" % (b,), refSchema)
self.assertIn("%s_fluxErr" % (b,), refSchema)


class MemoryTester(lsst.utils.tests.MemoryTestCase):
Expand Down
8 changes: 4 additions & 4 deletions tests/test_matchOptimisticB.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def computePosRefCatalog(self, sourceCat):
"""
minimalPosRefSchema = LoadReferenceObjectsTask.makeMinimalSchema(
filterNameList=["r"],
addFluxSigma=True,
addFluxErr=True,
)
refCat = afwTable.SimpleCatalog(minimalPosRefSchema)
for source in sourceCat:
Expand All @@ -151,7 +151,7 @@ def computePosRefCatalog(self, sourceCat):
refObj.set("centroid_y", source.getY())
refObj.set("hasCentroid", True)
refObj.set("r_flux", source.get("slot_ApFlux_flux"))
refObj.set("r_fluxSigma", source.get("slot_ApFlux_fluxSigma"))
refObj.set("r_fluxErr", source.get("slot_ApFlux_fluxErr"))
refObj.setId(source.getId())
return refCat

Expand All @@ -162,7 +162,7 @@ def loadSourceCatalog(self, filename):
aliasMap = sourceCat.schema.getAliasMap()
aliasMap.set("slot_ApFlux", "base_PsfFlux")
fluxKey = sourceCat.schema["slot_ApFlux_flux"].asKey()
fluxSigmaKey = sourceCat.schema["slot_ApFlux_fluxSigma"].asKey()
fluxErrKey = sourceCat.schema["slot_ApFlux_fluxErr"].asKey()

# print("schema=", sourceCat.schema)

Expand All @@ -172,7 +172,7 @@ def loadSourceCatalog(self, filename):
adjCentroid = src.get(centroidKey) - lsst.geom.Extent2D(500, 500)
src.set(centroidKey, adjCentroid)
src.set(fluxKey, 1000)
src.set(fluxSigmaKey, 1)
src.set(fluxErrKey, 1)

# Set catalog coord
for src in sourceCat:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_matchPessimisticB.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def computePosRefCatalog(self, sourceCat):
"""
minimalPosRefSchema = LoadReferenceObjectsTask.makeMinimalSchema(
filterNameList=["r"],
addFluxSigma=True,
addFluxErr=True,
)
refCat = afwTable.SimpleCatalog(minimalPosRefSchema)
refCat.reserve(len(sourceCat))
Expand All @@ -163,7 +163,7 @@ def computePosRefCatalog(self, sourceCat):
refObj.set("centroid_y", source.getY())
refObj.set("hasCentroid", True)
refObj.set("r_flux", source.get("slot_ApFlux_flux"))
refObj.set("r_fluxSigma", source.get("slot_ApFlux_fluxSigma"))
refObj.set("r_fluxErr", source.get("slot_ApFlux_fluxErr"))
refObj.setId(source.getId())
return refCat

Expand All @@ -176,15 +176,15 @@ def loadSourceCatalog(self, filename):
aliasMap = sourceCat.schema.getAliasMap()
aliasMap.set("slot_ApFlux", "base_PsfFlux")
fluxKey = sourceCat.schema["slot_ApFlux_flux"].asKey()
fluxSigmaKey = sourceCat.schema["slot_ApFlux_fluxSigma"].asKey()
fluxErrKey = sourceCat.schema["slot_ApFlux_fluxErr"].asKey()

# Source x,y positions are ~ (500,1500) x (500,1500)
centroidKey = sourceCat.table.getCentroidKey()
for src in sourceCat:
adjCentroid = src.get(centroidKey) - lsst.geom.Extent2D(500, 500)
src.set(centroidKey, adjCentroid)
src.set(fluxKey, 1000)
src.set(fluxSigmaKey, 1)
src.set(fluxErrKey, 1)

# Set catalog coord
for src in sourceCat:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_setMatchDistance.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def setUp(self):

if self.MatchClass == afwTable.ReferenceMatch:
refSchema = LoadReferenceObjectsTask.makeMinimalSchema(
filterNameList=["r"], addFluxSigma=True, addIsPhotometric=True)
filterNameList=["r"], addFluxErr=True, addIsPhotometric=True)
self.refCat = afwTable.SimpleCatalog(refSchema)
elif self.MatchClass == afwTable.SourceMatch:
refSchema = afwTable.SourceTable.makeMinimalSchema()
Expand Down