# Select images for coadd based on PSF quality.

XMLWordPrintable

#### Details

• Type: Story
• Status: Done
• Resolution: Done
• Fix Version/s: None
• Component/s:
• Labels:
• Story Points:
6
• Team:
Data Release Production

#### Description

In HSC, there are a number of ways that the PSF modeling with psfex can be poor. Most of the time this is because the seeing is too good, but there can be other things that cause problems. We would like to reject these images when building the coadd. This ticket is to write an image selector that selects on the quality of the PSF based on the residuals of the second moments.

#### Attachments

36 kB
42 kB
3. outlier.png
50 kB
4. res_median_log.png
46 kB
5. res_median.png
52 kB
6. res_scatter.png
47 kB
7. update_res_median.png
56 kB
8. update_res_scatter.png
50 kB

#### Activity

Hide
Bob Armstrong added a comment -

I tried to come up with a reasonable set of cuts based on the results from the HSC S16A visit data. I use the following quantities derived from the second moment quantities:

• e1 = (Ixx-Iyy)/(Ixx+Iyy)
• e2 = 2*Ixy/(Ixx+Iyy)

I have also rejected ccd 9 from this analysis because of the known problems there that cause many visits to fail.

For each CCD I looked at the residuals of the two ellipticity components and the size. Here is the median of residuals for each CCD.

Here is a plot of the scatter (as defined by the median absolute deviation scaled to be a Gaussian.) for each of these quantities.

Finally, I plot the fraction of objects with values greater than 5*scatter from the median.

Given these plots I chose a conservative set of cuts to remove outliers:

• median ellipticity residual < 0.015 (equivalent to ~10sigma of the distribution)
• median size residual < 0.008 (equivalent to ~10sigma of the distribution)
• size scatter < 0.03
• ellipticity scatter < 0.065
• size outlier fraction < 0.065
• ellipticity outlier fraction < 0.1

With these cuts I remove 6808 ccds from 971 different visits which corresponds to ~5% of the data. Here is the number of ccds removed from each visit.

You can see that most visits only have a few ccds with poorly modeled data. I also noticed that a number of ccds from the visits we rejected in S16A don't have any problems.

Here are the number of rejected visits for each ccd which show fairly uniform coverage except for the outer ccds:

We could also try to be more aggressive to exclude more objects as these are cuts are quite conservative.

Show
Bob Armstrong added a comment - I tried to come up with a reasonable set of cuts based on the results from the HSC S16A visit data. I use the following quantities derived from the second moment quantities: e1 = (Ixx-Iyy)/(Ixx+Iyy) e2 = 2*Ixy/(Ixx+Iyy) size = determinant radius I have also rejected ccd 9 from this analysis because of the known problems there that cause many visits to fail. For each CCD I looked at the residuals of the two ellipticity components and the size. Here is the median of residuals for each CCD. Here is a plot of the scatter (as defined by the median absolute deviation scaled to be a Gaussian.) for each of these quantities. Finally, I plot the fraction of objects with values greater than 5*scatter from the median. Given these plots I chose a conservative set of cuts to remove outliers: median ellipticity residual < 0.015 (equivalent to ~10sigma of the distribution) median size residual < 0.008 (equivalent to ~10sigma of the distribution) size scatter < 0.03 ellipticity scatter < 0.065 size outlier fraction < 0.065 ellipticity outlier fraction < 0.1 With these cuts I remove 6808 ccds from 971 different visits which corresponds to ~5% of the data. Here is the number of ccds removed from each visit. You can see that most visits only have a few ccds with poorly modeled data. I also noticed that a number of ccds from the visits we rejected in S16A don't have any problems. Here are the number of rejected visits for each ccd which show fairly uniform coverage except for the outer ccds: We could also try to be more aggressive to exclude more objects as these are cuts are quite conservative.
Hide
Bob Armstrong added a comment -

At the suggestion of Rachel Mandelbaum, I have remade the plots using delta size/size.

Note that I have shifted the distribution to be centered at zero. And here is the scatter plot:

Upon further investigations I found the following:

• the median(delta e1) cut per ccd does not overlap much with the median(delta e2) because you have visits where either e1 or e2 is small across the ccd while the other is large. For problematic visits it will still get the small ellipticity value correct, but not the large. I think the way to go here is to combine into a median(delta e) cut.
• a permissive cut in the median( (delta size)/ size) does not catch some of the known bad visits, while a cut in the ellipticity does. Therefore this cut does not seem to add any more information.
• The scatter for delta e1, delta e2 and delta size/size per ccd roughly flag the same visits, and add ~15% ccds to the median(delta e) cut. These look like poor modeling where the residuals are equally scattered around the mean. A tighter cut on the median(delta e) value can also catch these.
• The fraction of bad objects is not a useful metric because some ccds have essentially constant ellipticity/size and therefore a scatter that is extremely small which can give rise to reasonably large outliers.
Show
Bob Armstrong added a comment - At the suggestion of Rachel Mandelbaum, I have remade the plots using delta size/size. Note that I have shifted the distribution to be centered at zero. And here is the scatter plot: Upon further investigations I found the following: the median(delta e1) cut per ccd does not overlap much with the median(delta e2) because you have visits where either e1 or e2 is small across the ccd while the other is large. For problematic visits it will still get the small ellipticity value correct, but not the large. I think the way to go here is to combine into a median(delta e) cut. a permissive cut in the median( (delta size)/ size) does not catch some of the known bad visits, while a cut in the ellipticity does. Therefore this cut does not seem to add any more information. The scatter for delta e1, delta e2 and delta size/size per ccd roughly flag the same visits, and add ~15% ccds to the median(delta e) cut. These look like poor modeling where the residuals are equally scattered around the mean. A tighter cut on the median(delta e) value can also catch these. The fraction of bad objects is not a useful metric because some ccds have essentially constant ellipticity/size and therefore a scatter that is extremely small which can give rise to reasonably large outliers.
Hide
Bob Armstrong added a comment -

I think this is ready for review. Paul Price, will you have a chance to review this before you leave?

Show
Bob Armstrong added a comment - I think this is ready for review. Paul Price , will you have a chance to review this before you leave?
Hide
Paul Price added a comment -

Looks good to me. A couple of minor comments:

• Should the choice of shape (currently hard-coded as base_SdssShape) be configurable? Alternatively, could you use src.getShape(), which would remove the need for the ellipticity calculations because they could be done by lsst.afw.geom.ellipses?
• What needs to be done to use this code by default? Shouldn't we activate it in obs_subaru?
Show
Paul Price added a comment - Looks good to me. A couple of minor comments: Should the choice of shape (currently hard-coded as base_SdssShape ) be configurable? Alternatively, could you use src.getShape() , which would remove the need for the ellipticity calculations because they could be done by lsst.afw.geom.ellipses ? What needs to be done to use this code by default? Shouldn't we activate it in obs_subaru?
Hide
Bob Armstrong added a comment -

Merged

Show
Bob Armstrong added a comment - Merged

#### People

Assignee:
Bob Armstrong
Reporter:
Bob Armstrong
Watchers:
Bob Armstrong, Jim Bosch, Paul Price