IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41809 for trunk


Ignore:
Timestamp:
Sep 14, 2021, 2:17:39 PM (5 years ago)
Author:
tdeboer
Message:

changes to glint angle masking, for better resolution at small angles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroLoadGlints.c

    r41705 r41809  
    5252    double GLINT_LENGTH_POS_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_POS_SLOPE");
    5353    if (!status) {
    54         psLogMsg ("psastro", PS_LOG_INFO, "Assuming old-style glint masking, given the recipe keywords");
     54        psLogMsg ("psastro", PS_LOG_INFO, "Assuming old-style glint masking");
    5555        glintCheck = 1;
    5656    }
     
    150150
    151151            //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
    152             if(glintCheck) {
     152            if(!glintCheck) {
    153153                if ((!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM")) && abs(star->FP->y) < GLINT_LENGTH_POS_CUT ){
    154154                  glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->y));
     
    246246                        pmChip *chip = fpa->chips->data[nChip];
    247247                        if (!chip) {continue;}
     248                        const char *chipName = psMetadataLookupStr(NULL,chip->concepts, "CHIP.NAME");
     249                        int X = chipName[2] - '0';
    248250
    249251                        if (!psastroFindChipInXrange (fpa, nChip, x_glint->data.F32[glint_point], y_glint->data.F32[glint_point])) {
     
    255257                        psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip);
    256258
     259                        //For ease of reference, we adopt a frame in which coords with 0 are always lower in the relevant axis
    257260                        if (yFPAs > yFPAe) PS_SWAP (yFPAs, yFPAe);
    258261                        if (yFPA0 > yFPA1) {
     
    265268                        if (yFPA1 < yFPAs) {continue;}
    266269
    267 
    268270                        //find the y-coord positions for this chip
    269271                        double ycFPA0, ycFPA1;
     
    272274
    273275                        //now calculate the proper x-coord positions given the angle, for this chip
    274                         double xcFPA0, xcFPA1, angle;
     276                        double xcFPA0, xcFPA1, angle, chip_angle, glint_length;
    275277                        angle = atan2(xFPA1 - xFPA0,yFPA1 - yFPA0);
    276278                        xcFPA0 = xFPA0 + (ycFPA0-yFPA0)*tan(angle);
    277                         xcFPA1 = xFPA0 + (ycFPA1-yFPA0)*tan(angle);
    278                        
    279 
    280                         double xChip0, yChip0, xChip1, yChip1, chip_angle, glint_length, xChip2,yChip2;
    281                         psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA0, ycFPA0);
    282                         psastroFPAtoChip (&xChip1, &yChip1, fpa, nChip, xcFPA1, ycFPA1);
    283                         psastroFPAtoChip (&xChip2, &yChip2, fpa, nChip, star->FP->x,star->FP->y);
    284 
    285                         chip_angle = atan2(yChip1 - yChip0, xChip1 - xChip0);
    286                         glint_length = sqrt(pow(yChip1 - yChip0,2) + pow(xChip1 - xChip0,2));
     279                        xcFPA1 = xFPA0 + (ycFPA1-yFPA0)*tan(angle);     
     280
     281                        //use this to calculate the actual glint length as it wll be on this chip
     282                        glint_length = sqrt(pow(ycFPA1 - ycFPA0,2) + pow(xcFPA1 - xcFPA0,2));
     283
     284                        //also get the proper orientation of the glint angle, and determine the starting position on this chip. Remember that half of the focal plane is flipped
     285                        double xChip0, yChip0;
     286                        if (!strcasecmp(glintType, "TOP")) {
     287                          if(X<=3){
     288                            chip_angle = PM_RAD_DEG * (-90. - glintAngle/PM_RAD_DEG);
     289                          } else {
     290                            chip_angle = PM_RAD_DEG * (90. - glintAngle/PM_RAD_DEG);
     291                          }
     292                          psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA1, ycFPA1);
     293                        }
     294                        if (!strcasecmp(glintType, "BOTTOM")) {
     295                          if(X<=3){
     296                            chip_angle = PM_RAD_DEG * (glintAngle/PM_RAD_DEG +90.);
     297                          } else {
     298                            chip_angle = PM_RAD_DEG * (glintAngle/PM_RAD_DEG -90.);
     299                          }
     300                          psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA0, ycFPA0);
     301                        }
    287302
    288303                        // select the 0th readout of the 0th cell for this chip
     
    403418                        psastroFindChipXedges (&xFPAs, &xFPAe, fpa, nChip);
    404419
     420                        //For ease of reference, we adopt a frame in which coords with 0 are always lower in the relevant axis
    405421                        if (xFPAs > xFPAe) PS_SWAP (xFPAs, xFPAe);
    406422                        if (xFPA0 > xFPA1) {
     
    419435
    420436                        //now calculate the proper x-coord positions given the angle, for this chip
    421                         double ycFPA0, ycFPA1, angle;
     437                        double ycFPA0, ycFPA1, angle, chip_angle, glint_length;
    422438                        angle = atan2(xFPA1 - xFPA0,yFPA1 - yFPA0);
    423439                        ycFPA0 = yFPA0 + (xcFPA0-xFPA0)/tan(angle);
    424440                        ycFPA1 = yFPA0 + (xcFPA1-xFPA0)/tan(angle);
    425441
    426                         double xChip0, yChip0, xChip1, yChip1, chip_angle, glint_length,xChip2,yChip2;
    427                         psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA0, ycFPA0);
    428                         psastroFPAtoChip (&xChip1, &yChip1, fpa, nChip, xcFPA1, ycFPA1);
    429                         psastroFPAtoChip (&xChip2, &yChip2, fpa, nChip, star->FP->x,star->FP->y);
    430 
    431                         chip_angle = atan2(yChip1 - yChip0, xChip1 - xChip0);
    432                         glint_length = sqrt(pow(yChip1 - yChip0,2) + pow(xChip1 - xChip0,2));
     442                        //use this to calculate the actual glint length as it wll be on this chip
     443                        glint_length = sqrt(pow(ycFPA1 - ycFPA0,2) + pow(xcFPA1 - xcFPA0,2));
     444
     445                        //also get the proper orientation of the glint angle, and determine the starting position on this chip. Remember that half of the focal plane is flipped
     446                        double xChip0, yChip0;
     447                        if (!strcasecmp(glintType, "LEFT")) {
     448                          chip_angle = PM_RAD_DEG * (180. - glintAngle/PM_RAD_DEG);
     449                          psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA0, ycFPA0);
     450                        }
     451                        if (!strcasecmp(glintType, "RIGHT")) {
     452                          chip_angle = PM_RAD_DEG * (glintAngle/PM_RAD_DEG +180.);
     453                          psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA1, ycFPA1);
     454                        }
    433455
    434456                        // select the 0th readout of the 0th cell for this chip
Note: See TracChangeset for help on using the changeset viewer.