IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 19, 2012, 5:24:19 PM (14 years ago)
Author:
mhuber
Message:

merging latest r34040 trunk changes to branch

Location:
branches/meh_branches/ppstack_test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/meh_branches/ppstack_test

  • branches/meh_branches/ppstack_test/psastro/src/psastroLoadCrosstalk.c

    r26826 r34041  
    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
Note: See TracChangeset for help on using the changeset viewer.