Changeset 41367 for trunk/psModules/src/objects/pmSourceIO_Glints.c
- Timestamp:
- May 27, 2020, 2:21:31 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmSourceIO_Glints.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmSourceIO_Glints.c
r41349 r41367 78 78 if (!REFSTAR_MASK_GLINTS) return true; 79 79 80 // select the limiting magnitude80 // select relevant keywords 81 81 double GLINT_MAX_MAG = psMetadataLookupF32 (&status, recipe, "GLINT_MAX_MAG"); 82 82 double GLINT_LENGTH_MAG_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_MAG_SLOPE"); 83 83 double GLINT_LENGTH_MAG_ZERO = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_MAG_ZERO"); 84 double glintWidth = psMetadataLookupF32 (&status, recipe, "GLINT_WIDTH"); 85 86 //we will use one of the new keywords to differentiate between an old and new style glint treatment 87 float glintCheck = 0; 84 88 double GLINT_LENGTH_POS_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_POS_SLOPE"); 89 if (!status) { glintCheck = 1; } 85 90 double GLINT_LENGTH_POS_REF = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_POS_REF"); 91 double GLINT_LENGTH_POS_CUT = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_POS_CUT"); 86 92 double GLINT_ANGLE_POS_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_ANGLE_POS_SLOPE"); 87 93 double GLINT_ANGLE_POS_REF = psMetadataLookupF32 (&status, recipe, "GLINT_ANGLE_POS_REF"); 88 double glintWidth = psMetadataLookupF32 (&status, recipe, "GLINT_WIDTH"); 94 89 95 bool GLINT_OUTPUT = psMetadataLookupBool(&status, recipe, "PSASTRO.SAVE.GLINTS"); 90 96 if (!GLINT_OUTPUT) return true; … … 111 117 // use the zero point and exposure time to convert to apparent mags: M_ap = M_inst + C_0 + 2.5*log(exptime) 112 118 pmFPA *fpa_ast = astrom->fpa; 113 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, fpa_ast, recipe)) {119 if (!psastroZeroPointFromRecipeGlint (&zeropt, &exptime, NULL,&GLINT_MAX_MAG, fpa_ast, recipe)) { 114 120 psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe"); 115 121 return false; … … 167 173 } 168 174 175 double glintLength = GLINT_LENGTH_MAG_SLOPE*(GLINT_LENGTH_MAG_ZERO - star->Mag); 169 176 double glintAngle = 0; 170 //compute the angle of the glint, which depends on position parallel to the FPX 171 if (!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM") ){ 172 glintAngle = PM_RAD_DEG * (GLINT_ANGLE_POS_SLOPE*((GLINT_ANGLE_POS_REF - star->FP->x)/1000.)); 173 } 174 if (!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT") ) { 175 glintAngle = PM_RAD_DEG * (GLINT_ANGLE_POS_SLOPE*((GLINT_ANGLE_POS_REF - star->FP->y)/1000.));176 } 177 178 double glintLength = GLINT_LENGTH_MAG_SLOPE*(GLINT_LENGTH_MAG_ZERO - star->Mag); 179 //Besides brightness, the length of the glints also depends on the position of the star compared to the focal plane. But, seemingly only for stars closer than 30k pixels180 if ((!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM")) && abs(star->FP->y) < 30000){181 glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->y));182 183 } 184 if ((!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT")) && abs(star->FP->x) < 30000 ) { 185 glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->x));177 178 //Besides brightness, the length of the glints also depends on the position of the star compared to the focal plane. But, seemingly only for stars closer than about 30k pixels 179 if(glintCheck) { 180 if ((!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM")) && abs(star->FP->y) < GLINT_LENGTH_POS_CUT ){ 181 glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->y)); 182 } 183 if ((!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT")) && abs(star->FP->x) < GLINT_LENGTH_POS_CUT ) { 184 glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->x)); 185 } 186 //also compute the angle of the glint, which depends on position parallel to the FPX 187 if (!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM") ){ 188 glintAngle = PM_RAD_DEG * (GLINT_ANGLE_POS_SLOPE*((GLINT_ANGLE_POS_REF - star->FP->x)/1000.)); 189 } 190 if (!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT") ) { 191 glintAngle = PM_RAD_DEG * (GLINT_ANGLE_POS_SLOPE*((GLINT_ANGLE_POS_REF - star->FP->y)/1000.)); 192 } 186 193 } 187 194 … … 230 237 } 231 238 232 233 bool psastroZeroPointFromRecipe (float *zeropt, float *exptime, float *ghostMaxMag, pmFPA *fpa, psMetadata *recipe) { 239 bool psastroZeroPointFromRecipeGlint (float *zeropt, float *exptime, float *ghostMaxMag, double *glintMaxMag, pmFPA *fpa, psMetadata *recipe) { 234 240 235 241 bool status; … … 279 285 psLogMsg ("psastro", PS_LOG_INFO, "found GHOST_MAX_MAG %f",*ghostMaxMag); 280 286 } 287 if (glintMaxMag) { 288 float MaxMag = psMetadataLookupF32 (&status, refItem->data.md, "GLINT_MAX_MAG"); 289 if (status) { 290 *glintMaxMag = MaxMag ; 291 //MEH null is a pain.. so only log if set 292 psLogMsg ("psastro", PS_LOG_INFO, "found GLINT_MAX_MAG %f",*glintMaxMag); 293 } 294 } 295 281 296 //MEH what zpt is set to 282 297 psLogMsg ("psastro", PS_LOG_INFO, "found ZEROPT %f",*zeropt);
Note:
See TracChangeset
for help on using the changeset viewer.
