Skip to content

Commit

Permalink
Merge pull request #104 from lsst/tickets/DM-15244
Browse files Browse the repository at this point in the history
DM-15244: Change fluxSigma to fluxErr and similarly for apCorr and covariances
  • Loading branch information
r-owen committed Aug 7, 2018
2 parents b249c62 + bc241f9 commit ba404c9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions python/lsst/jointcal/testUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@ def createFakeCatalog(num, bbox, instFluxKeyName, skyWcs=None, refCat=False):
schema = lsst.afw.table.SourceTable.makeMinimalSchema()
# centroid
centroidKey = lsst.afw.table.Point2DKey.addFields(schema, "centroid", "centroid", "pixels")
xErrKey = schema.addField("centroid_xSigma", type="F")
yErrKey = schema.addField("centroid_ySigma", type="F")
xErrKey = schema.addField("centroid_xErr", type="F")
yErrKey = schema.addField("centroid_yErr", type="F")
# shape
shapeKey = lsst.afw.table.QuadrupoleKey.addFields(schema, "shape", "",
lsst.afw.table.CoordinateType.PIXEL)
# Put the fake sources in the minimal catalog.
schema.addField(instFluxKeyName+"_flux", type="D", doc="post-ISR instFlux")
schema.addField(instFluxKeyName+"_fluxSigma", type="D", doc="post-ISR instFlux stddev")
schema.addField(instFluxKeyName+"_fluxErr", type="D", doc="post-ISR instFlux stddev")
schema.addField(instFluxKeyName+"_calFlux", type="D", doc="maggies")
schema.addField(instFluxKeyName+"_calFluxErr", type="D", doc="maggies stddev")
schema.addField(instFluxKeyName+"_mag", type="D", doc="magnitude")
Expand Down Expand Up @@ -258,7 +258,7 @@ def fillCatalog(schema, num, bbox,
catalog[xErrKey] = vx
catalog[yErrKey] = vy
catalog[instFluxKeyName + '_flux'] = instFlux
catalog[instFluxKeyName + '_fluxSigma'] = instFluxErr
catalog[instFluxKeyName + '_fluxErr'] = instFluxErr

return catalog

Expand Down
6 changes: 3 additions & 3 deletions python/lsst/jointcal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self, match_radius=0.1*arcseconds, flux_limit=100.0,
match_radius : lsst.afw.geom.Angle
match sources within this radius for RMS statistics
flux_limit : float
Signal/Noise (flux/fluxSigma) for sources to be included in the RMS cross-match.
Signal/Noise (flux/fluxErr) for sources to be included in the RMS cross-match.
100 is a balance between good centroids and enough sources.
do_photometry : bool, optional
Perform calculations/make plots for photometric metrics.
Expand Down Expand Up @@ -265,7 +265,7 @@ def rms(flux, ref_flux):
self.old_mag = np.fromiter((abMagFromFlux(r) for r in self.old_ref), dtype=float)
self.new_mag = np.fromiter((abMagFromFlux(r) for r in self.new_ref), dtype=float)

def signal_to_noise(sources, flux_key='slot_PsfFlux_flux', sigma_key='slot_PsfFlux_fluxSigma'):
def signal_to_noise(sources, flux_key='slot_PsfFlux_flux', sigma_key='slot_PsfFlux_fluxErr'):
"""Compute the mean signal/noise per source from a MatchDict of SourceRecords."""
result = np.empty(len(sources))
for i, src in enumerate(sources.values()):
Expand Down Expand Up @@ -354,7 +354,7 @@ def get_fluxes(photoCalib, match):
return Flux(flux, ref_flux)

for cat, photoCalib, filt in zip(visit_catalogs, photoCalibs, self.filters):
good = (cat.get('base_PsfFlux_flux')/cat.get('base_PsfFlux_fluxSigma')) > self.flux_limit
good = (cat.get('base_PsfFlux_flux')/cat.get('base_PsfFlux_fluxErr')) > self.flux_limit
# things the classifier called sources are not extended.
good &= (cat.get('base_ClassificationExtendedness_value') == 0)
matches = lsst.afw.table.matchRaDec(reference, cat[good], self.match_radius)
Expand Down
4 changes: 2 additions & 2 deletions src/Associations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ void Associations::collectRefStars(afw::table::SimpleCatalog &refCat, afw::geom:
// Don't blow up if the reference catalog doesn't contain errors.
afw::table::Key<double> fluxErrKey;
try {
fluxErrKey = refCat.getSchema().find<double>(fluxField + "Sigma").key;
fluxErrKey = refCat.getSchema().find<double>(fluxField + "Err").key;
} catch (pex::exceptions::NotFoundError &) {
LOGLS_WARN(_log, "Flux error field ("
<< fluxField << "Sigma"
<< fluxField << "Err"
<< ") not found in reference catalog. Not using ref flux errors.");
}
_filterMap.clear();
Expand Down
6 changes: 3 additions & 3 deletions src/CcdImage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ std::ostream &operator<<(std::ostream &out, CcdImageKey const &key) {
void CcdImage::loadCatalog(afw::table::SourceCatalog const &catalog, std::string const &fluxField) {
auto xKey = catalog.getSchema().find<double>("slot_Centroid_x").key;
auto yKey = catalog.getSchema().find<double>("slot_Centroid_y").key;
auto xsKey = catalog.getSchema().find<float>("slot_Centroid_xSigma").key;
auto ysKey = catalog.getSchema().find<float>("slot_Centroid_ySigma").key;
auto xsKey = catalog.getSchema().find<float>("slot_Centroid_xErr").key;
auto ysKey = catalog.getSchema().find<float>("slot_Centroid_yErr").key;
auto mxxKey = catalog.getSchema().find<double>("slot_Shape_xx").key;
auto myyKey = catalog.getSchema().find<double>("slot_Shape_yy").key;
auto mxyKey = catalog.getSchema().find<double>("slot_Shape_xy").key;
auto fluxKey = catalog.getSchema().find<double>(fluxField + "_flux").key;
auto fluxErrKey = catalog.getSchema().find<double>(fluxField + "_fluxSigma").key;
auto fluxErrKey = catalog.getSchema().find<double>(fluxField + "_fluxErr").key;

auto transform = _detector->getTransform(afw::cameraGeom::PIXELS, afw::cameraGeom::FOCAL_PLANE);

Expand Down
6 changes: 3 additions & 3 deletions src/MeasuredStar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ namespace jointcal {
/* Interesting fields of the stack catalogs :
'base_SdssCentroid_x'
'base_SdssCentroid_y'
'base_SdssCentroid_xSigma'
'base_SdssCentroid_ySigma'
'base_SdssCentroid_xErr'
'base_SdssCentroid_yErr'
We miss the xy uncertainty term.
We can cook it up from the sdss shape:
Expand All @@ -27,7 +27,7 @@ We can cook it up from the sdss shape:
for fluxes, we might use :
'base_CircularApertureFlux_2_flux'
'base_CircularApertureFlux_2_fluxSigma'
'base_CircularApertureFlux_2_fluxErr'
where the '2' should be read from the environment.
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/jointcalTestBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def setUp_base(self, center, radius,
self.other_args = other_args
self.do_plot = do_plot
self.log_level = log_level
# Signal/Noise (flux/fluxSigma) for sources to be included in the RMS cross-match.
# Signal/Noise (flux/fluxErr) for sources to be included in the RMS cross-match.
# 100 is a balance between good centroids and enough sources.
self.flux_limit = 100

Expand Down

0 comments on commit ba404c9

Please sign in to comment.