Skip to content

Commit

Permalink
Merge pull request #167 from lsst/tickets/DM-28233
Browse files Browse the repository at this point in the history
DM-28233: Fix refcat position error units
  • Loading branch information
erykoff committed Jan 7, 2021
2 parents 642e80a + f3ea031 commit cff38f6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 26 deletions.
7 changes: 4 additions & 3 deletions src/Associations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,11 @@ void Associations::collectRefStars(afw::table::SimpleCatalog &refCat, geom::Angl
auto star = std::make_shared<RefStar>(ra, dec, flux, fluxErr);

if (std::isnan(refCoordinateErr)) {
star->vx = record->get(raErrKey);
star->vy = record->get(decErrKey);
// refcat errors are unitless but stored as radians: convert to deg**2
star->vx = std::pow(lsst::geom::radToDeg(record->get(raErrKey)), 2);
star->vy = std::pow(lsst::geom::radToDeg(record->get(decErrKey)), 2);
} else {
// Compute and use the fake errors
// Convert the fake errors from mas to deg**2
star->vx = std::pow(refCoordinateErr / 1000. / 3600. / std::cos(coord.getLatitude()), 2);
star->vy = std::pow(refCoordinateErr / 1000. / 3600., 2);
}
Expand Down
19 changes: 11 additions & 8 deletions tests/test_jointcal_cfht.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_jointcalTask_2_visits(self):
self.config.debugOutputPath = tempdir

# See Readme for an explanation of these empirical values.
dist_rms_relative = 14e-3*u.arcsecond
dist_rms_relative = 16e-3*u.arcsecond
pa1 = 0.049
metrics = {'collected_astrometry_refStars': 867,
'collected_photometry_refStars': 11570,
Expand All @@ -99,8 +99,8 @@ def test_jointcalTask_2_visits(self):
'selected_photometry_fittedStars': 2232,
'selected_astrometry_ccdImages': 12,
'selected_photometry_ccdImages': 12,
'astrometry_final_chi2': 1146.81,
'astrometry_final_ndof': 2486,
'astrometry_final_chi2': 1159.736,
'astrometry_final_ndof': 1872,
'photometry_final_chi2': 11624.3,
'photometry_final_ndof': 2778
}
Expand Down Expand Up @@ -131,14 +131,14 @@ def setup_jointcalTask_2_visits_constrainedAstrometry(self):
self.jointcalStatistics.do_photometry = False

# See Readme for an explanation of these empirical values.
dist_rms_relative = 12e-3*u.arcsecond
dist_rms_relative = 16e-3*u.arcsecond
metrics = {'collected_astrometry_refStars': 867,
'selected_astrometry_refStars': 332,
'associated_astrometry_fittedStars': 2272,
'selected_astrometry_fittedStars': 1229,
'selected_astrometry_ccdImages': 12,
'astrometry_final_chi2': 1204.72,
'astrometry_final_ndof': 2576,
'astrometry_final_chi2': 1124.0575,
'astrometry_final_ndof': 1912,
}

return dist_rms_relative, metrics
Expand All @@ -158,6 +158,9 @@ def test_jointcalTask_2_visits_constrainedAstrometry_no_rank_update(self):
"""Demonstrate that skipping the rank update doesn't substantially affect astrometry.
"""
relative_error, metrics = self.setup_jointcalTask_2_visits_constrainedAstrometry()
metrics['astrometry_final_chi2'] = 1069.348
metrics['astrometry_final_ndof'] = 1900

self.config.astrometryDoRankUpdate = False

self._testJointcalTask(2, relative_error, self.dist_rms_absolute, None, metrics=metrics)
Expand All @@ -168,8 +171,8 @@ def test_jointcalTask_2_visits_constrainedAstrometry_4sigma_outliers(self):
"""
dist_rms_relative, metrics = self.setup_jointcalTask_2_visits_constrainedAstrometry()
self.config.outlierRejectSigma = 4
metrics['astrometry_final_chi2'] = 849.75
metrics['astrometry_final_ndof'] = 2390
metrics['astrometry_final_chi2'] = 757.027
metrics['astrometry_final_ndof'] = 1732

self._testJointcalTask(2, dist_rms_relative, self.dist_rms_absolute, None, metrics=metrics)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_jointcal_decam.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def test_jointcalTask_2_visits(self):
'selected_photometry_fittedStars': 4637,
'selected_astrometry_ccdImages': 15,
'selected_photometry_ccdImages': 15,
'astrometry_final_chi2': 1.21494,
'astrometry_final_ndof': 560,
'astrometry_final_chi2': 2803.108,
'astrometry_final_ndof': 890,
'photometry_final_chi2': 16529,
'photometry_final_ndof': 3634,
}
Expand Down
26 changes: 13 additions & 13 deletions tests/test_jointcal_hsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def test_jointcalTask_2_visits_simple(self):
'selected_photometry_fittedStars': 1731,
'selected_astrometry_ccdImages': 6,
'selected_photometry_ccdImages': 6,
'astrometry_final_chi2': 683.783,
'astrometry_final_ndof': 1916,
'astrometry_final_chi2': 835.473,
'astrometry_final_ndof': 1918,
'photometry_final_chi2': 4997.62,
'photometry_final_ndof': 2188
}
Expand Down Expand Up @@ -127,8 +127,8 @@ def test_jointcalTask_10_visits_simple_astrometry_no_photometry(self):
'associated_astrometry_fittedStars': 5860,
'selected_astrometry_fittedStars': 3568,
'selected_astrometry_ccdImages': 30,
'astrometry_final_chi2': 9621.29,
'astrometry_final_ndof': 18562,
'astrometry_final_chi2': 10218.518,
'astrometry_final_ndof': 18574,
}
self._testJointcalTask(10, dist_rms_relative, dist_rms_absolute, pa1, metrics=metrics)

Expand Down Expand Up @@ -199,8 +199,8 @@ def test_JointcalTask_2_visits_simple_astrometry_no_photometry(self):
'associated_astrometry_fittedStars': 2070,
'selected_astrometry_fittedStars': 989,
'selected_astrometry_ccdImages': 6,
'astrometry_final_chi2': 683.783,
'astrometry_final_ndof': 1916,
'astrometry_final_chi2': 835.473,
'astrometry_final_ndof': 1918,
}
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.astrometryModel = "simple"
Expand Down Expand Up @@ -232,8 +232,8 @@ def test_jointcalTask_2_visits_simple_astrometry_no_photometry_match_cut_10(self
'associated_astrometry_fittedStars': 2070,
'selected_astrometry_fittedStars': 1042,
'selected_astrometry_ccdImages': 6,
'astrometry_final_chi2': 683.369,
'astrometry_final_ndof': 1910,
'astrometry_final_chi2': 800.346,
'astrometry_final_ndof': 1864,
}
pa1 = None
self._testJointcalTask(2, self.dist_rms_relative, dist_rms_absolute, pa1, metrics=metrics)
Expand All @@ -247,15 +247,15 @@ def test_jointcalTask_3_visits_simple_astrometry_no_photometry(self):
self.jointcalStatistics.do_photometry = False

# More visits and slightly worse relative and absolute rms.
dist_rms_relative = 8.2e-3*u.arcsecond
dist_rms_relative = 8.3e-3*u.arcsecond
dist_rms_absolute = 24e-3*u.arcsecond
metrics = {'collected_astrometry_refStars': 1038,
'selected_astrometry_refStars': 209,
'associated_astrometry_fittedStars': 3199,
'selected_astrometry_fittedStars': 1282,
'selected_astrometry_ccdImages': 9,
'astrometry_final_chi2': 1013.20,
'astrometry_final_ndof': 2900,
'astrometry_final_chi2': 1221.63,
'astrometry_final_ndof': 2892,
}
pa1 = None
self._testJointcalTask(3, dist_rms_relative, dist_rms_absolute, pa1, metrics=metrics)
Expand All @@ -278,8 +278,8 @@ def test_jointcalTask_3_visits_simple_astrometry_no_photometry_min_measurements_
'associated_astrometry_fittedStars': 3199,
'selected_astrometry_fittedStars': 432,
'selected_astrometry_ccdImages': 9,
'astrometry_final_chi2': 360.884,
'astrometry_final_ndof': 1294,
'astrometry_final_chi2': 567.443,
'astrometry_final_ndof': 1286,
}
pa1 = None
self._testJointcalTask(3, dist_rms_relative, dist_rms_absolute, pa1, metrics=metrics)
Expand Down

0 comments on commit cff38f6

Please sign in to comment.