Changeset 38698
- Timestamp:
- Sep 3, 2015, 6:17:02 AM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150625/Ohana/src/libdvo
- Files:
-
- 2 edited
-
include/libdvo_astro.h (modified) (1 diff)
-
src/AstromOffsetMapOps.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150625/Ohana/src/libdvo/include/libdvo_astro.h
r38693 r38698 170 170 /* in AstromOffsetMapOps.c */ 171 171 float AstromOffsetMapValue (AstromOffsetMap *map, float x, float y, int xdir); 172 int AstromOffsetMapFit (AstromOffsetMap *map, float *x, float *y, float *f, int Npts, int xdir);172 int AstromOffsetMapFit (AstromOffsetMap *map, float *x, float *y, float *f, float *df, int Npts, int xdir); 173 173 174 174 /* in AstromOffsetMapUtils.c */ -
branches/eam_branches/ipp-20150625/Ohana/src/libdvo/src/AstromOffsetMapOps.c
r38693 r38698 6 6 int dump_map_data (float *x, float *y, float *f, int Npts, char *filename); 7 7 int AstromOffsetMapFit_Chisq (AstromOffsetMap *map, float *x, float *y, float *f, int Npts, int xdir); 8 int AstromOffsetMapFit_Me dian (AstromOffsetMap *map, float *x, float *y, float *f, int Npts, int xdir);8 int AstromOffsetMapFit_Mean (AstromOffsetMap *map, float *x, float *y, float *f, float *df, int Npts, int xdir); 9 9 10 10 float AstromOffsetMapValue (AstromOffsetMap *map, float x, float y, int xdir) { … … 68 68 } 69 69 70 int AstromOffsetMapFit (AstromOffsetMap *map, float *x, float *y, float *f, int Npts, int xdir) {71 72 int status = AstromOffsetMapFit_Me dian (map, x, y,f, Npts, xdir);70 int 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); 73 73 return status; 74 74 } … … 374 374 // given (x,y),value vector sets, choose the map that minimizes the difference between 375 375 // the values and bilinear interpolation of the map 376 int AstromOffsetMapFit_Me dian (AstromOffsetMap *map, float *x, float *y, float *f, int Npts, int xdir) {376 int AstromOffsetMapFit_Mean (AstromOffsetMap *map, float *x, float *y, float *f, float *df, int Npts, int xdir) { 377 377 378 378 int i, ix, iy; … … 389 389 int Npix = Nx*Ny; 390 390 391 double **values ;391 double **values, **dvalues; 392 392 int *Nvalue; 393 393 ALLOCATE (Nvalue, int, Npix); 394 394 ALLOCATE (values, double *, Npix); 395 ALLOCATE (dvalues, double *, Npix); 395 396 for (i = 0; i < Npix; i++) { 396 397 ALLOCATE (values[i], double, Npts); 398 ALLOCATE (dvalues[i], double, Npts); 397 399 Nvalue[i] = 0; 398 400 } … … 403 405 // data value & weight for this point 404 406 if (!isfinite(f[i])) continue; 407 if (!isfinite(df[i])) continue; 408 if (df[i] == 0.0) continue; 405 409 406 410 // if (mask && (mask[i] & maskValue)) continue; … … 417 421 int N = Nvalue[I]; 418 422 values[I][N] = f[i]; 423 dvalues[I][N] = df[i]; 419 424 Nvalue[I] ++; 420 425 } … … 424 429 int I = ix + Nx * iy; 425 430 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); 427 432 Vptr[I] = stats.mean; 428 433 } else { … … 435 440 for (i = 0; i < Npix; i++) { 436 441 free (values[i]); 442 free (dvalues[i]); 437 443 } 438 444 free (values); 445 free (dvalues); 439 446 free (Nvalue); 440 447
Note:
See TracChangeset
for help on using the changeset viewer.
