*** simpleaffy2.orig 2004-02-23 20:01:29.000000000 +0100 --- simpleaffy2.c 2004-05-25 15:27:47.000000000 +0200 *************** *** 503,510 **** // given a spot on a chip, which grid cell is it in? void grid(int x, int y, int nrow, int ncol, int gridx, int gridy, int *gx, int *gy) { ! *gx = (int) ((double) (gridx * x) / (double) nrow); ! *gy = (int) ((double) (gridy * y) / (double) ncol); } --- 503,510 ---- // given a spot on a chip, which grid cell is it in? void grid(int x, int y, int nrow, int ncol, int gridx, int gridy, int *gx, int *gy) { ! *gx = (int) ((double) (gridx * x) / (double) ncol); ! *gy = (int) ((double) (gridy * y) / (double) nrow); } *************** *** 512,518 **** void lookup(int *idx, int no, double *raw, int ncol, int *x, int *y, double *val) { *x = idx[no] % ncol; *y = idx[no] / ncol; ! *val = raw[idx[no]]; } --- 512,518 ---- void lookup(int *idx, int no, double *raw, int ncol, int *x, int *y, double *val) { *x = idx[no] % ncol; *y = idx[no] / ncol; ! *val = raw[idx[no]-1]; } *************** *** 522,528 **** void bgmas(int *idx, int *nidx, double *raw, int *nraw, int *rws, int *cls, int *xgridsize, int *ygridsize, double *zonebg, double *zonesd, double *corrected) { ! int i,j,x,y,gx,gy,gn,pn; double tmp; double val; double w,wsum,bg,nz; --- 522,528 ---- void bgmas(int *idx, int *nidx, double *raw, int *nraw, int *rws, int *cls, int *xgridsize, int *ygridsize, double *zonebg, double *zonesd, double *corrected) { ! int i,j,x,y,gx,gy,gn,pn,cellsize; double tmp; double val; double w,wsum,bg,nz; *************** *** 539,550 **** double *xc = (double *) R_alloc(ngrid,sizeof(double)); double *yc = (double *) R_alloc(ngrid,sizeof(double)); // Initialise the arrays containing the computed backgrounds for each cell for(i = 0;i