IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33852


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

Merge from trunk of videodark/mask; improved ghost masking; crosstalk saturation spike masking.

Location:
tags/ipp-20120404
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20120404/ippconfig/gpc1/ghost.model.mdc

    r23814 r33852  
     1# Original center models
     2# GHOST.CENTER.X METADATA
     3#   NORDER_X S32 3
     4#   NORDER_Y S32 3
     5#   VAL_X00_Y00  F64 -4.421024e+01
     6#   VAL_X01_Y00  F64 1.216270e-02
     7#   VAL_X02_Y00  F64 -9.721643e-08
     8#   VAL_X03_Y00  F64 9.976554e-11
     9#   VAL_X00_Y01  F64 -1.762476e-03
     10#   VAL_X01_Y01  F64 1.247212e-07
     11#   VAL_X02_Y01  F64 3.629557e-11
     12#   VAL_X00_Y02  F64 -1.040174e-07
     13#   VAL_X01_Y02  F64 1.074674e-10
     14#   VAL_X00_Y03  F64 1.564112e-11
     15#   NELEMENTS  S32 10
     16# END
     17
     18# GHOST.CENTER.Y METADATA
     19#   NORDER_X S32 3
     20#   NORDER_Y S32 3
     21#   VAL_X00_Y00  F64 -2.189470e+00
     22#   VAL_X01_Y00  F64 -4.186514e-03
     23#   VAL_X02_Y00  F64 1.131554e-07
     24#   VAL_X03_Y00  F64 1.415192e-11
     25#   VAL_X00_Y01  F64 1.569104e-02
     26#   VAL_X01_Y01  F64 -1.782801e-07
     27#   VAL_X02_Y01  F64 8.179602e-11
     28#   VAL_X00_Y02  F64 2.577055e-07
     29#   VAL_X01_Y02  F64 8.879423e-11
     30#   VAL_X00_Y03  F64 5.767429e-11
     31#   NELEMENTS  S32 10
     32# END
     33
     34# Updated models of 2012-05-07
     35# Corrected(?) parity
     36# GHOST.CENTER.X METADATA
     37#   NORDER_X S32 3
     38#   NORDER_Y S32 3
     39#   VAL_X00_Y00  F64  3.314569e+01
     40#   VAL_X01_Y00  F64  1.110664e-02
     41#   VAL_X02_Y00  F64 -1.904158e-07
     42#   VAL_X03_Y00  F64  8.470224e-11
     43#   VAL_X00_Y01  F64 -1.616877e-03
     44#   VAL_X01_Y01  F64  1.646508e-07
     45#   VAL_X02_Y01  F64  5.623381e-11
     46#   VAL_X00_Y02  F64 -2.342888e-07
     47#   VAL_X01_Y02  F64  1.023761e-10
     48#   VAL_X00_Y03  F64  2.836980e-11
     49#   NELEMENTS  S32 10
     50# END
     51
     52# GHOST.CENTER.Y METADATA
     53#   NORDER_X S32 3
     54#   NORDER_Y S32 3
     55#   VAL_X00_Y00  F64 -2.860068e+01
     56#   VAL_X01_Y00  F64 -8.790076e-03
     57#   VAL_X02_Y00  F64  2.456534e-07
     58#   VAL_X03_Y00  F64  2.947749e-11
     59#   VAL_X00_Y01  F64  1.948855e-02
     60#   VAL_X01_Y01  F64 -2.639927e-07
     61#   VAL_X02_Y01  F64  4.951474e-11
     62#   VAL_X00_Y02  F64  4.341716e-07
     63#   VAL_X01_Y02  F64  1.643046e-10
     64#   VAL_X00_Y03  F64 -1.737983e-12
     65#   NELEMENTS  S32 10
     66# END
     67
     68# Switched order
    169GHOST.CENTER.X METADATA
    270  NORDER_X S32 3
    371  NORDER_Y S32 3
    4   VAL_X00_Y00  F64 -4.421024e+01
    5   VAL_X01_Y00  F64 1.216270e-02
    6   VAL_X02_Y00  F64 -9.721643e-08
    7   VAL_X03_Y00  F64 9.976554e-11
    8   VAL_X00_Y01  F64 -1.762476e-03
    9   VAL_X01_Y01  F64 1.247212e-07
    10   VAL_X02_Y01  F64 3.629557e-11
    11   VAL_X00_Y02  F64 -1.040174e-07
    12   VAL_X01_Y02  F64 1.074674e-10
    13   VAL_X00_Y03  F64 1.564112e-11
     72  VAL_X00_Y00  F64 -1.215661e+02
     73  VAL_X01_Y00  F64  1.321875e-02
     74  VAL_X02_Y00  F64 -4.017026e-09
     75  VAL_X03_Y00  F64  1.148288e-10
     76  VAL_X00_Y01  F64 -1.908074e-03
     77  VAL_X01_Y01  F64  8.479150e-08
     78  VAL_X02_Y01  F64  1.635732e-11
     79  VAL_X00_Y02  F64  2.625405e-08
     80  VAL_X01_Y02  F64  1.125586e-10
     81  VAL_X00_Y03  F64  2.912432e-12
    1482  NELEMENTS  S32 10
    1583END
     
    1886  NORDER_X S32 3
    1987  NORDER_Y S32 3
    20   VAL_X00_Y00  F64 -2.189470e+00
    21   VAL_X01_Y00  F64 -4.186514e-03
    22   VAL_X02_Y00  F64 1.131554e-07
    23   VAL_X03_Y00  F64 1.415192e-11
    24   VAL_X00_Y01  F64 1.569104e-02
    25   VAL_X01_Y01  F64 -1.782801e-07
    26   VAL_X02_Y01  F64 8.179602e-11
    27   VAL_X00_Y02  F64 2.577055e-07
    28   VAL_X01_Y02  F64 8.879423e-11
    29   VAL_X00_Y03  F64 5.767429e-11
     88  VAL_X00_Y00  F64  2.422174e+01
     89  VAL_X01_Y00  F64  4.170486e-04
     90  VAL_X02_Y00  F64 -1.934260e-08
     91  VAL_X03_Y00  F64 -1.173657e-12
     92  VAL_X00_Y01  F64  1.189352e-02
     93  VAL_X01_Y01  F64 -9.256748e-08
     94  VAL_X02_Y01  F64  1.140772e-10
     95  VAL_X00_Y02  F64  8.123932e-08
     96  VAL_X01_Y02  F64  1.328378e-11
     97  VAL_X00_Y03  F64  1.170865e-10
    3098  NELEMENTS  S32 10
    3199END
    32100
     101
     102
     103# These are semi-major/minor axes
     104# These are my (CZW) quadratic solutions
     105# GHOST.INNER.MAJOR METADATA
     106#   NORDER_X S32 2
     107#   VAL_X00  F64 2.2622e+01
     108#   VAL_X01  F64 1.3822e-02
     109#   VAL_X02  F64 -3.7005e-07
     110#   NELEMENTS  S32 3
     111# END
     112
     113# GHOST.INNER.MINOR METADATA
     114#   NORDER_X S32 2
     115#   VAL_X00  F64 4.9626e+01
     116#   VAL_X01  F64 -2.4257e-04
     117#   VAL_X02  F64 -1.2007e-07
     118#   NELEMENTS  S32 3
     119# END
     120
     121# GHOST.OUTER.MAJOR METADATA
     122#   NORDER_X S32 2
     123#   VAL_X00  F64 9.6490e+01
     124#   VAL_X01  F64 9.4250e-03
     125#   VAL_X02  F64 6.5680e-07
     126#   NELEMENTS  S32 3
     127# END
     128
     129# GHOST.OUTER.MINOR METADATA
     130#   NORDER_X S32 2
     131#   VAL_X00  F64 9.5450e+01
     132#   VAL_X01  F64 2.8775e-03
     133#   VAL_X02  F64 -3.1409e-07
     134#   NELEMENTS  S32 3
     135# END
     136
     137# These are the original linear solutions
    33138GHOST.INNER.MAJOR METADATA
    34139  NORDER_X S32 1
  • tags/ipp-20120404/ippconfig/gpc1/ppImage.config

    r33642 r33852  
    2525NOISEMAP                BOOL    FALSE          # Apply read noise map
    2626
    27 
     27# Final detrending options
     28HAS.VIDEO       BOOL    FALSE           # Treat this OTA as if it has video data
     29USE.VIDEO.DARK  BOOL    FALSE           # Use a video dark if we have video data?
     30USE.VIDEO.MASK  BOOL    TRUE            # Use a video mask if we have video data?
    2831
    2932
  • tags/ipp-20120404/ippconfig/gpc1/psastro.config

    r33668 r33852  
    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
  • tags/ipp-20120404/ippconfig/recipes/filerules-mef.mdc

    r33636 r33852  
    5959PPIMAGE.INPUT.SRC       INPUT    @FILES        CHIP       CMF
    6060PPIMAGE.MASK            INPUT    @DETDB        CHIP       MASK
     61PPIMAGE.VIDEOMASK       INPUT    @DETDB        CHIP       MASK
    6162PPIMAGE.BIAS            INPUT    @DETDB        CHIP       IMAGE
    6263PPIMAGE.DARK            INPUT    @DETDB        CHIP       DARK
     64PPIMAGE.VIDEODARK       INPUT    @DETDB        CHIP       DARK
    6365PPIMAGE.FLAT            INPUT    @DETDB        CHIP       IMAGE
    6466PPIMAGE.FRINGE          INPUT    @DETDB        CHIP       FRINGE
  • tags/ipp-20120404/ippconfig/recipes/filerules-simple.mdc

    r33636 r33852  
    2323PPIMAGE.INPUT.SRC         INPUT    @FILES        READOUT    CMF       
    2424PPIMAGE.MASK              INPUT    @DETDB        CHIP       MASK
     25PPIMAGE.VIDEOMASK         INPUT    @DETDB        CHIP       MASK
    2526PPIMAGE.BIAS              INPUT    @DETDB        CHIP       IMAGE     
    2627PPIMAGE.DARK              INPUT    @DETDB        CHIP       DARK     
     28PPIMAGE.VIDEODARK         INPUT    @DETDB        CHIP       DARK
    2729PPIMAGE.FLAT              INPUT    @DETDB        CHIP       IMAGE     
    2830PPIMAGE.FRINGE            INPUT    @DETDB        CHIP       FRINGE
  • tags/ipp-20120404/ippconfig/recipes/filerules-split.mdc

    r33690 r33852  
    3636PPIMAGE.INPUT             INPUT    @FILES        CHIP       IMAGE
    3737PPIMAGE.INPUT.MASK        INPUT    @FILES        CHIP       MASK
     38PPIMAGE.VIDEOMASK         INPUT    @DETDB        CHIP       MASK
    3839PPIMAGE.INPUT.VARIANCE    INPUT    @FILES        CHIP       VARIANCE
    3940PPIMAGE.INPUT.PSF         INPUT    @FILES        CHIP       PSF
     
    4344PPIMAGE.NOISEMAP          INPUT    @DETDB        CHIP       IMAGE
    4445PPIMAGE.DARK              INPUT    @DETDB        CHIP       DARK
     46PPIMAGE.VIDEODARK         INPUT    @DETDB        CHIP       DARK
    4547PPIMAGE.FLAT              INPUT    @DETDB        CHIP       IMAGE
    4648PPIMAGE.FRINGE            INPUT    @DETDB        CHIP       FRINGE
  • tags/ipp-20120404/ippconfig/recipes/ppImage.config

    r33642 r33852  
    153153
    154154GAIN.OVERRIDE   BOOL    FALSE           # Override a non-finite gain?
     155
     156# Final detrending options
     157HAS.VIDEO       BOOL    FALSE           # Treat this OTA as if it has video data
     158USE.VIDEO.DARK  BOOL    FALSE           # Use a video dark if we have video data?
     159USE.VIDEO.MASK  BOOL    FALSE           # Use a video mask if we have video data?
    155160
    156161DETREND.CONSTRAINTS  METADATA
  • tags/ipp-20120404/ppImage/src/ppImage.h

    r33590 r33852  
    5757    bool addNoise;                      // Add noise to degrade MD image to 3pi
    5858
     59  bool hasVideo;                      // Determine if this OTA has a video cell
     60  bool useVideoDark;                  // Should we use a video dark if we can?
     61  bool useVideoMask;                  // Should we use a video mask if we can?
     62 
    5963    // output files requested
    6064    bool BaseFITS;
  • tags/ipp-20120404/ppImage/src/ppImageDetrendReadout.c

    r33590 r33852  
    3535      }
    3636    }
    37 
     37    // Check to see if we're in a chip that contains video
     38    bool hasVideo = false;
     39    {
     40      if (psMetadataLookupStr(NULL,input->parent->parent->hdu->header,"CELLMODE")) {
     41        psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask);
     42        char *Vptr = strchr(psMetadataLookupStr(NULL,input->parent->parent->hdu->header,"CELLMODE"),'V');
     43        if (Vptr) {
     44          hasVideo = true;
     45          psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask);
     46        }
     47      }
     48    }
     49
     50   
    3851    // Masking on the basis of pixel value needs to be done before anything else, so the values are pristine.
    3952    if (options->doMaskBuild) {
     
    4457    // apply the externally supplied mask to the input->mask pixels
    4558    if (options->doMask) {
    46         pmReadout *mask = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.MASK");
    47         pmMaskBadPixels(input, mask, options->maskValue);
     59      pmReadout *mask;
     60      if ((options->useVideoMask)&&(hasVideo)) {
     61        mask = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.VIDEOMASK");
     62      }
     63      else {
     64        mask = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.MASK");
     65      }
     66      pmMaskBadPixels(input, mask, options->maskValue);
    4867    }
    4968    if (options->doMaskBurntool) {
     
    8099        psMetadata *recipe = psMetadataLookupPtr (&mdok, config->recipes, RECIPE_NAME);
    81100        assert(mdok && recipe);
    82         if (psMetadataLookupBool(&mdok, recipe, "OLDDARK")) {
     101
     102        if ((options->useVideoDark)&&(hasVideo)) {
     103          if (psMetadataLookupBool(&mdok, recipe, "OLDDARK")) {
     104            oldDark = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.VIDEODARK");
     105          } else {
     106            dark = pmFPAfileThisCell(config->files, detview, "PPIMAGE.VIDEODARK");
     107          }
     108        }
     109        else {
     110          if (psMetadataLookupBool(&mdok, recipe, "OLDDARK")) {
    83111            oldDark = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.DARK");
    84         } else {
     112          } else {
    85113            dark = pmFPAfileThisCell(config->files, detview, "PPIMAGE.DARK");
    86         }
     114          }
     115        }
    87116    }
    88117
  • tags/ipp-20120404/ppImage/src/ppImageOptions.c

    r33590 r33852  
    4545    options->doMaskStats     = false;   // Calculate mask fractions
    4646    options->addNoise        = false;  //Degrade an MD image to a 3pi image
    47 
     47    options->hasVideo        = false;   // Determine if this OTA has a video cell
     48    options->useVideoDark    = false;   // Use video dark if we can?
     49    options->useVideoMask    = false;   // Use video mask if we can?
    4850    // output files requested
    4951    options->BaseFITS        = false;   // create output image
     
    362364    options->fringeKeep = psMetadataLookupF32(NULL, recipe, "FRINGE.KEEP");
    363365
     366    // Video cell options
     367    if (psMetadataLookup(recipe, "USE.VIDEO.DARK")) {
     368      options->useVideoDark = psMetadataLookupBool(NULL,recipe,"USE.VIDEO.DARK");
     369    }
     370    if (psMetadataLookup(recipe, "USE.VIDEO.MASK")) {
     371      options->useVideoMask = psMetadataLookupBool(NULL,recipe,"USE.VIDEO.MASK");
     372    }
     373
    364374    // Pattern correction
    365375    if (psMetadataLookup(format, "PATTERN.ROW.ORDER")) {
     
    418428      options->patternContinuityEdgeWidth = psMetadataLookupS32(NULL, recipe, "PATTERN.CONTINUITY.WIDTH");
    419429    }
    420    
     430
    421431
    422432    // Remnance options
  • tags/ipp-20120404/ppImage/src/ppImageParseCamera.c

    r29833 r33852  
    2222    ppImageOptions *options = ppImageOptionsParse(config);
    2323
     24    // parse the header to extract out whether this OTA has video cells.
     25    // CZW: 2012-05-01 I'm somewhat ashamed of what needs to be done to get to the header. There has to be a simpler way, right?
     26/*     pmFPAview *view = pmFPAviewAlloc(0);// View for level of interest */
     27/*     pmChip *chip;                       // Chip from FPA */
     28/*     while ((chip = pmFPAviewNextChip(view, input->fpa, 1)) != NULL) { */
     29/*       if (!chip->process || !chip->file_exists) { */
     30/*      continue; */
     31/*       } */
     32/* /\*       if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { *\/ */
     33/* /\*  continue; *\/ */
     34/* /\*       } *\/ */
     35/*       psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */
     36/*       if (psMetadataLookupStr(NULL,chip->hdu->header,"CELLMODE")) { */
     37/*      psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */
     38/*      char *Vptr = strchr(psMetadataLookupStr(NULL,chip->hdu->header,"CELLMODE"),'V'); */
     39/*      if (Vptr) { */
     40/*        options->hasVideo = true; */
     41/*        psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */
     42/*      } */
     43/*       } */
     44/*     } */
     45/*     pmFPAviewReset(view); */
     46/*     psFree(view); */
     47   
    2448    // the following are defined from the argument list, if given,
    2549    // otherwise they revert to the config information
     
    4266    }
    4367    if (options->doDark) {
    44         if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.DARK", "DARK",
    45                                PM_FPA_FILE_DARK, PM_DETREND_TYPE_DARK)) {
     68      // Always load the regular Dark
     69      if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.DARK", "DARK",
     70                             PM_FPA_FILE_DARK, PM_DETREND_TYPE_DARK)) {
     71        psError(PS_ERR_IO, false, "Can't find a dark image source");
     72        psFree(options);
     73        return NULL;
     74      }
     75      // Sometimes load the video dark if we need it.
     76      if (options->useVideoDark) {
     77        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.VIDEODARK", "DARK",
     78                               PM_FPA_FILE_DARK, PM_DETREND_TYPE_VIDEODARK)) {
    4679            psError(PS_ERR_IO, false, "Can't find a dark image source");
    4780            psFree(options);
    4881            return NULL;
    4982        }
     83      }
    5084    }
    5185    if (options->doMask) {
    52         if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.MASK", "MASK",
    53                                PM_FPA_FILE_MASK, PM_DETREND_TYPE_MASK)) {
     86      // Always load the regular mask
     87      if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.MASK", "MASK",
     88                             PM_FPA_FILE_MASK, PM_DETREND_TYPE_MASK)) {
     89        psError(PS_ERR_IO, false, "Can't find a mask image source");
     90        psFree(options);
     91        return NULL;
     92      }
     93
     94      if (options->useVideoMask) {
     95        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.VIDEOMASK", "MASK",
     96                               PM_FPA_FILE_MASK, PM_DETREND_TYPE_VIDEOMASK)) {
    5497            psError(PS_ERR_IO, false, "Can't find a mask image source");
    5598            psFree(options);
    5699            return NULL;
    57100        }
     101      }
    58102    }
    59103    if (options->doShutter) {
  • tags/ipp-20120404/psModules/src/detrend/pmDetrendDB.c

    r31067 r33852  
    107107        DETREND_STRING_CASE(ASTROM);
    108108        DETREND_STRING_CASE(NOISEMAP);
     109        DETREND_STRING_CASE(VIDEOMASK);
     110        DETREND_STRING_CASE(VIDEODARK);
    109111        DETREND_STRING_CASE(LINEARITY);
    110112    default:
  • tags/ipp-20120404/psModules/src/detrend/pmDetrendDB.h

    r29833 r33852  
    3636    PM_DETREND_TYPE_ASTROM,
    3737    PM_DETREND_TYPE_NOISEMAP,
     38    PM_DETREND_TYPE_VIDEOMASK,
     39    PM_DETREND_TYPE_VIDEODARK,
    3840    PM_DETREND_TYPE_LINEARITY,
    3941} pmDetrendType;
  • tags/ipp-20120404/psastro/src/psastroLoadCrosstalk.c

    r26826 r33852  
    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
  • tags/ipp-20120404/psastro/src/psastroLoadGhosts.c

    r26259 r33852  
    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                }
  • tags/ipp-20120404/psastro/src/psastroMaskUpdates.c

    r30873 r33852  
    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                }
  • tags/ipp-20120404/psastro/src/psastroMaskUtils.c

    r24045 r33852  
    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.