IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 22724


Ignore:
Timestamp:
Mar 1, 2009, 9:32:54 PM (17 years ago)
Author:
beaumont
Message:

First pass Ohana visualization

Location:
branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/Makefile

    r17243 r22724  
    5555$(SRC)/relastro_objects.$(ARCH).o    \
    5656$(SRC)/save_catalogs.$(ARCH).o       \
    57 $(SRC)/write_coords.$(ARCH).o
     57$(SRC)/write_coords.$(ARCH).o        \
     58$(SRC)/relastroVisual.$(ARCH).o
    5859
    5960$(RELASTRO): $(INC)/relastro.h $(KAPA_INCS)
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/include/relastro.h

    r21508 r22724  
    4444  double Ro, dRo;
    4545  double Do, dDo;
    46  
     46
    4747  double uR, duR;
    4848  double uD, duD;
     
    6363  char flags;
    6464  Coords coords;
    65 } Mosaic; 
     65} Mosaic;
    6666
    6767typedef struct {
     
    8787
    8888double SIGMA_LIM;
     89int MIN_SRC_FIT;
    8990double MIN_ERROR;
    9091
     
    145146int           corner_check        PROTO((double *x1, double *y1, double *x2, double *y2));
    146147void          dumpGrid            PROTO((void));
    147 void          dump_grid           PROTO((void)); 
     148void          dump_grid           PROTO((void));
    148149int           edge_check          PROTO((double *x1, double *y1, double *x2, double *y2));
    149150void          findImages          PROTO((Catalog *catalog, int Ncatalog));
     
    220221int           setMrelOutput       PROTO((Catalog *catalog, int Ncatalog, int mark));
    221222void          set_ZP              PROTO((double ZERO));
    222 int           setrefcode          PROTO((Image *image, int Nimage)); 
     223int           setrefcode          PROTO((Image *image, int Nimage));
    223224void          skip_measurements   PROTO((Catalog *catalog, int pass));
    224225void          sortA               PROTO((double *X, int N));
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/ConfigInit.c

    r17207 r22724  
    2020
    2121  GetConfig (config, "RELASTRO_SIGMA_LIM",     "%lf", 0, &SIGMA_LIM);
     22  GetConfig (config, "RELASTRO_MIN_SRC_FIT",   "%d",  0, &MIN_SRC_FIT);
    2223
    2324  // XXX these are used in relphot to identify poor stars / images -- define
     
    5556    fprintf (stderr, "directory %s does not exist, giving up\n", CATDIR);
    5657    exit (1);
    57   } 
     58  }
    5859
    5960  /* update master photcode table if not defined */
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/FitChip.c

    r17209 r22724  
    11# include "relastro.h"
     2# include "relastroVisual.h"
    23
    34// XXX make these user parameters
     
    2223
    2324  ALLOCATE (values, double, Nmatch);
    24 
    2525  for (Niter = 0; Niter < FIT_CHIP_NITER; Niter ++) {
    2626
     
    3333      dM = raw[i].M - ref[i].M;
    3434      dR = hypot (dL, dM);
    35    
     35
    3636      values[Nscatter] = dR;
    3737      Nscatter++;
     
    4141    dsort (values, Nscatter);
    4242    dRmax = FIT_CHIP_NSIGMA*values[(int)(0.40*Nscatter)];
     43    relastroVisualPlotRawRef(raw, ref, dRmax, Nmatch);
    4344
    4445    // fit the requested order polynomial
     
    5758      dR = hypot (dL, dM);
    5859      if (dR > dRmax) continue;
    59    
     60
    6061      fit_add (fit, raw[i].X, raw[i].Y, ref[i].L, ref[i].M, raw[i].dPos);
    6162    }
     
    6667      case 0:
    6768      case 1:
    68         skip = (fit[0].Npts < 8);
    69         break;
     69        skip = (fit[0].Npts < 8);
     70        break;
    7071      case 2:
    71         skip = (fit[0].Npts < 11);
    72         break;
     72        skip = (fit[0].Npts < 11);
     73        break;
    7374      case 3:
    74         skip = (fit[0].Npts < 15);
    75         break;
     75        skip = (fit[0].Npts < 15);
     76        break;
    7677      default:
    77         fprintf (stderr, "invalid chip order %d\n", coords[0].Npolyterms);
    78         abort ();
     78        fprintf (stderr, "invalid chip order %d\n", coords[0].Npolyterms);
     79        abort ();
    7980    }
    8081    if (skip) {
     
    9596      XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, coords);
    9697    }
     98
     99    relastroVisualPlotRawRef(fit, coords, dRmax, Nmatch);
     100
    97101  }
    98102
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/ImageOps.c

    r17243 r22724  
    9191  for (i = 0; VERBOSE && (i < Nimage); i++) {
    9292    name = GetPhotcodeNamebyCode (image[i].photcode);
    93     fprintf (stderr, "image %d has %d measures (%s, %s)\n", i, Nlist[i], 
    94              ohana_sec_to_date(image[i].tzero), name);
    95   } 
     93    fprintf (stderr, "image %d has %d measures (%s, %s)\n", i, Nlist[i],
     94             ohana_sec_to_date(image[i].tzero), name);
     95  }
    9696}
    9797
     
    101101  int i;
    102102  Measure *measure;
    103  
     103
    104104  measure = &catalog[cat].measure[meas];
    105105
     
    110110    if (measure[0].t < start[i]) continue;
    111111    if (measure[0].t > stop[i]) continue;
    112    
     112
    113113    // index for (catalog, measure) -> image
    114114    bin[cat][meas] = i;
     
    125125      REALLOCATE (clist[i], int, NLIST[i]);
    126126      REALLOCATE (mlist[i], int, NLIST[i]);
    127     }   
     127    }
    128128    return;
    129129  }
     
    157157
    158158  plot_defaults (&graphdata);
    159   graphdata.ymin = PlotdMmin; 
     159  graphdata.ymin = PlotdMmin;
    160160  graphdata.ymax = PlotdMmax;
    161161  plot_list (&graphdata, xlist, Mlist, Nimage, "airmass vs Mcal", "airmass.png");
     
    191191  int i, m, c, n;
    192192  double X, Y, L, M, P, Q, R, D, dR, dD;
    193  
     193
    194194  Mosaic *mosaic;
    195195  Coords *moscoords, *imcoords;
    196  
     196
    197197  moscoords = NULL;
    198198  mosaic = getMosaicForImage (im);
     
    224224    dR = 3600.0*(catalog[c].average[n].R - R);
    225225    dD = 3600.0*(catalog[c].average[n].D - D);
    226    
     226
    227227    if (fabs(catalog[c].measure[m].dR - dR) > 10.0) {
    228228      // XXXXX running into this still for last megacam exposure: wrong mosaic?
     
    249249      catalog[c].measure[m].dR = 3600.0*(catalog[c].average[n].R - R);
    250250    }
    251   } 
     251  }
    252252  return;
    253253}
     
    259259
    260260  int i, m, c, n;
    261  
     261
    262262  Mosaic *mosaic;
    263263  Coords *moscoords;
    264264  StarData *raw;
    265  
     265
    266266  ALLOCATE (raw, StarData, Nlist[im]);
    267267
     
    271271      mosaic = getMosaicForImage (im);
    272272      if (mosaic == NULL) {
    273         fprintf (stderr, "mosaic not found for image %s\n", image[im].name);
    274         exit (1);
     273        fprintf (stderr, "mosaic not found for image %s\n", image[im].name);
     274        exit (1);
    275275      }
    276276      moscoords = &mosaic[0].coords;
     
    284284    raw[i].X = catalog[c].measure[m].Xccd;
    285285    raw[i].Y = catalog[c].measure[m].Yccd;
    286    
     286
    287287    raw[i].Mag  = catalog[c].measure[m].M;
    288288    raw[i].dMag = catalog[c].measure[m].dM;
     
    293293    // an object with only one detection provides no information about the image calibration
    294294    raw[i].mask = FALSE;
    295     if (catalog[c].average[n].Nmeasure < 2) {
     295    if (catalog[c].average[n].Nmeasure < MIN_SRC_FIT) {
    296296      raw[i].mask = TRUE;
    297297    }
     
    299299    switch (mode) {
    300300      case MODE_SIMPLE:
    301         /* note that for a Simple image, L,M = P,Q */
    302         XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords);
    303         raw[i].P = raw[i].L;
    304         raw[i].Q = raw[i].M;
    305         LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords);
    306         break;
     301        /* note that for a Simple image, L,M = P,Q */
     302        XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords);
     303        raw[i].P = raw[i].L;
     304        raw[i].Q = raw[i].M;
     305        LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords);
     306        break;
    307307      case MODE_MOSAIC:
    308         XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords);
    309         XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, moscoords);
    310         LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, moscoords);
    311         break;
     308        XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords);
     309        XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, moscoords);
     310        LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, moscoords);
     311        break;
    312312    default:
    313313      fprintf (stderr, "error: invalid mode in getImageRaw");
    314314      abort ();
    315315    }
    316   } 
     316  }
    317317
    318318  *Nstars = Nlist[im];
     
    330330  Coords *moscoords;
    331331  StarData *ref;
    332  
     332
    333333  ALLOCATE (ref, StarData, Nlist[im]);
    334334
     
    352352    ref[i].R = catalog[c].average[n].R;
    353353    ref[i].D = catalog[c].average[n].D;
    354    
     354
    355355    ref[i].Mag  = catalog[c].measure[m].M;
    356356    ref[i].dMag = catalog[c].measure[m].dM;
     
    373373      break;
    374374      default:
    375         fprintf (stderr, "invalid case");
    376         abort();
    377     }
    378   }
    379  
     375        fprintf (stderr, "invalid case");
     376        abort();
     377    }
     378  }
     379
    380380  *Nstars = Nlist[im];
    381381  return (ref);
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/initialize.c

    r17213 r22724  
    2525      fprintf (stderr, "codename: %s\n", codename);
    2626      if ((photcodesKeep[NphotcodesKeep] = GetPhotcodebyName (codename)) == NULL) {
    27         fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);
    28         exit (1);
     27        fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);
     28        exit (1);
    2929      }
    3030      NphotcodesKeep ++;
     
    4646      fprintf (stderr, "codename: %s\n", codename);
    4747      if ((photcodesSkip[NphotcodesSkip] = GetPhotcodebyName (codename)) == NULL) {
    48         fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);
    49         exit (1);
     48        fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);
     49        exit (1);
    5050      }
    5151      NphotcodesSkip ++;
Note: See TracChangeset for help on using the changeset viewer.