# Add a maximum mean offset threshold for SFM astrometry fit success

XMLWordPrintable

#### Details

• Type: Story
• Status: Done
• Resolution: Done
• Fix Version/s: None
• Component/s:
• Labels:
• Story Points:
5
• Sprint:
DRP S21b
• Team:
Data Release Production
• Urgent?:
No

#### Description

In our current implementation, it is possible for our SFM astrometric fitter to converge on a fit that, in reality is quite bad and should be considered an effective failure.  If not flagged, these visits will get included in the coadds, and wreak more havoc than one might naively expect (namely because their photometric zeropoints can then be so severely biased that these single exposures can be given a lot of weight in the coadd; see DM-30466 for a few striking visual examples).  It is thus desirable to have a (configurable) threshold on the mean offset of the fit above which even a converged WCS fit will be deemed a failure.

We do currently have some related (but not equatable) thresholds within some of our fitters (namely fitTanSipWcs and fitSipDistortionWcs:

 maxScatterArcsec = lsst.pex.config.RangeField(  doc="Maximum median scatter of a WCS fit beyond which the fit fails (arcsec); "  "be generous, as this is only intended to catch catastrophic failures",  dtype=float,  default=10,  min=0,  ) 

but this is not the same value as we are using, e.g. as the astrometric mean and scatter stats being persisted to the Visit/Exposure summaries (see DM-30701) and having the stopgap in the fitter precludes extra iterations which might have otherwise had a chance at converging on a better solution (and, hence, the "generous" qualifier in the description). The nature of the stats computed and persisted to the summaries also provide a more natural path to justifying the threshold set (which will depend on workflow, e.g. whether an external global calibration is to be performed subsequent to SFM, in which case the tolerance can be much looser as this algorithm will have a good chance of recovering from iffy SFM fits when they are surrounded by good ones).
As such, it is the stats computed outside the fitter and in the AstrometryTask itself that should be compared against our threshold for deeming a WCS fit as a pass/fail. This ticket is to implement such a threshold and set some reasonable and justified thresholds such that we can forestall any calexps with bad astrometry creeping into our coadds.

#### Attachments

1. perBand_DC2_4431.png
74 kB
2. perBand_HSC_RC2.png
77 kB
3. visitSummary_meanVsStd_offset_HSC_RC2_w38.png
172 kB
4. visitSummary_meanVsStd_offset_tract44431.png
147 kB
5. visitSummaryStats_HSC_RC2_w38.png
72 kB
6. visitSummaryStats_tract4431.png
79 kB

#### Activity

Hide
Lauren MacArthur added a comment -

Thanks for your useful comments on the PR.  I think I adopted them all and, while I realize you've already makes this as reviewed, I would appreciate another quick look from you before I merge!

A fresh Jenkins is running.

Show
Lauren MacArthur added a comment - Thanks for your useful comments on the PR.  I think I adopted them all and, while I realize you've already makes this as reviewed, I would appreciate another quick look from you before I merge! A fresh Jenkins is running .
Hide
Lauren MacArthur added a comment -

Thanks again.  Merged and done.

Show
Lauren MacArthur added a comment - Thanks again.  Merged and done.
Hide

Ahoy there Lauren MacArthur, your backport request has been approved, and we have some fresh instructions for how to backport this to v23.0.x here: https://developer.lsst.io/work/backports.html

You have a couple options:
1) Follow the instructions to backport it yourself (and ask for clarification if they're confusing, since you'd be the first person other than the author to follow them) or
2) Ask one of the DP0.2 release managers (which is me right now) to backport it.

Show
Yusra AlSayyad added a comment - Ahoy there Lauren MacArthur , your backport request has been approved, and we have some fresh instructions for how to backport this to v23.0.x here: https://developer.lsst.io/work/backports.html You have a couple options: 1) Follow the instructions to backport it yourself (and ask for clarification if they're confusing, since you'd be the first person other than the author to follow them) or 2) Ask one of the DP0.2 release managers (which is me right now) to backport it.
Hide
Lauren MacArthur added a comment -

Happy to give 1) an ol' heave ho so that you can get some feedback on the instructions!

Show
Lauren MacArthur added a comment - Happy to give 1) an ol' heave ho so that you can get some feedback on the instructions!
Hide
Lauren MacArthur added a comment -

Ok, with some hand-holding from Yusra AlSayyad, this is now backported.  Jenkins was happy and the backport-done label has been added to the ticket.

Show
Lauren MacArthur added a comment - Ok, with some hand-holding from Yusra AlSayyad , this is now backported.  Jenkins was happy and the backport-done label has been added to the ticket.

#### People

Assignee:
Lauren MacArthur
Reporter:
Lauren MacArthur
Reviewers:
Eli Rykoff
Watchers:
Eli Rykoff, Jim Bosch, John Parejko, Lauren MacArthur, Yusra AlSayyad