IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 26, 2009, 4:56:14 PM (17 years ago)
Author:
watersc1
Message:

alterations to ppImage to allow masking of burntool remnants by ppImage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/cleanup/extsrc/gpcsw/gpcsrc/fits/burntool/persistio.c

    r23924 r25210  
    5151             &boxbuf[nbox].slope, &boxbuf[nbox].nfit,
    5252             &boxbuf[nbox].sxfit, &boxbuf[nbox].exfit);
    53       if(boxbuf[nbox].nfit <= 0) continue;
    54       boxbuf[nbox].zero = (double *)calloc(boxbuf[nbox].nfit, sizeof(double));
    55       boxbuf[nbox].xfit = (int *)calloc(boxbuf[nbox].nfit, sizeof(int));
    56       boxbuf[nbox].yfit = (int *)calloc(boxbuf[nbox].nfit, sizeof(int));
    57       for(i=0; i<boxbuf[nbox].nfit; i++) {
    58          if(fgets(line, 1024, fp) == NULL) {
    59             fprintf(stderr, "\rerror: short read of burn lines\n");
    60             return(-1);
    61          }
    62          sscanf(line, "%d %d %lf\n", &boxbuf[nbox].xfit[i],
    63                 &boxbuf[nbox].yfit[i], &boxbuf[nbox].zero[i]);
     53      if(boxbuf[nbox].nfit > 0) {
     54         boxbuf[nbox].zero = (double *)calloc(boxbuf[nbox].nfit, sizeof(double));
     55         boxbuf[nbox].xfit = (int *)calloc(boxbuf[nbox].nfit, sizeof(int));
     56         boxbuf[nbox].yfit = (int *)calloc(boxbuf[nbox].nfit, sizeof(int));
     57         for(i=0; i<boxbuf[nbox].nfit; i++) {
     58            if(fgets(line, 1024, fp) == NULL) {
     59               fprintf(stderr, "\rerror: short read of burn lines\n");
     60               return(-1);
     61            }
     62            sscanf(line, "%d %d %lf\n", &boxbuf[nbox].xfit[i],
     63                   &boxbuf[nbox].yfit[i], &boxbuf[nbox].zero[i]);
     64         }
    6465      }
    6566      boxbuf[nbox].fiterr = 0;
     
    147148      for(kp=0; kp<n; kp++) {
    148149         k = boxid[kp];
    149          zk = box[k].zero[box[k].nfit/2];
     150         zk = 0.0;
     151         if(box[k].nfit > 0) zk = box[k].zero[box[k].nfit/2];
    150152         for(jp=kp+1; jp<n; jp++) {
    151153            j = boxid[jp];
    152             zj = box[j].zero[box[j].nfit/2];
     154            zj = 0.0;
     155            if(box[j].nfit > 0) zj = box[j].zero[box[j].nfit/2];
    153156            if(ABS(yctr[jp]-yctr[kp]) > DIFFERENT_STREAK) {
    154157/* Trim back the feebler streak */
     
    238241/* First: patched up persists */
    239242      for(k=0; k<cell[j].npersist; k++) {
    240          if(cell[j].persist[k].fiterr) continue;
    241          if(cell[j].persist[k].nfit <= 0) continue;
     243
     244         if(PERSIST_RETAIN) {
     245/* Keep fits which have a dubious slope */
     246            if(cell[j].persist[k].fiterr != FIT_SLOPE_ERROR) {
     247               if(cell[j].persist[k].fiterr) continue;
     248               if(cell[j].persist[k].nfit <= 0) continue;
     249            }
     250         } else {
     251            if(cell[j].persist[k].fiterr) continue;
     252            if(cell[j].persist[k].nfit <= 0) continue;
     253         }
    242254         fprintf(fp, "%3d %7d  %3d %3d %5d %3d  %3d %3d  %3d %3d  %3d %3d %3d %3d %3d %3d %3d %3d  %1d %1d %9.6f %3d %3d %3d\n",
    243255                 j, cell[j].persist[k].time,
     
    262274      for(k=0; k<cell[j].nburn; k++) {
    263275         if(!cell[j].burn[k].burned) continue;
    264          if(cell[j].burn[k].fiterr &&
    265             cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue;
    266          if(cell[j].burn[k].nfit <= 0) continue;
     276         if(PERSIST_RETAIN) {
     277/* Keep fits which have a dubious slope */
     278            if(cell[j].burn[k].fiterr != FIT_SLOPE_ERROR) {
     279               if(cell[j].burn[k].fiterr &&
     280                  cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue;
     281               if(cell[j].burn[k].nfit <= 0) continue;
     282            }
     283         } else {
     284            if(cell[j].burn[k].fiterr &&
     285               cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue;
     286            if(cell[j].burn[k].nfit <= 0) continue;
     287         }
    267288
    268289         i = (cell[j].burn[k].ex - cell[j].burn[k].sx + 1) / 2;
Note: See TracChangeset for help on using the changeset viewer.