Changeset 37910
- Timestamp:
- Feb 14, 2015, 3:31:46 PM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150112/Ohana/src/uniphot
- Files:
-
- 2 edited
-
include/setastrom.h (modified) (1 diff)
-
src/cam_correction.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150112/Ohana/src/uniphot/include/setastrom.h
r37908 r37910 15 15 int Nvalues; 16 16 int Nfilters; // number of filters 17 int Nx; // number of chips in x 18 int Ny; // number of chips in y 17 int NchipX; // number of chips in x 18 int NchipY; // number of chips in y 19 int NxCCD; // number of pixels 19 20 Matrix **matrix; // allocate an array of pointers 20 21 // index = ix + iy*Nx + filter*Nx*Ny + dir*Nx*Ny*Nfilter -
branches/eam_branches/ipp-20150112/Ohana/src/uniphot/src/cam_correction.c
r37908 r37910 40 40 if (!gfits_scan (&theader, "NX_CHIP", "%d", 1, &Nx)) return (NULL); 41 41 if (!gfits_scan (&theader, "NY_CHIP", "%d", 1, &Ny)) return (NULL); 42 if (!gfits_scan (&theader, "DX_CHIP", "%d", 1, &dX)) return (NULL); 43 if (!gfits_scan (&theader, "DY_CHIP", "%d", 1, &dY)) return (NULL); 42 44 43 45 ALLOCATE (cam->matrix, Matrix *, Ndir*Nfilter*Nx*Ny); 46 47 cam->Nx = Nx; // for gpc1, should be 8 48 cam->Ny = Ny; // for gpc1, should be 8 49 cam->dX = dX; // superpixel sampling, x-dir 50 cam->dY = dY; // superpixel sampling, y-dir 51 cam->Ndir = Ndir; // for gpc1, should be 2 52 cam->Nfilter = Nfilter; // for gpc1, should be 5 44 53 45 54 while (TRUE) { … … 66 75 } 67 76 68 int get_kh_correction (int sub, int chip, double *dX, double *dY, float Minst) { 69 70 Spline *spline = NULL; 77 int get_cam_correction (CamCorrection *cam, int chip, int filter, double *dX, double *dY, float Xccd, float Yccd) { 71 78 72 79 *dX = 0.0; 73 80 *dY = 0.0; 74 81 75 // XXX need to include some limits on Minst? 82 // split out the chip number (eg 43 for XY43) into X and Y elements 83 int ix = (int) (chip / 10); 84 int iy = (int) (chip % 10); 76 85 77 spline = splineset[sub][0][chip]; 78 if (spline) { 79 *dX = spline_apply_dbl (spline->xk, spline->yk, spline->y2, spline->Nknots, Minst); 80 } 86 int dir = 0; // dX 87 int index = ix + iy*cam->Nx + filter*cam->Nx*cam->Ny + dir*cam->Nx*cam->Ny*cam->Nfilter; 81 88 82 spline = splineset[sub][1][chip]; 83 if (spline) { 84 *dY = spline_apply_dbl (spline->xk, spline->yk, spline->y2, spline->Nknots, Minst); 85 } 89 Matrix *matrix = cam->matrix[index]; 90 91 float *buffer = (float *) matrix->buffer; 92 93 int jx = MAX(MIN(Nx, Xccd / cam->dX), 0); 94 int jy = MAX(MIN(Nx, Yccd / cam->dY), 0); 95 96 float value = buffer[jx + jy*Nx]; 97 98 *dX = isnan(value) ? 0.0 : value; 86 99 return (TRUE); 87 100 }
Note:
See TracChangeset
for help on using the changeset viewer.
