IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 8, 2021, 3:40:00 PM (5 years ago)
Author:
eugene
Message:

merge changes from tags/ipp-ps1-20210510: improve crosstalk and ghost analysis

Location:
trunk/psastro
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro

  • trunk/psastro/src/psastroLoadGhosts.c

    r41434 r41657  
    120120
    121121    //We need to check whether we are dealing with an old style ghost_model, or a new style model. Check if the mirror_rad polynomial exists
    122     float mirCheck = 0;
     122    int mirCheck = 0;
    123123    md = psMetadataLookupMetadata (&status, ghostModel, "GHOST.MIRROR.RAD");
    124124    if (!md) { psLogMsg ("psastro", PS_LOG_INFO, "No ghost mirror_rad polynomial found. Assuming old-style ghost masking"); }
     
    144144    pmFPA *fpa = astrom->fpa;
    145145
     146    // select the reference mask fpa :: we use this to determine cell boundaries
     147    pmFPAfile *refMask = psMetadataLookupPtr (NULL, config->files, "PSASTRO.REFMASK");
     148    if (!refMask) {
     149      psError(PSASTRO_ERR_CONFIG, true, "Can't find mask reference");
     150      return false;
     151    }
     152    // Activate the reference mask to generate an FPA structure we can use to map stars down to cells
     153    pmFPAfileActivate (config->files, false, NULL);
     154    pmFPAfileActivate (config->files, true, "PSASTRO.REFMASK");
     155
    146156    // raise an error if the config is broken
    147157    if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &INSTR_MAX_MAG, NULL, fpa, recipe)) {
     
    161171        if (!chip->fromFPA) { continue; }
    162172
     173        // Get the current chip's name, and parse out the grid location.
     174        pmChip *refChip  = pmFPAviewThisChip (view, refMask->fpa);
     175        const char *chipName = psMetadataLookupStr(NULL,refChip->concepts, "CHIP.NAME");
     176        int X = chipName[2] - '0';
     177        int Y = chipName[3] - '0';
     178
     179        //Check if we are in the central 8 chips, where old ghost-style locations work better
     180        int cenChip = 0;
     181        if ( (Y >= 3)&&(Y <=4)&&(X >= 2)&&(X <= 5) ) {cenChip = 0;}
     182
    163183        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
    164184            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     
    188208
    189209                    double rSrc = hypot (cal->FP->x, cal->FP->y);
    190                     double theta0 = atan2(cal->FP->x,cal->FP->y);
    191 
    192                     if(mirCheck) {
     210                    double theta0 = atan2(cal->FP->y,cal->FP->x);
     211
     212                    if((mirCheck) & (!cenChip)) {
    193213                         //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle
    194214                        double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc);
     
    200220                        ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
    201221                    } 
    202                     if(!mirCheck) {
     222                    if((!mirCheck) | cenChip) {
    203223                        //Use the old-style ghost position determination
    204224                        ghost->FP->x = -cal->FP->x + psPolynomial2DEval(centerX, -cal->FP->x, -cal->FP->y);
     
    312332                    double theta0 = atan2(ref->FP->y,ref->FP->x);
    313333
    314                     if(mirCheck) {
     334                    if((mirCheck) & (!cenChip)) {
    315335                         //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle
    316336                        double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc);
     
    322342                        ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
    323343                    } 
    324                     if(!mirCheck) {
     344                    if((!mirCheck) | cenChip) {
    325345                        //Use the old-style ghost position determination
    326346                        ghost->FP->x = -ref->FP->x + psPolynomial2DEval(centerX, -ref->FP->x, -ref->FP->y);
Note: See TracChangeset for help on using the changeset viewer.