Project

General

Profile

SExtractor DETMODEL Tests

There have been some issues with SExtractor DETMODEL magnitudes that have been discussed with Emmanuel, as laid out below. I have done some testing on the new version of SExtractor (2.18.6) to confirm that they have indeed been fixed.

2.18.4 (prior to Feb 17,2013)

SExtractor 2.18.4 (and earlier) have 3 primary known problems with DETMODEL magnitudes:

  1. There is significant scatter in MAG_DETMODEL vs MAG_MODEL when the same detection and measurement image are used. These should be identical!
  2. The MAGERR_DETMODEL errors are significantly underestimated
  3. There is a segmentation fault when the first object is in the detection image but 100% masked in the measurement image.

MAG_DETMODEL vs. MAG_MODEL

Using SExtractor 2.18.4, when using the same detection and measurement image, there is a large scatter between MAG_DETMODEL and MAG_MODEL even at the bright end:

2.18.4 MAG_DETMODEL vs MAG_MODEL
Note these are uncalibrated magnitudes

While there is a class of objects where the two values are identical, this is not the case in general. This appeared to be because of a bad initial guess of the galaxy radius in the DETMODEL fitting code, causing the minimizer to get stuck in a local minimum. This was reported to Emmanuel and fixed in 2.18.6 (see below).

MAGERR_DETMODEL

As a simple test of the magnitude errors, I have looked at the variability of 10 single-epoch observations of the SPTW1 field in the i-band from November 19, 2012. (These are the same images I used for the Depth Measurements). As the detection image I took a simple coadd of these 10 epochs. For faster processing I took a 1000x1000 subregion from the center of each image. In total there are 213 galaxies that pass my quality cuts (SPREAD_MODEL > 0.002, FLAGS <=3, N_DET >= 8), where N_DET is the number of detections in the individual images (which will be <10 due to the dither pattern). For each galaxy I calculate an error-weighted average magnitude, and then calculate the chi^2 for the variability around this magnitude, such that chi^2 = sum [(m_i - mbar)^2/(sigma_i^2)], where m_i and sigma_i are the magnitude and error reported by SExtractor for each individual image. If the magnitude errors are correctly estimated than the ensemble of chi^2 values should form a chi^2 distribution with N_DET-1 degrees of freedom.

In the following figures I show the results of this test for MAG_AUTO and MAG_DETMODEL using SExtractor 2.18.4. The red curve is the expected distribution given the number of independent detections. It is clear that the MAG_AUTO errors are correctly estimated, while the MAG_DETMODEL errors are way too small.

2.18.4 MAG_AUTO test 2.18.4 MAG_DETMODEL test
MAG_AUTO chi^2 distribution -- looks good MAG_DETMODEL chi^2 distribution -- errors are way off

2.18.6

The subversion logs for 2.18.5 and 2.18.6 list several bug fixes and improvements pertaining to (a) the initial radius guess for DETMODEL magnitudes and (b) fixing the segmentation fault. Notably, as detailed below, the magnitude errors have also been fixed. This is excellent news!

MAG_DETMODEL vs. MAG_MODEL

In 2.18.5/6, Emmanuel updated the code that guesses the initial parameters for the DETMODEL model fitting. As seen here, the scatter is greatly reduced, especially at the bright end:

2.18.6 DETMODEL vs MODEL 2.18.6 MODEL vs AUTO
DETMODEL vs MODEL, outliers in red MODEL vs AUTO, DETMODEL outliers in red

However, there are some outliers. Visual inspection of the outliers in the plot shows that all of these are smudges where by my eye the model fit is bad. In fact, almost all of the significant outliers are also outliers in the MAG_MODEL vs MAG_AUTO (they also all have appropriately large MAG_MODEL errors). It is possible that some catalog cleaning can be done based on MODEL magnitudes that are significantly discrepant from AUTO magnitudes.

One slight issue to note is that there is a slight zero-point offset between MAG_AUTO and MAG_MODEL.

MAGERR_DETMODEL

Repeating the error tests from above with 2.18.6, shows that now the MAGERR_DETMODEL values are correct!

2.18.6 MAG_AUTO test 2.18.6 MAG_DETMODEL test
MAG_AUTO chi^2 distribution -- looks good MAG_DETMODEL chi^2 distribution -- also good!

This was a pleasant surprise, because no mention of this change is in the SVN logs. Looking at the file diffs, I see that the key change in profit.c/profit_dfit() was implemented in 2.18.5, where the following line was changed:

obj2->fluxerr_dprof = sumd!=0.0? 1.0f/sqrtf((float)sumd): 0.0f;

to

obj2->fluxerr_dprof = sumd!=0.0? dprofit->flux/sqrtf((float)sumd): 0.0f;

So there was a missing factor of "flux" there that is now in. And the errors look good. Hooray!

Segmentation Fault

I (and others) have confirmed that the segmentation fault for my bad test images has also been fixed.

-Eli