Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/table/wcsUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,10 @@ Eigen::Matrix2f calculateCoordCovariance(geom::SkyWcs const &wcs, lsst::geom::Po
Eigen::Matrix2f d = localMatrix.cast<float>() * scale * (lsst::geom::PI / 180.0);

Eigen::Matrix2f skyCov = d * err * d.transpose();

// Multiply by declination correction matrix in order to get sigma(RA) * cos(Dec) for the uncertainty
// in RA, and cov(RA, Dec) * cos(Dec) for the RA/Dec covariance:
float cosDec = std::cos(skyCenter.getDec().asRadians());
Eigen::Matrix2f decCorr{{cosDec, 0}, {0, 1.0}};
Eigen::Matrix2f skyCovCorr = decCorr * skyCov * decCorr;
return skyCovCorr;
// Because the transform from pixels to RA/Dec was done at a local
// gnomonic, the RA and Dec covariance are already commensurate, and
// multiplying the RA covariance by cos(Dec) is not necessary.
return skyCov;
}

template <typename SourceCollection>
Expand Down
6 changes: 1 addition & 5 deletions tests/test_sourceTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,8 @@ def testCoordErrors(self):

centroidErr = self.record.getCentroidErr()
coordErr = radMatrix.dot(centroidErr.dot(radMatrix.T))
# multiply RA by cos(Dec):
cosDec = np.cos(skyCenter.getDec().asRadians())
decCorr = np.array([[cosDec, 0], [0, 1]])
coordErrCorr = decCorr.dot(coordErr.dot(decCorr))
catCoordErr = self.record.get(self.coordErrKey)
np.testing.assert_almost_equal(coordErrCorr, catCoordErr, decimal=16)
np.testing.assert_almost_equal(coordErr, catCoordErr, decimal=16)

def testSorting(self):
self.assertFalse(self.catalog.isSorted())
Expand Down