IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 26, 2009, 1:47:40 PM (17 years ago)
Author:
beaumont
Message:

enhancements to relastro, relastrovisual

Location:
branches/cnb_branches/cnb_branch_20090301
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

  • branches/cnb_branches/cnb_branch_20090301/Ohana

  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/libdvo/include/dvo.h

    r21508 r24243  
    108108# define ID_MEAS_POOR_ASTROM  0x0010  /* detection is astrometry outlier                                             */   
    109109# define ID_MEAS_SKIP_ASTROM  0x0020  /* detection was ignored for astrometry measurement                            */   
    110 # define ID_MEAS_UNDEF_1      0x0040  /* unused                                                                      */
    111 # define ID_MEAS_UNDEF_2      0x0080  /* unused                                                                      */
     110# define ID_MEAS_USED_OBJ     0x0040  /* detection was used during opdate objects                                    */
     111# define ID_MEAS_USED_CHIP    0x0080  /* detection was used during update chips                                      */
    112112# define ID_MEAS_BLEND_MEAS   0x0100  /* detection is within radius of multiple objects                              */
    113113# define ID_MEAS_BLEND_OBJ    0x0200  /* multiple detections within radius of object                                 */
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/opihi/dimm/camera_cmds.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/opihi/dimm/telescope_cmds.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/include/relastro.h

    r23649 r24243  
    122122
    123123int FlagOutlier;
     124int    CLIP_THRESH;
    124125
    125126FitMode FIT_MODE;
     
    268269int UpdateMeasures (Catalog *catalog, int Ncatalog);
    269270void fixImageRaw (Catalog *catalog, int Ncatalog, int im);
    270 void FlagOutliers(Catalog *catalog, int Ncatalog);
     271void FlagOutliers(Catalog *catalog);
    271272int MeasFilterTest(Measure *measure);
    272273
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/FitChip.c

    r23344 r24243  
    5353    // generate the fit matches
    5454    for (i = 0; i < Nmatch; i++) {
    55       if (raw[i].mask) continue;
    56       if (isnan(raw[i].dMag) || raw[i].dMag > FIT_CHIP_MAX_ERROR) continue;
     55      if (raw[i].mask) {
     56        continue;
     57      }
     58      if (isnan(raw[i].dMag) || raw[i].dMag > FIT_CHIP_MAX_ERROR) {
     59        continue;
     60      }
    5761
    5862      // only keep objects within dRmax
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/GetAstromError.c

    r16810 r24243  
    3030 
    3131  dPtotal = sqrt(SQ(dPsys) + AS*SQ(dPobs) + MS*SQ(dM));
     32
     33  //XXX dXccd, dYccd are now working correctly
     34  //dPtotal = AS * dPobs;
     35
    3236  dPtotal = MAX (dPtotal, MIN_ERROR);
    3337
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/ImageOps.c

    r23649 r24243  
    11# include "relastro.h"
     2#define TESTING
    23
    34static unsigned int *start;
     
    163164  plot_list (&graphdata, Mlist, dlist, Nimage, "Mcal vs dMcal", NULL);
    164165
    165 # define NBIN 200
     166# define NBIN 20
    166167  REALLOCATE (xlist, double, NBIN);
    167168  REALLOCATE (Mlist, double, NBIN);
     
    292293
    293294    // an object with only one detection provides no information about the image calibration
     295    //XXX this is already taken care of in bcatalog
    294296    raw[i].mask = FALSE;
    295297    int mask = FALSE;
     
    297299      mask = TRUE;
    298300    }
    299     if (~finite(catalog[c].measure[m].dR) || ~finite(catalog[c].measure[m].dD)) mask = TRUE;
     301    if (!finite(catalog[c].measure[m].dR) || !finite(catalog[c].measure[m].dD)) {
     302      mask = TRUE;
     303    }
    300304
    301305    raw[i].mask = mask;
     
    388392
    389393/** lifted from relphot/StarOps.clean_measures */
    390 void FlagOutliers (Catalog *catalog, int Ncatalog) {
     394void FlagOutliers2D(Catalog *catalog);
     395
     396void FlagOutliers (Catalog *catalog) {
     397  // XXX FlagOutliers is just using FlagOutliers2D
     398  FlagOutliers2D(catalog);
     399  return;
    391400
    392401  int i, j, k, m, N, Ndel, Nave, Nmax, TOOFEW, Nsecfilt;
    393   double Ns;
     402  double Ns, theta, x, y;
    394403  double *R, *D, *dR, *dD;
    395404  StatType statsR, statsD;
     
    399408
    400409  if (VERBOSE) fprintf (stderr, "marking poor measures\n");
    401   /* Nmeasure is now different, need to reallocate */
    402410  Nmax = 0;
    403   for (i = 0; i < Ncatalog; i++) {
    404     for (j = 0; j < catalog[i].Naverage; j++) {
    405       Nmax = MAX (Nmax, catalog[i].average[j].Nmeasure);
    406     }
    407   }
     411  for (i = 0; i < catalog[0].Naverage; i++) {
     412    Nmax = MAX (Nmax, catalog[0].average[i].Nmeasure);
     413  }
     414
    408415  ALLOCATE (R, double, Nmax);
    409416  ALLOCATE (D, double, Nmax);
     
    414421  TOOFEW = MAX (5, SRC_MEAS_TOOFEW);
    415422
    416   Ns = 3;
     423  Ns = CLIP_THRESH;
    417424  Ndel = Nave = 0;
    418   for (i = 0; i < Ncatalog; i++) {
    419     for (j = 0; j < catalog[i].Naverage; j++) {
    420425     
    421       /* accumulate list of valid measurements */
    422       m = catalog[i].average[j].measureOffset;
    423       N = 0;
    424       for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    425 
    426         // skip measurements based on user selected criteria
    427         if (!MeasFilterTest(&catalog[i].measure[m])) continue;
    428 
    429         R[N] = getMeanR(&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]);
    430         D[N] = getMeanD(&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]);
    431         dR[N] = GetAstromError( &catalog[i].measure[m], ERROR_MODE_RA);
    432         dD[N] = GetAstromError( &catalog[i].measure[m], ERROR_MODE_DEC);
    433         if (isnan(R[N]) || isnan(D[N])) continue;
    434         N++;
     426  /* loop over each object in the catalog */
     427  for (j = 0; j < catalog[0].Naverage; j++) {
     428   
     429    /* accumulate list of valid measurements */
     430    m = catalog[0].average[j].measureOffset;
     431    N = 0;
     432    for (k = 0; k < catalog[0].average[j].Nmeasure; k++, m++) {
     433     
     434      // skip measurements based on user selected criteria
     435      if (!MeasFilterTest(&catalog[0].measure[m])) continue;
     436      R[N] = catalog[0].measure[m].dR;
     437      D[N] = catalog[0].measure[m].dD;
     438      dR[N] = GetAstromError( &catalog[0].measure[m], ERROR_MODE_RA);
     439      dD[N] = GetAstromError( &catalog[0].measure[m], ERROR_MODE_DEC);
     440      if (isnan(R[N]) || isnan(D[N])) continue;
     441      N++;
     442    }
     443    if (N <= TOOFEW) continue;
     444   
     445    /* 3-sigma clip based on stats of inner 50% */
     446    initstats ("MEAN");
     447    liststats (R, dR, N, &statsR);
     448    liststats (D, dD, N, &statsD);
     449   
     450    statsR.sigma = MAX (MIN_ERROR, statsR.sigma);
     451    statsD.sigma = MAX (MIN_ERROR, statsD.sigma);
     452   
     453    /* compare per-object distance to this standard deviation, and flag outliers*/
     454    m = catalog[0].average[j].measureOffset;
     455    N = 0;
     456    for (k = 0; k < catalog[0].average[j].Nmeasure; k++, m++) {
     457      //reset flag on each invocation
     458      catalog[0].measure[m].dbFlags &= ~ID_MEAS_POOR_ASTROM;
     459
     460      // skip measurements based on user selected criteria
     461      if (!MeasFilterTest(&catalog[0].measure[m])) continue;
     462     
     463      x = catalog[0].measure[m].dR - statsR.median;
     464      y = catalog[0].measure[m].dD - statsD.median;
     465      theta = atan2(y,x);
     466      if ((x*x + y*y) > (SQR(statsR.sigma * Ns * cos(theta)) +
     467                         SQR(statsD.sigma * Ns * sin(theta)))) {   
     468        catalog[0].measure[m].dbFlags |= ID_MEAS_POOR_ASTROM;
     469        Ndel++;
    435470      }
    436       if (N <= TOOFEW) continue;
    437 
    438       /* 3-sigma clip based on stats of inner 50% */
    439       initstats ("INNER_MEAN");
    440       liststats (R, dR, N, &statsR);
    441       liststats (R, dR, N, &statsD);
    442 
    443       statsR.sigma = MAX (MIN_ERROR, statsR.sigma);
    444       statsD.sigma = MAX (MIN_ERROR, statsD.sigma);
    445 
    446       for (k = m = 0; k < N; k++) {
    447         if ((fabs (R[k] - statsR.median) < Ns*statsR.sigma) &&
    448             (fabs (D[k] - statsD.median) < Ns*statsD.sigma)) {
    449           R[m] = R[k];
    450           dR[m] = dR[k];
    451           D[m] = D[k];
    452           dD[m] = dD[k];
    453           m++;
    454         }
     471      N++;
     472      Nave ++;
     473    }
     474
     475    //examine results
     476    relastroVisualPlotOutliers(catalog, catalog[0].average[j].measureOffset,
     477                               catalog[0].average[j].Nmeasure,
     478                               statsR, statsD, Ns);
     479  }
     480 
     481  if (VERBOSE) fprintf (stderr, "%d measures marked poor, %d total\n", Ndel, Nave);
     482  free (R);
     483  free(dR);
     484  free(D);
     485  free(dD);
     486}
     487
     488
     489/** an alternative outlier rejection scheme */
     490void FlagOutliers2D (Catalog *catalog) {
     491
     492  int i, j, k, m, N, Ndel, Nave, Nmax, TOOFEW, Nsecfilt;
     493  double *index;
     494  double Ns, theta, x, y;
     495  double *R, *D, *dR, *dD, *d2;
     496  StatType statsR, statsD;
     497
     498  Nsecfilt = GetPhotcodeNsecfilt();
     499  assert(catalog[0].Nsecfilt == Nsecfilt);
     500
     501  if (VERBOSE) fprintf (stderr, "marking poor measures\n");
     502  Nmax = 0;
     503  for (i = 0; i < catalog[0].Naverage; i++) {
     504    Nmax = MAX (Nmax, catalog[0].average[i].Nmeasure);
     505  }
     506
     507  ALLOCATE (R, double, Nmax);
     508  ALLOCATE (D, double, Nmax);
     509  ALLOCATE (dR, double, Nmax);
     510  ALLOCATE (dD, double, Nmax);
     511  ALLOCATE (d2, double, Nmax);
     512  ALLOCATE (index, double, Nmax);
     513
     514  /* it makes no sense to mark 3-sigma outliers with <5 measurements */
     515  TOOFEW = MAX (5, SRC_MEAS_TOOFEW);
     516
     517  Ns = CLIP_THRESH;
     518  Ndel = Nave = 0;
     519     
     520  /* loop over each object in the catalog */
     521  for (j = 0; j < catalog[0].Naverage; j++) {
     522   
     523    /* accumulate list of valid measurements */
     524    m = catalog[0].average[j].measureOffset;
     525    N = 0;
     526   
     527    for (k = 0; k < catalog[0].average[j].Nmeasure; k++, m++) {
     528     
     529      //reset flag on each invocation
     530      catalog[0].measure[m].dbFlags &= ~ID_MEAS_POOR_ASTROM;
     531     
     532      // skip measurements based on user selected criteria
     533      if (!MeasFilterTest(&catalog[0].measure[m])) continue;
     534      R[N] = catalog[0].measure[m].dR;
     535      D[N] = catalog[0].measure[m].dD;
     536      dR[N] = GetAstromError( &catalog[0].measure[m], ERROR_MODE_RA);
     537      dD[N] = GetAstromError( &catalog[0].measure[m], ERROR_MODE_DEC);
     538      if (isnan(R[N]) || isnan(D[N])) continue;
     539      N++;
     540    }
     541    if (N <= TOOFEW) continue;
     542   
     543    /* calculate mean of all points*/
     544    initstats ("MEAN");
     545    liststats (R, dR, N, &statsR);
     546    liststats (D, dD, N, &statsD);
     547    statsR.sigma = MAX (MIN_ERROR, statsR.sigma);
     548    statsD.sigma = MAX (MIN_ERROR, statsD.sigma);
     549   
     550    /* calculate deviations of all points*/
     551    m = catalog[0].average[j].measureOffset;
     552    N = 0;
     553    for (k = 0; k < catalog[0].average[j].Nmeasure; k++, m++) {
     554      //skip bad measurements
     555      if (!MeasFilterTest(&catalog[0].measure[m])) continue; 
     556      x = catalog[0].measure[m].dR - statsR.median;
     557      y = catalog[0].measure[m].dD - statsD.median;
     558      theta = atan2(y,x);
     559      d2[N] = (x*x + y*y) / (SQR(statsR.sigma * Ns * cos(theta)) +
     560                             SQR(statsD.sigma * Ns * sin(theta)));     
     561      index[N] = m;
     562      N++;
     563    }
     564   
     565    // sort d2
     566    dsortpair(d2, index, N);
     567    N = (N/2 > (N-1)) ? N/2 : N-1;
     568
     569    // recalculate image center, sigma based on closest 50% of points
     570    for(k = 0;  k < N; k++) {
     571      int ind = (int) index[k];
     572      R[k] = catalog[0].measure[ind].dR;
     573      D[k] = catalog[0].measure[ind].dD;
     574      dR[k] = GetAstromError( &catalog[0].measure[ind], ERROR_MODE_RA);
     575      dD[k] = GetAstromError( &catalog[0].measure[ind], ERROR_MODE_DEC);
     576    }
     577    liststats (R, dR, N, &statsR);
     578    liststats (D, dD, N, &statsD);
     579    statsR.sigma = MAX (MIN_ERROR, statsR.sigma);
     580    statsD.sigma = MAX (MIN_ERROR, statsD.sigma);
     581   
     582    // use these new statistics to flag outliers
     583    m = catalog[0].average[j].measureOffset;
     584    N = 0;
     585    for (k = 0; k < catalog[0].average[j].Nmeasure; k++, m++) {
     586      //skip bad measurements
     587      if (!MeasFilterTest(&catalog[0].measure[m])) continue; 
     588      x = catalog[0].measure[m].dR - statsR.median;
     589      y = catalog[0].measure[m].dD - statsD.median;
     590      theta = atan2(y,x);
     591      d2[N] = (x*x + y*y) / (SQR(statsR.sigma * Ns * cos(theta)) +
     592                             SQR(statsD.sigma * Ns * sin(theta)));     
     593      if ((d2[N]) > 1) {
     594        catalog[0].measure[m].dbFlags |= ID_MEAS_POOR_ASTROM;
     595        Ndel ++;
    455596      }
    456       initstats ("MEAN");
    457       liststats (R, dR, m, &statsR);
    458       liststats (D, dD, m, &statsD);
    459       statsR.sigma = MAX (MIN_ERROR, statsR.sigma);
    460       statsD.sigma = MAX (MIN_ERROR, statsD.sigma);
    461 
    462       /* apply to list of all relevant measurements*/
    463       m = catalog[i].average[j].measureOffset;
    464       N = 0;
    465       for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    466         // skip measurements based on user selected criteria
    467         if (!MeasFilterTest(&catalog[i].measure[m])) continue;
    468 
    469         R[N] = getMeanR(&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]);
    470         D[N] = getMeanD(&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]);
    471         dR[N] = GetAstromError( &catalog[i].measure[m], ERROR_MODE_RA);
    472         dD[N] = GetAstromError( &catalog[i].measure[m], ERROR_MODE_DEC);
    473        
    474         if((fabs(R[N] - statsR.median) > Ns * statsR.sigma) ||
    475            (fabs(D[N] - statsR.median) > Ns * statsD.sigma)) {
    476           catalog[i].measure[m].dbFlags |= ID_MEAS_POOR_ASTROM;
    477           Ndel++;
    478         }
    479         N++;
    480         Nave ++;
    481       }
    482       initstats (STATMODE);
    483    
    484       if (TRUE) fprintf (stderr, "%d measures marked poor, %d total\n", Ndel, Nave);
    485       free (R);
    486       free(dR);
    487       free(D);
    488       free(dD);
    489     }
    490   }
    491 }
    492 
    493  
     597      N++;
     598      Nave++;
     599    }  //done rejecting outliers
     600
     601    //examine results
     602    relastroVisualPlotOutliers(catalog, catalog[0].average[j].measureOffset,
     603                               catalog[0].average[j].Nmeasure,
     604                               statsR, statsD, Ns);
     605   
     606  } //done looping over objects
     607 
     608  if (VERBOSE) fprintf (stderr, "%d measures marked poor, %d total\n", Ndel, Nave);
     609  free (R);
     610  free(dR);
     611  free(D);
     612  free(dD);
     613  free(d2);
     614  free(index);
     615}
     616
     617
     618
    494619/** Determine whether a measurement should be included in the analysis, based on supplied filter criteria */
    495620int MeasFilterTest(Measure *measure) {
     
    501626  if (!finite(measure[0].dR) || !finite(measure[0].dD)) return FALSE;
    502627  if (!finite(measure[0].M)) return FALSE; //XXX is this necessary for all relastro tasks?
    503 
     628 
    504629  /* select measurements by photcode, or equiv photcode, if specified */
    505630  if (NphotcodesKeep > 0) {
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/UpdateObjects.c

    r23649 r24243  
    9898
    9999        //does the measurement pass the supplied filtering constraints?
    100         if (!MeasFilterTest(&catalog[i].measure[m])) continue;
     100        if (!MeasFilterTest(&catalog[i].measure[m])) {
     101          catalog[i].measure[m].dbFlags &= ~ID_MEAS_USED_OBJ;
     102          continue;
     103        }
    101104
    102105        //outlier rejection
    103         if (FlagOutliers && (catalog[i].measure[m].dbFlags & ID_MEAS_POOR_ASTROM)) {
     106        if (FlagOutlier && (catalog[i].measure[m].dbFlags & ID_MEAS_POOR_ASTROM)) {
     107          catalog[i].measure[m].dbFlags &= ~ID_MEAS_USED_OBJ;
    104108          continue;
    105109        }
     
    114118        # endif
    115119
     120        catalog[i].measure[m].dbFlags |= ID_MEAS_USED_OBJ;
     121
    116122        R[N] = getMeanR (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]);
    117123        D[N] = getMeanD (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]);
     
    141147      if (N < SRC_MEAS_TOOFEW) {
    142148        // XXX need to define PHOTOM and ASTROM object flags
    143         // catalog[i].average[j].code |= ID_STAR_FEW;
    144         continue;
     149        catalog[i].average[j].flags |= ID_STAR_FEW;
     150        if (N < 2) continue;
    145151      }
    146152
     
    236242      }
    237243
     244      //make sure that the fit succeeded
     245      assert(finite(fit.Ro) && finite(fit.Do) &&
     246             finite(fit.dRo) && finite(fit.dDo) &&
     247             finite(fit.uR) && finite(fit.uD) &&
     248             finite(fit.duR) && finite(fit.duD) &&
     249             finite(fit.p) && finite(fit.dp));
     250
    238251      // the measure fields must be updated before the average fields
    239252      m = catalog[i].average[j].measureOffset;
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/args.c

    r23649 r24243  
    4040    FIT_TARGET = TARGET_MOSAICS;
    4141  }
     42
     43  FlagOutlier = FALSE;
    4244  if ((N = get_argument (argc, argv, "-clip"))) {
    4345    remove_argument (N, &argc, argv);
     46    CLIP_THRESH = atof (argv[N]);
     47    remove_argument (N, &argc, argv);
    4448    FlagOutlier = TRUE;
    4549  }
     50
    4651  if (FIT_TARGET == TARGET_NONE) usage();
    4752
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/bcatalog.c

    r23649 r24243  
    4848     
    4949      //filter objects based on user supplied criteria
    50       if (!MeasFilterTest(&catalog[0].measure[offset])) continue;
     50      if (!MeasFilterTest(&catalog[0].measure[offset])) {
     51        catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP;
     52        continue;
     53      }
    5154
    5255      //filter out outliers
    53       if (FlagOutlier && (catalog[0].measure[offset].dbFlags & ID_MEAS_POOR_ASTROM)) continue;
    54      
     56      if (FlagOutlier && (catalog[0].measure[offset].dbFlags & ID_MEAS_POOR_ASTROM)) {
     57        catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP;
     58        continue;
     59      }
     60      catalog[0].measure[offset].dbFlags |= ID_MEAS_USED_CHIP;
     61
    5562      // re-assess on each run of relastro if a measurement should be used
    5663
     
    7380        subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_AREA;
    7481      }
     82     
    7583      Nmeasure ++;
    7684      Nm ++;
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/load_catalogs.c

    r23649 r24243  
    3232    //outlier rejection
    3333    if (FlagOutlier) {
    34       FlagOutliers(&tcatalog, 1);
     34      FlagOutliers(&tcatalog);
    3535    }
    3636
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/relastroVisual.c

    r23344 r24243  
    1616
    1717static int isVisual = FALSE;
    18 static int plotRawRef = TRUE;
    19 static int plotScatter = TRUE;
    20 static int plotResid = TRUE;
    21 static int plotVector = TRUE;
     18static int plotRawRef = FALSE;
     19static int plotScatter = FALSE;
     20static int plotResid = FALSE;
     21static int plotVector = FALSE;
     22static int plotOutliers = TRUE;
    2223
    2324/** Spawn a kapa window */
     
    7576                     float xVec[], float yVec[],
    7677                     int npts, int *kapaID) {
    77     if (!plotResid) return 1;
     78    if (!isVisual || !plotResid) return TRUE;
    7879    Graphdata graphdata;
    7980    KapaSection section;
    8081
    81     if (!initWindow(kapaID)) return 0;
     82    if (!initWindow(kapaID)) return FALSE;
    8283
    8384    KapaInitGraph(&graphdata);
     
    389390  return 1;
    390391}
     392
     393int relastroVisualPlotOutliers(Catalog *catalog, int offset, int Nmeasure,
     394                               StatType statsR, StatType statsD, double thresh) {
     395   
     396  float *Din, *Rin, *Dout, *Rout;
     397  double xmin, xmax, ymin, ymax, range;
     398  float xCirc[100], yCirc[100];
     399  int m, i;
     400  int Nin, Nout;
     401  Measure meas;
     402  Graphdata graphdata;
     403  KapaSection section;
     404 
     405  if (!isVisual || !plotOutliers) return 1;
     406  if (!initWindow(&kapa)) return 0;
     407 
     408  // populate vectors
     409  ALLOCATE(Din, float, Nmeasure);
     410  ALLOCATE(Rin, float, Nmeasure);
     411  ALLOCATE(Dout, float, Nmeasure);
     412  ALLOCATE(Rout, float, Nmeasure);
     413 
     414  //create the threshhold ellipse
     415  for(i = 0; i < 100; i++) {
     416    xCirc[i] = statsR.median + thresh * statsR.sigma * cos(2 * 3.14 / 99. * i);
     417    yCirc[i] = statsD.median + thresh * statsD.sigma * sin(2 * 3.14 / 99. * i); 
     418  }
     419
     420  m = offset;
     421  Nin = Nout = 0;
     422  xmin = +FLT_MAX;
     423  xmax = -FLT_MAX;
     424  ymax = -FLT_MAX;
     425  ymin = +FLT_MAX;
     426  for(i = 0; i < Nmeasure; i++, m++) {
     427    meas = catalog[0].measure[m];
     428    if (!MeasFilterTest(&meas)) continue;
     429    xmin = MIN(xmin, meas.dR);
     430    xmax = MAX(xmax, meas.dR);
     431    ymin = MIN(ymin, meas.dD);
     432    ymax = MAX(ymax, meas.dD);
     433   
     434    if (meas.dbFlags & ID_MEAS_POOR_ASTROM) {
     435      Rout[Nout] = (float)(meas.dR);
     436      Dout[Nout] = (float)(meas.dD);
     437      fprintf(stderr, "r: %f\td: %f\t outlier: 1\n", Rout[Nout], Dout[Nout]);
     438      Nout++;
     439    } else {
     440      Rin[Nin] = (float)(meas.dR);
     441      Din[Nin] = (float)(meas.dD);
     442      fprintf(stderr, "r: %f\td: %f\t outlier: 0\n", Rin[Nin], Din[Nin]);
     443      Nin++;
     444    }
     445  }
     446 
     447  range = (xmax - xmin);
     448  xmin -= .1 * range;
     449  xmax += .1 * range;
     450  range = (ymax - ymin);
     451  ymax += .1 * range;
     452  ymin -= .1 * range;
     453
     454  //temporary fix
     455  xmin = -1; xmax = 1; ymin = -1; ymax = 1;
     456
     457
     458  //initialize graph info
     459  section.x = 0; section.y = 0; section.dx = 1; section.dy = 1;
     460  section.name = "junk";
     461 
     462  KapaInitGraph(&graphdata);
     463  KapaClearPlots(kapa);
     464  KapaSetFont(kapa, "helvetica", 14);
     465 
     466  graphdata.ptype = 7;
     467  graphdata.style = 2;
     468  graphdata.size = 3;
     469  graphdata.xmin = xmin;
     470  graphdata.xmax = xmax;
     471  graphdata.ymin = ymin;
     472  graphdata.ymax = ymax;
     473
     474  KapaSetSection(kapa, &section);
     475  KapaSetLimits(kapa, &graphdata);
     476  KapaBox(kapa, &graphdata);
     477
     478  KapaSendLabel( kapa, "RA (arcsec)", KAPA_LABEL_XM);
     479  KapaSendLabel( kapa, "Dec (arcsec)", KAPA_LABEL_YM);
     480  KapaSendLabel( kapa, "Points flagged as outliers (red)",
     481                 KAPA_LABEL_XP);
     482
     483  graphdata.color = KapaColorByName("green");
     484  KapaPrepPlot(kapa, Nin, &graphdata);
     485  KapaPlotVector(kapa, Nin, Rin, "x");
     486  KapaPlotVector(kapa, Nin, Din, "y");
     487
     488  graphdata.color = KapaColorByName("red");
     489  KapaPrepPlot(kapa, Nout, &graphdata);
     490  KapaPlotVector(kapa, Nout, Rout, "x");
     491  KapaPlotVector(kapa, Nout, Dout, "y");
     492
     493  graphdata.color = KapaColorByName("black");
     494  graphdata.ptype = 0;
     495  graphdata.style = 0;
     496  KapaPrepPlot(kapa, 100, &graphdata);
     497  KapaPlotVector(kapa, 100, xCirc, "x");
     498  KapaPlotVector(kapa, 100, yCirc, "y");
     499
     500
     501 
     502  askUser(&plotOutliers);
     503
     504  FREE(Rout);
     505  FREE(Dout);
     506  FREE(Rin);
     507  FREE(Din);
     508
     509  return TRUE;
     510}
     511 
     512 
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/relastroVisual.h

    r23344 r24243  
    44int relastroVisualPlotRawRef(StarData *raw, StarData *ref, double dRmax, int numObj);
    55int relastroVisualPlotScatter(double values[], double thresh, int npts);
     6int relastroVisualPlotOutliers(Catalog *catalog, int offset, int Nmeasure,
     7                               StatType statsR, StatType statsD, double thresh);
    68
    79#endif
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/relastro_objects.c

    r23650 r24243  
    99  Catalog catalog;
    1010
    11   //CNB
    12   fprintf(stderr, "beginning relastro objects\n");
    1311
    1412  // load the current sky table (layout of all SkyRegions)
     
    1917  skylist = SkyListByPatch (sky, -1, &UserPatch);
    2018
    21   //CNB
    22   fprintf(stder, "looping over skylist regions\n");
    2319  // load data from each region file, only use bright stars
    2420  for (i = 0; i < skylist[0].Nregions; i++) {
     
    4238    }
    4339
    44     if (FlagOutliers) {
    45       FlagOutliers(&catalog, 1);
     40    if (FlagOutlier) {
     41      FlagOutliers(&catalog);
    4642    }
    4743
     
    5753    }
    5854
    59     //CNB
    60     fprintf(stderr, "updating objects\n");
    6155    UpdateObjects (&catalog, 1);
    6256
  • branches/cnb_branches/cnb_branch_20090301/ppImage

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/cnb_branches/cnb_branch_20090301/ppStack

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/cnb_branches/cnb_branch_20090301/ppSub

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/cnb_branches/cnb_branch_20090301/psModules

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/cnb_branches/cnb_branch_20090301/psModules/src/astrom/pmAstrometryModel.c

    r19595 r24243  
    471471        char *thisone = psMetadataLookupStr (NULL, chip->concepts, "CHIP.NAME");
    472472        if (!thisone) continue;
    473         if (!strcmp (name, thisone)) return (chip);
     473        if (!strcmp (name, thisone)) return (chip);
    474474    }
    475475    return NULL;
  • branches/cnb_branches/cnb_branch_20090301/psastro

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/cnb_branches/cnb_branch_20090301/psastro/src/psastroModel.c

    r21409 r24243  
    4646        exit (1);
    4747    }
    48    
     48
    4949    // run the full astrometry analysis (chip and/or mosaic)
    5050    if (!psastroModelAdjust (config)) {
     
    5252        exit (1);
    5353    }
    54    
     54
    5555    // save the model
    5656    if (!psastroModelDataSave (config)) {
  • branches/cnb_branches/cnb_branch_20090301/psphot

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarpVersion.c

    r23352 r24243  
    1010 *  Copyright 2009 Institute for Astronomy, University of Hawaii
    1111 */
    12 
    1312#ifdef HAVE_CONFIG_H
    1413#include <config.h>
     
    2019#include <psphot.h>
    2120#include <ppStats.h>
    22 #include "pswarp.h"
    23 
    2421
    2522psString pswarpVersion(void)
Note: See TracChangeset for help on using the changeset viewer.