IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 27, 2020, 2:21:31 PM (6 years ago)
Author:
tdeboer
Message:

gpc1 dynamic masks set up

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceIO_Glints.c

    r41349 r41367  
    7878    if (!REFSTAR_MASK_GLINTS) return true;
    7979
    80     // select the limiting magnitude
     80    // select relevant keywords
    8181    double GLINT_MAX_MAG = psMetadataLookupF32 (&status, recipe, "GLINT_MAX_MAG");
    8282    double GLINT_LENGTH_MAG_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_MAG_SLOPE");
    8383    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;
    8488    double GLINT_LENGTH_POS_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_POS_SLOPE");
     89    if (!status) { glintCheck = 1; }
    8590    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");
    8692    double GLINT_ANGLE_POS_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_ANGLE_POS_SLOPE");
    8793    double GLINT_ANGLE_POS_REF = psMetadataLookupF32 (&status, recipe, "GLINT_ANGLE_POS_REF");
    88     double glintWidth = psMetadataLookupF32 (&status, recipe, "GLINT_WIDTH");
     94
    8995    bool GLINT_OUTPUT = psMetadataLookupBool(&status, recipe, "PSASTRO.SAVE.GLINTS");
    9096    if (!GLINT_OUTPUT) return true;
     
    111117    // use the zero point and exposure time to convert to apparent mags: M_ap = M_inst + C_0 + 2.5*log(exptime)
    112118    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)) {
    114120        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    115121        return false;
     
    167173                }
    168174
     175                double glintLength = GLINT_LENGTH_MAG_SLOPE*(GLINT_LENGTH_MAG_ZERO - star->Mag);
    169176                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 pixels     
    180                 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                    }
    186193                }
    187194
     
    230237}
    231238
    232 
    233 bool psastroZeroPointFromRecipe (float *zeropt, float *exptime, float *ghostMaxMag, pmFPA *fpa, psMetadata *recipe) {
     239bool psastroZeroPointFromRecipeGlint (float *zeropt, float *exptime, float *ghostMaxMag, double *glintMaxMag, pmFPA *fpa, psMetadata *recipe) {
    234240
    235241    bool status;
     
    279285            psLogMsg ("psastro", PS_LOG_INFO, "found GHOST_MAX_MAG %f",*ghostMaxMag);
    280286        }
     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
    281296        //MEH what zpt is set to
    282297        psLogMsg ("psastro", PS_LOG_INFO, "found ZEROPT  %f",*zeropt);
Note: See TracChangeset for help on using the changeset viewer.