/* MX LIBRARY FUNCTION: mxqdphot0_qdb5_vf5 * * PURPOSE: * * determine iterative median sky background level and number of pixels used * * AUTHOR: K. J. Mighell (mighell@noao.edu) * * LANGUAGE: ANSI C * * DOCUMENTATION: http://www.noao.edu/staff/mighell/mx * * DATE: 20000316 * * MOD: 2 * * Copyleft (L) 2000 Kenneth John Mighell */ #include #include "mxqdphot.h" void mxqdphot0_qdb5_vf5 ( double **pxm, int x1, int y1, double *bkg_, int *bkgn_ ){ char mxfunc[] = "mxqdphot0_qdb5_vf5"; double bkg; int bkgn; double mean; int mean_n; #define SIZE 56 double bv[SIZE]; double tmpv[SIZE]; int xxx[SIZE] = { 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 6, 7, 8, 9, 1, 2, 10,11, 1, 2, 10,11, 1, 2, 10,11, 1, 2, 10,11, 1, 2, 10,11, 1, 2, 10,11, 1, 2, 10,11, 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 6, 7, 8, 9 }; int yyy[SIZE] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10,10,10,10,10,10,10, 11,11,11,11,11,11,11 }; int xx[11+1]; /* SPP->C: 0th element added to simplify conversion */ int yy[11+1]; /* SPP->C: 0th element added to simplify conversion */ double px; int k; double mdn; double adv; int tmp_n; int x; int y; x = x1 - 1; /* SPP->C: C uses a zero-offset index */ xx[1] = x - 5; xx[2] = x - 4; xx[3] = x - 3; xx[4] = x - 2; xx[5] = x - 1; xx[6] = x; xx[7] = x + 1; xx[8] = x + 2; xx[9] = x + 3; xx[10] = x + 4; xx[11] = x + 5; y = y1 - 1; /* SPP->C: C uses a zero-offset index */ yy[1] = y - 5; yy[2] = y - 4; yy[3] = y - 3; yy[4] = y - 2; yy[5] = y - 1; yy[6] = y; yy[7] = y + 1; yy[8] = y + 2; yy[9] = y + 3; yy[10] = y + 4; yy[11] = y + 5; mean = 0; for (k=0; k