Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/flatcorr_io.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/flatcorr_io.c	(revision 37577)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/flatcorr_io.c	(revision 37578)
@@ -183,4 +183,11 @@
 }
 
+// eddie uses cell_x = (int) (X + X_PAD) / (base + X_PAD)
+// where base = 600, X_PAD = 8, Y_PAD = 10.  denominator is thus (608,610), whic is (4880/8),(4864/8)
+// these match Eddie's NCELL_X,Y / CHIP_DX,DY, so I think we are good with this:
+
+# define X_PAD 8
+# define Y_PAD 10
+
 float FlatCorrectionOffset (FlatCorrectionTable *flatcorr, int ID, int X, int Y) {
 
@@ -191,6 +198,6 @@
 
   // convert X,Y to Xbin, Ybin:
-  int Xbin = MAX(MIN(X * flatcorr->image[seq].Nx / flatcorr->image[seq].DX, flatcorr->image[seq].Nx - 1), 0);
-  int Ybin = MAX(MIN(Y * flatcorr->image[seq].Ny / flatcorr->image[seq].DY, flatcorr->image[seq].Ny - 1), 0);
+  int Xbin = MAX(MIN((X + X_PAD) * flatcorr->image[seq].Nx / flatcorr->image[seq].DX, flatcorr->image[seq].Nx - 1), 0);
+  int Ybin = MAX(MIN((Y + Y_PAD) * flatcorr->image[seq].Ny / flatcorr->image[seq].DY, flatcorr->image[seq].Ny - 1), 0);
 
   // XXX warn if X,Y are out of range? not super important unless *way* out of range
