IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37910


Ignore:
Timestamp:
Feb 14, 2015, 3:31:46 PM (11 years ago)
Author:
eugene
Message:

more updates to cam correctino

Location:
branches/eam_branches/ipp-20150112/Ohana/src/uniphot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150112/Ohana/src/uniphot/include/setastrom.h

    r37908 r37910  
    1515  int Nvalues;
    1616  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
    1920  Matrix **matrix; // allocate an array of pointers
    2021  // 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  
    4040  if (!gfits_scan (&theader, "NX_CHIP", "%d", 1, &Nx))      return (NULL);
    4141  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);
    4244
    4345  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
    4453
    4554  while (TRUE) {
     
    6675}
    6776
    68 int get_kh_correction (int sub, int chip, double *dX, double *dY, float Minst) {
    69 
    70   Spline *spline = NULL;
     77int get_cam_correction (CamCorrection *cam, int chip, int filter, double *dX, double *dY, float Xccd, float Yccd) {
    7178
    7279  *dX = 0.0;
    7380  *dY = 0.0;
    7481
    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);
    7685
    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;
    8188
    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;
    8699  return (TRUE);
    87100}
Note: See TracChangeset for help on using the changeset viewer.