IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40773


Ignore:
Timestamp:
Jun 2, 2019, 8:48:25 AM (7 years ago)
Author:
eugene
Message:

working on outlier rejection for fitslits

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20190329/src/opihi/mana/deimos_fitslit.c

    r40770 r40773  
    7676}
    7777
     78void fitflux () {
     79    // calculate elements of the chi-square for this row:
     80
     81    double R = 0.0, P = 0.0, P2 = 0.0, f = 0.0, fp = 0.0;
     82    double wt = 1.0;
     83
     84    for (int ix = 0; ix < Nx; ix++) {
     85     
     86      // skip NAN / Inf pixels in either window or slit
     87      if (!isfinite(Fwind[ix + iy*Nx])) continue;
     88      if (!isfinite(Fprof[ix + iy*Nx])) continue;
     89
     90      float fxy = Fwind[ix + iy*Nx];
     91      float pxy = Fprof[ix + iy*Nx];
     92
     93      R  += wt;
     94      P  += pxy*wt;
     95      P2 += pxy*pxy*wt;
     96      f  += fxy*wt;
     97      fp += fxy*pxy*wt;
     98    }
     99
     100    double det = R*P2 - P*P;
     101    double S = (P2*f - P*fp) / det;
     102    double F = (R*fp - P*f) / det;
     103}
Note: See TracChangeset for help on using the changeset viewer.