- Timestamp:
- Mar 29, 2009, 6:15:31 PM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090301
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090301
-
branches/cnb_branches/cnb_branch_20090301/ppStack
- Property svn:mergeinfo changed
/trunk/ppStack merged: 23357,23360,23362,23364,23367-23368,23371-23373,23379,23462,23573,23575-23577
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090301/ppStack/src/ppStackSources.c
r23352 r23594 9 9 //#define TESTING // Enable debugging output 10 10 11 #ifdef TESTING 11 12 // Size of fake image; set by hand because it's trouble to get it from other places 12 13 #define FAKE_COLS 4861 13 14 #define FAKE_ROWS 4913 15 #endif 14 16 15 17 #ifdef TESTING … … 53 55 54 56 55 float ppStackSourcesTransparency(const psArray *sourceLists, psVector *inputMask, 56 const pmFPAview *view, const pmConfig *config) 57 bool ppStackSourcesTransparency(ppStackOptions *options, const pmFPAview *view, const pmConfig *config) 57 58 { 58 PS_ASSERT_ARRAY_NON_NULL(sourceLists, NAN); 59 PS_ASSERT_VECTOR_NON_NULL(inputMask, NAN); 60 PS_ASSERT_VECTOR_TYPE(inputMask, PS_TYPE_U8, NAN); 61 PS_ASSERT_VECTOR_SIZE(inputMask, sourceLists->n, NAN); 62 PS_ASSERT_PTR_NON_NULL(view, NAN); 63 PS_ASSERT_PTR_NON_NULL(config, NAN); 59 PS_ASSERT_PTR_NON_NULL(options, false); 60 PS_ASSERT_PTR_NON_NULL(view, false); 61 PS_ASSERT_PTR_NON_NULL(config, false); 62 63 psArray *sourceLists = options->sourceLists; // Source lists for each input 64 psVector *inputMask = options->inputMask; // Mask for inputs 65 66 PS_ASSERT_ARRAY_NON_NULL(sourceLists, false); 67 PS_ASSERT_VECTOR_NON_NULL(inputMask, false); 68 PS_ASSERT_VECTOR_TYPE(inputMask, PS_TYPE_U8, false); 69 PS_ASSERT_VECTOR_SIZE(inputMask, sourceLists->n, false); 64 70 65 71 #if defined(TESTING) && 0 … … 100 106 if (!airmassZP) { 101 107 psError(PS_ERR_UNKNOWN, false, "Unable to find ZP.AIRMASS in recipe."); 102 return NAN;108 return false; 103 109 } 104 110 … … 139 145 exptime, airmass, expFilter); 140 146 psFree(zp); 141 return NAN;147 return false; 142 148 } 143 149 … … 149 155 "Unable to find airmass term (ZP.AIRMASS) for filter %s", filter); 150 156 psFree(zp); 151 return NAN;157 return false; 152 158 } 153 159 } else if (strcmp(filter, expFilter) != 0) { 154 160 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Filters don't match: %s vs %s", filter, expFilter); 155 161 psFree(zp); 156 return NAN;162 return false; 157 163 } 158 164 … … 160 166 sumExpTime += exptime; 161 167 } 168 169 options->sumExposure = sumExpTime; 162 170 163 171 psArray *matches = pmSourceMatchSources(sourceLists, radius, true); // List of matches … … 165 173 psError(PS_ERR_UNKNOWN, false, "Unable to match sources"); 166 174 psFree(zp); 167 return NAN;175 return false; 168 176 } 169 177 … … 177 185 if (!trans) { 178 186 psError(PS_ERR_UNKNOWN, false, "Unable to measure transparencies"); 179 return NAN;187 return false; 180 188 } 181 189 … … 186 194 for (int i = 0; i < trans->n; i++) { 187 195 if (!isfinite(trans->data.F32[i])) { 188 inputMask->data.U8[i] = PPSTACK_MASK_CAL;196 inputMask->data.U8[i] |= PPSTACK_MASK_CAL; 189 197 } 190 198 } … … 223 231 // m_0 = m_1 + zp_1 + trans_1 - c1 * airmass_0 - 2.5log(t_0) 224 232 // We don't need to know the magnitude zero point for the filter, since it cancels out 233 options->norm = psVectorAlloc(num, PS_TYPE_F32); 225 234 for (int i = 0; i < num; i++) { 226 235 if (!isfinite(trans->data.F32[i])) { … … 229 238 psArray *sources = sourceLists->data[i]; // Sources of interest 230 239 float magCorr = airmassTerm - 2.5*log10(sumExpTime) - zp->data.F32[i] - trans->data.F32[i]; 240 options->norm->data.F32[i] = magCorr; 231 241 psLogMsg("ppStack", PS_LOG_INFO, "Applying magnitude correction to image %d: %f\n", i, magCorr); 232 242 … … 248 258 psError(PS_ERR_UNKNOWN, false, "Unable to match sources"); 249 259 psFree(zp); 250 return NAN;260 return false; 251 261 } 252 262 psVector *trans = pmSourceMatchRelphot(matches, zp, iter, tol, starLimit, transIter, transRej, … … 259 269 #endif 260 270 261 return sumExpTime;271 return true; 262 272 }
Note:
See TracChangeset
for help on using the changeset viewer.
