Changeset 41803 for branches/eam_branches/ipp-dev-20210817
- Timestamp:
- Sep 2, 2021, 11:31:43 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-dev-20210817/psModules/src/detrend/pmPattern.c
r41743 r41803 9 9 #define PATTERN_ROW_BKG_FIX 1 10 10 11 /* some in-line notes: 12 13 patternMaskRow sets the data value to NAN, inconsistent with new plan 14 15 here is the outline of pmPatternRow 16 17 * at this point, we have already done overscan subtraction, right? 18 19 * measure stats on the full cell (MEDIAN, STDEV) 20 ** subsample? 21 ** if it fails, it masks the entire cell and set the value to NAN 22 23 * calculate an upper and lower threshold (median +/- T * sigma) 24 * define a normalized x-coordinate ('index') : 25 ** see note below on chebys 26 27 * each row is treated independently 28 * pixels are masked for the fit if they are out-of-range 29 or if they are already masked 30 31 ** note that the clipping threshold will be larger if there 32 are pixels which have astronomical structures 33 34 a possible better option would be to set the threshold based on the median 35 and a sigma calculated from Poisson stats (do we know the gain?) 36 37 ** fit is allowed to proceed if even N+1 pixels exist, which is clearly too low 38 39 ** Remaining pixels are fitted with clip-fit 40 41 ** solution is subtracted from the data 42 (this is implemented with psPolynomial1DEvalVector) 43 perhaps faster if we fixed the order to 2 and hardwired the result 44 45 * after each row is fitted, the intercept (A value) is fitted 46 as a function of the y-coordinate and the result is subtracted 47 48 * the slope value is also fitted as a function of the column 49 and added back in -- I'm not sure I understand this step. 50 51 ***************** 52 53 ** what we calculate are related to chebychevs (domain is -1 : +1) 54 *** T0(x) = 1 55 *** T1(x) = x 56 *** T2(x) = 2x^2 - 1 57 58 *** we calculate y = A + Bx + Cx^2 59 60 a_0 + a_1 x + a_2 (2x^2 - 1) = A + B + Cx^2 61 62 a_1 = B 63 a_0 - a_2 = A 64 2 a_2 = C 65 66 a_0 = A + C/2 67 a_1 = B 68 a_2 = C/2 69 70 ***************** 71 72 I have 3 goals in re-working the code: 73 74 1) improve overall speed 75 2) improve reliability of the fit 76 3) skip fit if we can 77 78 Let's assume the signal in the cell is light + bias drift 79 80 The bias drift has an amplitude of ~5 - 10 DN 81 82 That makes a detectable source with ~N * a few counts (multiple pixels in a row) 83 84 So, the effective flux is ~10 * 5 = 50 DN 85 for which sky level is this value - 3 sigma? 86 87 50 / sqrt(sky sigma^2 * effective area) 88 89 area ~ 5pixels, sky sigma^2 = sky 90 91 10 * Npix / sqrt(sky * Npix) = 3 92 93 Npix = sky * (S/N)^2 / (peak^2) 94 95 sky = Npix * peak^2 / SN^2 96 97 if (sky < Npix * peak^2 / SN^2), we should skip: 98 99 Npix ~ 5 100 peak ~ 10 101 SN ~ 3 (or even less) 102 103 sky < 5 * 100 / 9 = 55 or so 104 105 */ 11 106 12 107 // Mask a row as bad
Note:
See TracChangeset
for help on using the changeset viewer.
