IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33851


Ignore:
Timestamp:
May 8, 2012, 5:30:49 PM (14 years ago)
Author:
watersc1
Message:

Crosstalk spike masking and improved ghost model application.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippconfig/gpc1/psastro.config

    r33668 r33851  
    130130  ZEROPT   F32 24.563
    131131  PHOTCODE STR g
    132   GHOST_MAX_MAG                   F32 -20.0
     132  GHOST_MAX_MAG                   F32 -18.0
    133133END
    134134PHOTCODE.DATA METADATA
  • trunk/psastro/src/psastroLoadCrosstalk.c

    r26826 r33851  
    5353  pmFPAview *viewMask = pmFPAviewAlloc (0);
    5454
    55   float zeropt, exptime, MAX_MAG;
     55  float zeropt, exptime, MAX_MAG, SPIKE_MAX_MAG;
    5656
    5757  psLogMsg ("psastro", PS_LOG_INFO, "determine crosstalk positions");
     
    105105  MAX_MAG += MagOffset;
    106106
     107  // Get the spike maximum, as well
     108  SPIKE_MAX_MAG = psMetadataLookupF32(&status, recipe, "REFSTAR_MASK_BLEED_MAG_MAX");
     109  SPIKE_MAX_MAG += MagOffset;
     110 
    107111  psTrace("psastro.crosstalk",2,"%f %f %f %f\n",zeropt,exptime,MAX_MAG,MagOffset);
    108112
     
    259263
    260264            pmAstromObj *crosstalk = pmAstromObjAlloc();
    261 
     265           
    262266            crosstalk->Mag = ref->Mag - MagOffset;
    263267            crosstalk->chip->x = x_t_chip;
     
    274278            }
    275279            psArrayAdd(crosstalks,100,crosstalk);
    276 
     280           
    277281            psFree(targetChipName);
    278282            psFree(targetCellName);
    279283            psFree(crosstalk);
     284
     285            // Determine if we need to add a spike mask.
     286/*          psWarning("BLAH: %g %g %g\n",ref->Mag,MagOffset,SPIKE_MAX_MAG); */
     287            if (ref->Mag < SPIKE_MAX_MAG) {
     288              if ((X == 2)&&(! ((U == 3)||(U == 5)||(U == 6)))) {
     289                psTrace ("psastro.crosstalk",2,"Cell (%d%d) on chip (%d%d) not a known crosstalk source.",U,V,X,Y);
     290                continue;
     291              }
     292              if ((X == 3)&&(! ((U == 3)))) {
     293                psTrace ("psastro.crosstalk",2,"Cell (%d%d) on chip (%d%d) not a known crosstalk source.",U,V,X,Y);
     294                continue;
     295              }
     296              if ((X == 4)&&(! ((U == 3)))) {
     297                psTrace ("psastro.crosstalk",2,"Cell (%d%d) on chip (%d%d) not a known crosstalk source.",U,V,X,Y);
     298                continue;
     299              }
     300              if ((X == 5)&&(! ((U == 3)||(U == 5)||(U == 6)))) {
     301                psTrace ("psastro.crosstalk",2,"Cell (%d%d) on chip (%d%d) not a known crosstalk source.",U,V,X,Y);
     302                continue;
     303              }
     304             
     305              Xt = X;
     306              Yt = Y;
     307              Vt = V;
     308             
     309              for (Ut = 0; Ut < 8; Ut++) {
     310
     311                psString targetChipName = NULL;
     312                psStringAppend(&targetChipName,"XY%d%d",Xt,Yt);
     313                psString targetCellName = NULL;
     314                psStringAppend(&targetCellName,"xy%d%d",Ut,Vt);
     315               
     316                psTrace ("psastro.crosstalk",2,"CTsource @ OTA%d%dxy%d%d@%f,%f CTtarget OTA%d%dxy%d%d@%f,%f [%s %s]",
     317                         X,Y,U,V,x_cell,y_cell,Xt,Yt,Ut,Vt,x_t_cell,y_t_cell,
     318                         targetChipName,targetCellName);
     319/*              psWarning ("CT bleed ct @ OTA%d%dxy%d%d@%f,%f CTtarget OTA%d%dxy%d%d@%f,%f [%s %s]", */
     320/*                       X,Y,U,V,x_cell,y_cell,Xt,Yt,Ut,Vt,x_t_cell,y_t_cell, */
     321/*                       targetChipName,targetCellName); */
     322               
     323                pmCell *CTtargetCell = getCellByName (CTsourceChip,targetCellName);
     324                if (!CTtargetCell) continue;
     325               
     326                pmChipCoordsForCell(&x_t_chip,&y_t_chip,CTtargetCell,x_t_cell,y_t_cell);
     327
     328                psTrace ("psastro.crosstalk",2,"CTsource @ OTA%d%dxy%d%d@%f,%f CTtarget OTA%d%dxy%d%d@%f,%f ChipLoc: (%f,%f)",
     329                         X,Y,U,V,x_cell,y_cell,Xt,Yt,Ut,Vt,x_t_cell,y_t_cell,x_t_chip,y_t_chip);
     330               
     331                // Hunt down the readout for the target, and save the chip position and magnitude of source star.
     332                pmChip *targetChip = getChipByName(fpa,targetChipName);
     333                if (!targetChip) continue;
     334                if (!targetChip->cells) continue;
     335                if (!targetChip->cells->n) continue;
     336               
     337                pmCell *targetCell = targetChip->cells->data[0];
     338                if (!targetCell) continue;
     339                if (!targetCell->readouts) continue;
     340                if (!targetCell->readouts->n) continue;
     341                pmReadout *targetReadout = targetCell->readouts->data[0];
     342                if (!targetReadout) continue;
     343               
     344                pmAstromObj *crosstalk = pmAstromObjAlloc();
     345               
     346                crosstalk->Mag = ref->Mag;
     347                crosstalk->chip->x = x_t_chip;
     348                crosstalk->chip->y = y_t_chip;
     349               
     350                psArray *crosstalks = psMetadataLookupPtr (&status, targetReadout->analysis, "PSASTRO.CROSSTALKS.SPIKES");
     351                if (crosstalks == NULL) {
     352                  crosstalks = psArrayAllocEmpty(100);
     353                  if (!psMetadataAdd(targetReadout->analysis,PS_LIST_TAIL,"PSASTRO.CROSSTALKS.SPIKES", PS_DATA_ARRAY, "crosstalk locations", crosstalks)) {
     354                    psError(PSASTRO_ERR_CONFIG, false, "failure to add crosstalks to readout");
     355                    goto escape;
     356                  }
     357                  psFree(crosstalks);
     358                }
     359                psArrayAdd(crosstalks,100,crosstalk);
     360               
     361                psFree(targetChipName);
     362                psFree(targetCellName);
     363                psFree(crosstalk);
     364              }
     365            } // End satspike crosstalks
     366
     367           
    280368          } // refstars
    281369        } // readout
  • trunk/psastro/src/psastroLoadGhosts.c

    r26259 r33851  
    128128                for (int i = 0; i < refstars->n; i++) {
    129129                    pmAstromObj *ref = refstars->data[i];
     130                    psTrace("psastro.ghost",5,"Begin ghost %d/%ld: MAX_MAG: %g; ref_mag: %g @ (%.10g,%.10g)",i,refstars->n,MAX_MAG,ref->Mag,ref->sky->r * 180 / M_PI,ref->sky->d * 180.0 / M_PI);
    130131                    if (ref->Mag > MAX_MAG) continue;
    131132
     
    163164                    pmChip *ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, -ghost->srcFP->x, -ghost->srcFP->y);
    164165                    // fprintf (stderr, "raw chip position: %f, %f ", ghost->chip->x, ghost->chip->y);
    165 
     166                    float ref_chip_x = ghost->chip->x;
     167                    float ref_chip_y = ghost->chip->y;
    166168                    ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, ghost->FP->x, ghost->FP->y);
    167169                    // fprintf (stderr, "-> model chip position: %f, %f\n", ghost->chip->x, ghost->chip->y);
    168170
     171                    if (ghostChip) {
     172                      psTrace("psastro.ghost",5,"   in ghost: %d/%ld: ref: (%f,%f) or (%f,%f,%s) ghost: (%f,%f) or (%f,%f,%s) %f inner: (%f,%f,%f) outer: (%f,%f,%f)",
     173                              i,refstars->n,
     174                              ref->FP->x,ref->FP->y,
     175                              ref_chip_x,ref_chip_y,psMetadataLookupStr(NULL,chip->concepts,"CHIP.NAME"),
     176                              ghost->FP->x,ghost->FP->y,
     177                              ghost->chip->x,ghost->chip->y,psMetadataLookupStr(NULL,ghostChip->concepts,"CHIP.NAME"),
     178                              rSrc,
     179                              ghost->inner.major,ghost->inner.minor,ghost->inner.theta,
     180                              ghost->outer.major,ghost->outer.minor,ghost->outer.theta);
     181/*                    psWarning("   GHOST_DATA: %d/%ld: ref: (%f,%f) or (%f,%f,%s) ghost: (%f,%f) or (%f,%f,%s) %f inner: (%f,%f,%f) outer: (%f,%f,%f)", */
     182/*                            i,refstars->n, */
     183/*                            ref->FP->x,ref->FP->y, */
     184/*                            ref_chip_x,ref_chip_y,psMetadataLookupStr(NULL,chip->concepts,"CHIP.NAME"), */
     185/*                            ghost->FP->x,ghost->FP->y, */
     186/*                            ghost->chip->x,ghost->chip->y,psMetadataLookupStr(NULL,ghostChip->concepts,"CHIP.NAME"), */
     187/*                            rSrc, */
     188/*                            ghost->inner.major,ghost->inner.minor,ghost->inner.theta, */
     189/*                            ghost->outer.major,ghost->outer.minor,ghost->outer.theta); */
     190                    }
     191                    else {
     192                      psTrace("psastro.ghost",5,"   in ghost: %d/%ld: ref: (%f,%f) ghost: (%f,%f) or (%f,%f,%s) inner: (%f,%f,%f) outer: (%f,%f,%f)",
     193                              i,refstars->n,
     194                              ref->FP->x,ref->FP->y,
     195                              ghost->FP->x,ghost->FP->y,
     196                              ghost->chip->x,ghost->chip->y,"NONE",
     197                              ghost->inner.major,ghost->inner.minor,ghost->inner.theta,
     198                              ghost->outer.major,ghost->outer.minor,ghost->outer.theta);
     199                    }                 
     200                     
     201
     202                           
    169203                    if (!ghostChip) goto skip;
    170204                    if (!ghostChip->cells) goto skip;
    171205                    if (!ghostChip->cells->n) goto skip;
     206
     207                   
    172208                    pmCell *ghostCell = ghostChip->cells->data[0];
    173209                    if (!ghostCell) goto skip;
     
    190226
    191227                skip:
     228                   
    192229                    psFree (ghost);
    193230                }
  • trunk/psastro/src/psastroMaskUpdates.c

    r30873 r33851  
    406406                    // XXX for now, assume cell binning is 1x1 relative to chip
    407407                    psastroMaskCircle (readoutMask->mask, crosstalkMaskValue, ref->chip->x, ref->chip->y, radius, radius);
     408                  }
     409                }
     410                // Crosstalk Bleeds
     411                psArray *bleedcrosstalks = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.CROSSTALKS.SPIKES");
     412                if (bleedcrosstalks) {
     413                  for (int i = 0; i < bleedcrosstalks->n; i++) {
     414                    pmAstromObj *ref = bleedcrosstalks->data[i];
     415                    float width = REFSTAR_MASK_BLEED_MAG_SLOPE * (REFSTAR_MASK_BLEED_MAG_MAX - ref->Mag);
     416                    psTrace("psastro.crosstalk",2,"Masking spike on Chip %s @ (%f,%f) Magnitude: %f Radius %f\n",
     417                            psMetadataLookupStr(&status,readout->parent->parent->concepts,"CHIP.NAME"),
     418                            ref->chip->x,ref->chip->y,ref->Mag,width);
     419                    // XXX for now, assume cell binning is 1x1 relative to chip
     420                    pmCell *refCell = pmCellInChip(refChip,ref->chip->x,ref->chip->y);
     421                    if (refCell) {
     422                      float xCell = 0.0;
     423                      float yCell = 0.0;
     424                      pmCellCoordsForChip (&xCell, &yCell, refCell, ref->chip->x, ref->chip->y);
     425                      int ySize = psMetadataLookupS32(NULL,refCell->concepts,"CELL.YSIZE");
     426/*                    psWarning("Masking CTspike on Chip %s @ (%f,%f) Magnitude: %f (%f %f) Radius %f Z: %d %d %d %d\n", */
     427/*                              psMetadataLookupStr(&status,readout->parent->parent->concepts,"CHIP.NAME"), */
     428/*                              ref->chip->x,ref->chip->y,ref->Mag,REFSTAR_MASK_BLEED_MAG_SLOPE,REFSTAR_MASK_BLEED_MAG_MAX,width, */
     429/*                              (int) (ref->chip->x - 0.5 * width),   (int) (ref->chip->y - yCell), */
     430/*                              (int) (ref->chip->x+0.5 * width + 1), (int) (ref->chip->y + (ySize - yCell))); */
     431                      psastroMaskRectangle (readoutMask->mask, crosstalkMaskValue,
     432                                            (int) (ref->chip->x - 0.5 * width),   (int) (ref->chip->y - yCell),
     433                                            (int) (ref->chip->x+0.5 * width + 1), (int) (ref->chip->y + (ySize - yCell)));
     434                    }
    408435                  }
    409436                }
  • trunk/psastro/src/psastroMaskUtils.c

    r24045 r33851  
    135135        // XXX optimize this
    136136        float A = 1.0;
    137         float B = shape.sxy*y*PS_SQR(shape.sx);
     137        float B = 2.0 * shape.sxy*y*PS_SQR(shape.sx);
    138138        float C = PS_SQR(y*shape.sx/shape.sy) - PS_SQR(shape.sx);
    139139
Note: See TracChangeset for help on using the changeset viewer.