| | 1 | = Intro = |
| | 2 | |
| | 3 | == Input selection == |
| | 4 | |
| | 5 | == PSF Matching == |
| | 6 | |
| | 7 | == Pixel Rejection == |
| | 8 | |
| | 9 | The following conventions in the remainder of this discussion. Lower case values are for a single |
| | 10 | pixel on image "i", upper case values are values that are constant for |
| | 11 | a given image "i" (i.e., all pixels on image i have that parameter), |
| | 12 | greek values are combined values (the stacked values). |
| | 13 | |
| | 14 | # Set up |
| | 15 | For a given pixel, define four parameters: |
| | 16 | f_i pixel value |
| | 17 | v_i pixel variance value |
| | 18 | m_i input mask value, 0 = bad, 1 = good |
| | 19 | s_i suspect mask value, 0 = not suspect, 1 = suspect |
| | 20 | W_i image weight |
| | 21 | |
| | 22 | There are also a set of configurable options: |
| | 23 | NMIN = 5 Minimum number of values for KMM test |
| | 24 | MIN_UNI = 0.05 Minimum probability to accept a bimodal solution |
| | 25 | SYS_FRAC = 0.1 Systematic variance fraction |
| | 26 | NSIG_REJ = 3.5 N-sigma rejection threshold |
| | 27 | DISCARD = 0.2 Fraction of values to exclude in Olympic mean |
| | 28 | ITER = 0.5 Number of rejection iterations per input |
| | 29 | |
| | 30 | After convolution to the target PSF, we add an additional variance |
| | 31 | (ADDV_i) term equal to the chi^2 value found during the PSF matching. |
| | 32 | For 1d Gaussian convolution, we have no real concept of this value, so |
| | 33 | all chi^2 (and ADDV_i) are defined to be 1.0; |
| | 34 | |
| | 35 | v_i = v_i + ADDV_i |
| | 36 | |
| | 37 | The image weights are calculated by taking the inverse of the robust |
| | 38 | median of the variance image: |
| | 39 | |
| | 40 | W_i ~ 1 / sum_{x,y} v_i_{x,y} |
| | 41 | |
| | 42 | # Calulate initial stack values |
| | 43 | |
| | 44 | - Calculate the weighted mean: |
| | 45 | |
| | 46 | mu = sum_i( f_i * W_i) / sum_i(W_i) |
| | 47 | sigma = 1 / sum_i(1 / W_i) |
| | 48 | nu = sum_i(m_i) |
| | 49 | |
| | 50 | # Rejection loop |
| | 51 | |
| | 52 | This loop is repeated ITER * Ninput times (minimum of once). |
| | 53 | |
| | 54 | - Determine distribution values: |
| | 55 | |
| | 56 | if (nu > NMIN) do Mixture Model test: |
| | 57 | mu_KMM mean of most popular gaussian mode |
| | 58 | sigma_KMM sigma of most popular gaussian mode |
| | 59 | pi_KMM fraction of inputs in most popular gaussian mode |
| | 60 | rho_UNI Probability that inputs are unimodal |
| | 61 | |
| | 62 | - Set rejection limits for each input: |
| | 63 | |
| | 64 | if (nu > NMIN) sys_var = sigma_KMM^2 |
| | 65 | else sys_var = SYS_FRAC * f_i |
| | 66 | |
| | 67 | limit_i = (NSIG_REJ)^2 * (v_i + sys_var) |
| | 68 | |
| | 69 | - Determine distribution median |
| | 70 | |
| | 71 | if (nu > NMIN) mu_median = mu_KMM |
| | 72 | else mu_median = olympic_mean |
| | 73 | where: |
| | 74 | olympic_mean = sum_i(f_i * W_i) / sum_i(W_i) |
| | 75 | from int((DISCARD * nu + 0.5)/2.0) |
| | 76 | to int((DISCARD * nu + 0.5)/2.0) + int(nu) - int(DISCARD * nu + 0.5) |
| | 77 | |
| | 78 | - Determine most discrepant point |
| | 79 | |
| | 80 | if ( (f_i - mu_median)^2 > limit_i ) AND |
| | 81 | ( (f_i - mu_median)^2 / limit_i > delta ) THEN |
| | 82 | delta = (f_i - mu_median)^2 / limit_i |
| | 83 | delta_index = i |
| | 84 | |
| | 85 | - Do rejection. If we have suspect pixels, throw those out first (so |
| | 86 | they'll be skipped in the next iteration). Otherwise, remove the |
| | 87 | most discrepant point |
| | 88 | |
| | 89 | if DEFINED(dev_i) |
| | 90 | if (s_i != 0) m_i = 0 |
| | 91 | else if (i = delta_index) m_i = 0 |
| | 92 | |
| | 93 | - End rejection loop. |
| | 94 | |
| | 95 | |
| | 96 | This completes the initial stack stage of ppStack. We then use the |
| | 97 | set of rejected pixels to identify the source pixels in the |
| | 98 | unconvolved input images. These are masked out, and the images are |
| | 99 | reconvolved and a final stack is constructed using the same algorithm, |
| | 100 | however the rejection loop is skipped (so the weighted mean is all |
| | 101 | that is performed). |
| | 102 | |
| | 103 | |
| | 104 | == Output Products == |
| | 105 | |