IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38698


Ignore:
Timestamp:
Sep 3, 2015, 6:17:02 AM (11 years ago)
Author:
eugene
Message:

add weights to the AstromOffset fitting

Location:
branches/eam_branches/ipp-20150625/Ohana/src/libdvo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150625/Ohana/src/libdvo/include/libdvo_astro.h

    r38693 r38698  
    170170/* in AstromOffsetMapOps.c */
    171171float AstromOffsetMapValue (AstromOffsetMap *map, float x, float y, int xdir);
    172 int AstromOffsetMapFit (AstromOffsetMap *map, float *x, float *y, float *f, int Npts, int xdir);
     172int AstromOffsetMapFit (AstromOffsetMap *map, float *x, float *y, float *f, float *df, int Npts, int xdir);
    173173
    174174/* in AstromOffsetMapUtils.c */
  • branches/eam_branches/ipp-20150625/Ohana/src/libdvo/src/AstromOffsetMapOps.c

    r38693 r38698  
    66int dump_map_data (float *x, float *y, float *f, int Npts, char *filename);
    77int AstromOffsetMapFit_Chisq (AstromOffsetMap *map, float *x, float *y, float *f, int Npts, int xdir);
    8 int AstromOffsetMapFit_Median (AstromOffsetMap *map, float *x, float *y, float *f, int Npts, int xdir);
     8int AstromOffsetMapFit_Mean (AstromOffsetMap *map, float *x, float *y, float *f, float *df, int Npts, int xdir);
    99
    1010float AstromOffsetMapValue (AstromOffsetMap *map, float x, float y, int xdir) {
     
    6868}
    6969
    70 int AstromOffsetMapFit (AstromOffsetMap *map, float *x, float *y, float *f, int Npts, int xdir) {
    71 
    72   int status = AstromOffsetMapFit_Median (map, x, y, f, Npts, xdir);
     70int AstromOffsetMapFit (AstromOffsetMap *map, float *x, float *y, float *f, float *df, int Npts, int xdir) {
     71
     72  int status = AstromOffsetMapFit_Mean (map, x, y, f, df, Npts, xdir);
    7373  return status;
    7474}
     
    374374// given (x,y),value vector sets, choose the map that minimizes the difference between
    375375// the values and bilinear interpolation of the map
    376 int AstromOffsetMapFit_Median (AstromOffsetMap *map, float *x, float *y, float *f, int Npts, int xdir) {
     376int AstromOffsetMapFit_Mean (AstromOffsetMap *map, float *x, float *y, float *f, float *df, int Npts, int xdir) {
    377377
    378378  int i, ix, iy;
     
    389389  int Npix = Nx*Ny;
    390390
    391   double **values;
     391  double **values, **dvalues;
    392392  int    *Nvalue;
    393393  ALLOCATE (Nvalue, int, Npix);
    394394  ALLOCATE (values, double *, Npix);
     395  ALLOCATE (dvalues, double *, Npix);
    395396  for (i = 0; i < Npix; i++) {
    396397    ALLOCATE (values[i], double, Npts);
     398    ALLOCATE (dvalues[i], double, Npts);
    397399    Nvalue[i] = 0;
    398400  }
     
    403405    // data value & weight for this point
    404406    if (!isfinite(f[i])) continue;
     407    if (!isfinite(df[i])) continue;
     408    if (df[i] == 0.0) continue;
    405409
    406410    // if (mask && (mask[i] & maskValue)) continue;
     
    417421    int N = Nvalue[I];
    418422    values[I][N] = f[i];
     423    dvalues[I][N] = df[i];
    419424    Nvalue[I] ++;
    420425  }   
     
    424429      int I = ix + Nx * iy;
    425430      if (Nvalue[I] > 5) {
    426         vstats_getstats (values[I], NULL, NULL, Nvalue[I], &stats);
     431        vstats_getstats (values[I], dvalues[I], NULL, Nvalue[I], &stats);
    427432        Vptr[I] = stats.mean;
    428433      } else {
     
    435440  for (i = 0; i < Npix; i++) {
    436441    free (values[i]);
     442    free (dvalues[i]);
    437443  }   
    438444  free (values);
     445  free (dvalues);
    439446  free (Nvalue);
    440447
Note: See TracChangeset for help on using the changeset viewer.