# Estimating Galaxy Completeness and Fstar¶

Playing around with cross-correlation to estimate galaxy completeness and fstar, and applying to ngmix and modest.

-Eli Rykoff and Eduardo Rozo

## The Idea¶

Stars should correlate with stars, galaxies should not.

### The Formalism¶

let n_0 = n_g + n_*, where we've selected some objects that are a mix of stars and galaxies.

n_0 = <n_g>(1+delta_g) + <n_*>(1+delta_*)

(1+delta) = <n_g>/<n_0>(1+delta_g) + <n_*>/<n_0>(1+delta_*)

= (1-f_star)(1+delta_g) + f_* (1+delta_*) = 1 + (1-f_*)(delta_g) + f_* delta_*

delta = (1+f_*)delta_g + f_* delta_*

Where we've broken things into a fraction of stars ("f_*") in the original sample.

We can now measure the correlation function of our object selection with some "sure stars", which we denote as "s" rather than "*".

w = <delta_obs delta_s> = f_* <delta_* delta_s>

If we assume that <delta_* delta_s> == <delta_s delta_s>, that is that the correlation of our stellar contamination with the true stars is the same as the auto-correlation of true stars, then we can use the correlation of our test sample with "sure" stars to estimate the fraction of stars in that sample.

Furthermore, if we make a very **generous** cut on the galaxy selection, (eg modest class with nsig~5) then we can assume that this generous cut contains all the galaxies in the sample (with a high stellar contamination of course!). But then we have

ngal_tot = n_generous (1-f_*,generous)

And for any given cut, with fstar, we can then estimate the galaxy completeness for that cut as well!

## The Problems¶

Which "sure" stars to use? Bright? Faint? We're finding worrying differences so maybe this won't work after all. Though it is an interesting comparison between different selections (see below). There's also some residual systematic on the 1-10 arcminute scale even at the bright end. We adjust the numbers so that the fstar for the brightest (sure) galaxy sample is 0 (see below). Maybe not the best thing to do.

## The Data¶

We use the SPTE footprint from ngmix, where limiting mag > 23.0. Sure stars are MODEST_CLASS == 2 AND ngmix EXP_T_S2N < 1 AND EXP_T < 1.0 AND 21.5 < NGMIX['EXP_MAG_I'] < 22.5. Relatively faint, but still in a regime where we can get a good selection. Bad objects (to be described in detail) and regions around bright 2mass stars are removed from the data and the mask.

The galaxy selection is done with two modest-like classifiers, one for ngmix size (exp_t) and one with spread_model.

- EXP_T + nsig*EXP_T_ERR > 0.02
- SPREAD_MODEL_I + nsig*SPREADERR_MODEL_I > 0.003

## Results¶

Raw correlation functions, with ngmix nsig=0 | Ratio with stellar auto-correlation |

The correlation ratio looks reasonably flat from 1-10 arcminute. Notice the negative correlation ratio for the brightest galaxies. We adjust this by hand to be zero and shift all the ratios for the fainter galaxies by the same amount.

Now, looking at the completeness (1-C is the solid line) and f_* (dashed line) for each. (Sorry that the faintest objects, which may be affected by variations in the map, are not plotted for the modest classifier):

ngmix009 | Spread model (modest-style) |

You can see that for MODEST, the fainter galaxies have as much as 10-15% stellar contamination! (Consistent with the redMaGiC tests, actually.) There is also no simple cut that really works for both completeness and fstar very well. We need to go probabilistic. Also not sure why the mid range completeness is estimated to be less than 100%.

In the meantime, I will be testing redMaGiC with ngmix nsig=1...