IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 5, 2014, 4:02:53 PM (12 years ago)
Author:
eugene
Message:

add some visualization and ability to dump data to pmVisual; clip extreme outliers from psf model

Location:
branches/eam_branches/ipp-20140423/psModules/src/objects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140423/psModules/src/objects/pmPSFtryMakePSF.c

    r36623 r36816  
    220220    }
    221221
     222    // weed out extreme e0 outliers here: find the median and exclude points not in the
     223    // range MEDIAN / 5 < e0 < 5 * MEDIAN
     224    {
     225      psStats *e0stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN);
     226      if (psVectorStats (e0stats, e0, NULL, srcMask, 0xff)) {
     227        float e0med = e0stats->sampleMedian;
     228   
     229        for (int i = 0; i < sources->n; i++) {
     230          // skip any masked sources (failed to fit one of the model steps or get a magnitude)
     231          if (srcMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) continue;
     232
     233          if (e0->data.F32[i] < 0.2*e0med) {
     234            srcMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_OUTLIER;
     235          }
     236          if (e0->data.F32[i] > 5.0*e0med) {
     237            srcMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_OUTLIER;
     238          }
     239        }
     240      }
     241      psFree (e0stats);
     242    }
     243
    222244    // we run 'clipIter' cycles clipping in each of x and y, with only one iteration each.
    223245    // This way, the parameters masked by one of the fits will be applied to the others
  • branches/eam_branches/ipp-20140423/psModules/src/objects/pmSourceVisual.c

    r36623 r36816  
    545545    psFree (model);
    546546
     547    bool dumpData = false;
     548
    547549    // pause and wait for user input:
    548550    // continue, save (provide name), ??
    549     pmVisualAskUser(&plotPSF);
     551retry:
     552    pmVisualAskUserOrDump(&plotPSF, &dumpData);
     553    if (dumpData) {
     554      char name[128];
     555      fprintf (stderr, "filename: ");
     556      int status = fscanf (stdin, "%127s", name);
     557      if (status != 1) {
     558        fprintf (stderr, "odd response\n");
     559        goto retry;
     560      }
     561
     562      FILE *f = fopen (name, "w");
     563      if (!f) {
     564        fprintf (stderr, "cannot open %s for output\n", name);
     565        goto retry;
     566      }
     567      for (int i = 0; i < x->n; i++) {
     568        float vModel = pmTrend2DEval (trend, x->data.F32[i], y->data.F32[i]);
     569        fprintf (f, "%f %f %f %f %d\n", x->data.F32[i], y->data.F32[i], param->data.F32[i], vModel, mask->data.PS_TYPE_VECTOR_MASK_DATA[i]);
     570      }
     571      fclose (f);
     572      goto retry;
     573    }
    550574
    551575    return true;
Note: See TracChangeset for help on using the changeset viewer.