IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37101


Ignore:
Timestamp:
Jul 22, 2014, 3:40:58 PM (12 years ago)
Author:
eugene
Message:

use float for dX,dY, NX_SUB,NY_SUB

Location:
branches/eam_branches/ipp-20140717/Ohana/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140717/Ohana/src/addstar/src/BoundaryTreeIO.c

    r34260 r37101  
    11# include "addstar.h"
     2
     3/** this file is deprecated (functions moved to libdvo) ***/
    24
    35# define GET_COLUMN_NEW(OUT,NAME,TYPE)                                  \
  • branches/eam_branches/ipp-20140717/Ohana/src/addstar/src/findskycell.c

    r37036 r37101  
    2727int apply_tree (char *treefile, char *datafile);
    2828
    29 float SCALE = 1.0;
    30 int NX_SUB = 1;
    31 int NY_SUB = 1;
     29float SCALE  = 1.0;
     30float NX_SUB = 1.0;
     31float NY_SUB = 1.0;
    3232
    3333double R_MIN = 0.0;
     
    217217  ALLOCATE (tree.Xo,   double *, tree.Nzone);
    218218  ALLOCATE (tree.Yo,   double *, tree.Nzone);
    219   ALLOCATE (tree.dX,      int *, tree.Nzone);
    220   ALLOCATE (tree.dY,      int *, tree.Nzone);
     219  ALLOCATE (tree.dX,    float *, tree.Nzone);
     220  ALLOCATE (tree.dY,    float *, tree.Nzone);
    221221  ALLOCATE (tree.cell,    int *, tree.Nzone);
    222222  ALLOCATE (tree.name,  char **, tree.Nzone);
     
    251251    ALLOCATE (tree.Xo[zone],   double, tree.NBAND[zone]);
    252252    ALLOCATE (tree.Yo[zone],   double, tree.NBAND[zone]);
    253     ALLOCATE (tree.dX[zone],      int, tree.NBAND[zone]);
    254     ALLOCATE (tree.dY[zone],      int, tree.NBAND[zone]);
     253    ALLOCATE (tree.dX[zone],    float, tree.NBAND[zone]);
     254    ALLOCATE (tree.dY[zone],    float, tree.NBAND[zone]);
    255255    ALLOCATE (tree.cell[zone], int,    tree.NBAND[zone]);
    256256    ALLOCATE (tree.name[zone], char *, tree.NBAND[zone]);
     
    260260      tree.Xo[zone][band] = NAN;
    261261      tree.Yo[zone][band] = NAN;
    262       tree.dX[zone][band] = -1;
    263       tree.dY[zone][band] = -1;
     262      tree.dX[zone][band] = NAN;
     263      tree.dY[zone][band] = NAN;
    264264      tree.cell[zone][band] = -1;
    265265      ALLOCATE (tree.name[zone][band], char, BOUNDARY_TREE_NAME_LENGTH);
     
    286286      REALLOCATE (tree.Xo[zone],   double, tree.NBAND[zone]);
    287287      REALLOCATE (tree.Yo[zone],   double, tree.NBAND[zone]);
    288       REALLOCATE (tree.dX[zone],      int, tree.NBAND[zone]);
    289       REALLOCATE (tree.dY[zone],      int, tree.NBAND[zone]);
     288      REALLOCATE (tree.dX[zone],    float, tree.NBAND[zone]);
     289      REALLOCATE (tree.dY[zone],    float, tree.NBAND[zone]);
    290290      REALLOCATE (tree.cell[zone],    int, tree.NBAND[zone]);
    291291      REALLOCATE (tree.name[zone], char *, tree.NBAND[zone]);
     
    295295        tree.Xo[zone][band] = NAN;
    296296        tree.Yo[zone][band] = NAN;
    297         tree.dX[zone][band] = -1;
    298         tree.dY[zone][band] = -1;
     297        tree.dX[zone][band] = NAN;
     298        tree.dY[zone][band] = NAN;
    299299        tree.cell[zone][j] = -1;
    300300        ALLOCATE (tree.name[zone][j], char, BOUNDARY_TREE_NAME_LENGTH);
  • branches/eam_branches/ipp-20140717/Ohana/src/libdvo/include/dvo.h

    r37093 r37101  
    383383  char  ***name; // projection cell name
    384384 
    385   int NX_SUB;
    386   int NY_SUB;
     385  float NX_SUB;
     386  float NY_SUB;
    387387  double dPix;
    388388
    389389  double **Xo;
    390390  double **Yo;
    391   int **dX;
    392   int **dY;
     391  float **dX;
     392  float **dY;
    393393} BoundaryTree;
    394394
     
    411411  double Do;
    412412  double dPix;
    413   int dX;
    414   int dY;
    415 
    416   int NX_SUB;
    417   int NY_SUB;
     413  float dX;
     414  float dY;
     415
     416  float NX_SUB;
     417  float NY_SUB;
    418418
    419419  char *basename;
  • branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/BoundaryTree.c

    r36490 r37101  
    8484  gfits_scan (headerPHU, "DEC_ORI",  "%lf", 1, &tree->DEC_origin);
    8585  gfits_scan (headerPHU, "DEC_OFF",  "%lf", 1, &tree->DEC_offset);
    86   gfits_scan (headerPHU, "NX_SUB",   "%d",  1, &tree->NX_SUB);
    87   gfits_scan (headerPHU, "NY_SUB",   "%d",  1, &tree->NY_SUB);
     86  gfits_scan (headerPHU, "NX_SUB",   "%f",  1, &tree->NX_SUB);
     87  gfits_scan (headerPHU, "NY_SUB",   "%f",  1, &tree->NY_SUB);
    8888  gfits_scan (headerPHU, "PIXSCALE", "%lf", 1, &tree->dPix);
    8989
     
    111111  ALLOCATE (tree->Xo,   double *, tree->Nzone);
    112112  ALLOCATE (tree->Yo,   double *, tree->Nzone);
    113   ALLOCATE (tree->dX,      int *, tree->Nzone);
    114   ALLOCATE (tree->dY,      int *, tree->Nzone);
     113  ALLOCATE (tree->dX,    float *, tree->Nzone);
     114  ALLOCATE (tree->dY,    float *, tree->Nzone);
    115115  ALLOCATE (tree->cell,    int *, tree->Nzone);
    116116  ALLOCATE (tree->projID,  int *, tree->Nzone);
     
    121121    ALLOCATE (tree->Xo[i],   double, tree->Nband[i]);
    122122    ALLOCATE (tree->Yo[i],   double, tree->Nband[i]);
    123     ALLOCATE (tree->dX[i],      int, tree->Nband[i]);
    124     ALLOCATE (tree->dY[i],      int, tree->Nband[i]);
     123    ALLOCATE (tree->dX[i],    float, tree->Nband[i]);
     124    ALLOCATE (tree->dY[i],    float, tree->Nband[i]);
    125125    ALLOCATE (tree->cell[i],    int, tree->Nband[i]);
    126126    ALLOCATE (tree->projID[i],  int, tree->Nband[i]);
     
    147147  GET_COLUMN_NEW(&headerCell, &ftableCell, Xo,    "X_CENT",      double);
    148148  GET_COLUMN_NEW(&headerCell, &ftableCell, Yo,    "Y_CENT",      double);
    149   GET_COLUMN_NEW(&headerCell, &ftableCell, dX,    "X_GRID",      int);
    150   GET_COLUMN_NEW(&headerCell, &ftableCell, dY,    "Y_GRID",      int);
     149  GET_COLUMN_NEW(&headerCell, &ftableCell, dX,    "X_GRID",      float);
     150  GET_COLUMN_NEW(&headerCell, &ftableCell, dY,    "Y_GRID",      float);
    151151  GET_COLUMN_NEW(&headerCell, &ftableCell, name,  "NAME",        char); // XXX how is this done?
    152152  gfits_free_header (&headerCell);
     
    214214  gfits_modify (&header, "DEC_OFF", "%lf", 1, tree->DEC_offset);
    215215
    216   gfits_modify (&header, "NX_SUB", "%d", 1, tree->NX_SUB);
    217   gfits_modify (&header, "NY_SUB", "%d", 1, tree->NY_SUB);
     216  gfits_modify (&header, "NX_SUB", "%f", 1, tree->NX_SUB);
     217  gfits_modify (&header, "NY_SUB", "%f", 1, tree->NY_SUB);
    218218  gfits_modify (&header, "PIXSCALE", "%lf", 1, tree->dPix);
    219219
     
    289289    gfits_define_bintable_column (&theader, "D", "X_CENT", "projection cell center pixel", "none", 1.0, 0.0);
    290290    gfits_define_bintable_column (&theader, "D", "Y_CENT", "projection cell center pixel", "none", 1.0, 0.0);
    291     gfits_define_bintable_column (&theader, "J", "X_GRID", "skycell grid spacing", "none", 1.0, 0.0);
    292     gfits_define_bintable_column (&theader, "J", "Y_GRID", "skycell grid spacing", "none", 1.0, 0.0);
     291    gfits_define_bintable_column (&theader, "E", "X_GRID", "skycell grid spacing", "none", 1.0, 0.0);
     292    gfits_define_bintable_column (&theader, "E", "Y_GRID", "skycell grid spacing", "none", 1.0, 0.0);
    293293    gfits_define_bintable_column (&theader, fmt, "NAME", "cell name", "none", 1.0, 0.0);
    294294
     
    310310    double *Xo            ; ALLOCATE (Xo,    double, Ncell);
    311311    double *Yo            ; ALLOCATE (Yo,    double, Ncell);
    312     int    *dX            ; ALLOCATE (dX,    int,    Ncell);
    313     int    *dY            ; ALLOCATE (dY,    int,    Ncell);
     312    float  *dX            ; ALLOCATE (dX,    float,  Ncell);
     313    float  *dY            ; ALLOCATE (dY,    float,  Ncell);
    314314    char   *name          ; ALLOCATE (name,  char,   Ncell*BOUNDARY_TREE_NAME_LENGTH);
    315315
  • branches/eam_branches/ipp-20140717/Ohana/src/libdvo/src/TessellationTable.c

    r36490 r37101  
    2828    tess[i].dPix = NAN;
    2929
    30     tess[i].dX = 0;
    31     tess[i].dY = 0;
    32 
    33     tess[i].NX_SUB = 0;
    34     tess[i].NY_SUB = 0;
     30    tess[i].dX = NAN;
     31    tess[i].dY = NAN;
     32
     33    tess[i].NX_SUB = NAN;
     34    tess[i].NY_SUB = NAN;
    3535
    3636    tess[i].basename = NULL;
     
    123123  GET_COLUMN_NEW(Xo,     "X_CENT", double);
    124124  GET_COLUMN_NEW(Yo,     "Y_CENT", double);
    125   GET_COLUMN_NEW(dX,     "X_GRID", int);
    126   GET_COLUMN_NEW(dY,     "Y_GRID", int);
     125  GET_COLUMN_NEW(dX,     "X_GRID", float);
     126  GET_COLUMN_NEW(dY,     "Y_GRID", float);
    127127  GET_COLUMN_NEW(Rmin,   "R_MIN",  double);
    128128  GET_COLUMN_NEW(Rmax,   "R_MAX",  double);
     
    130130  GET_COLUMN_NEW(Dmax,   "D_MAX",  double);
    131131  GET_COLUMN_NEW(dPix,   "SCALE",  double);
    132   GET_COLUMN_NEW(NX_SUB, "NX_SUB", int);
    133   GET_COLUMN_NEW(NY_SUB, "NY_SUB", int);
     132  GET_COLUMN_NEW(NX_SUB, "NX_SUB", float);
     133  GET_COLUMN_NEW(NY_SUB, "NY_SUB", float);
    134134  GET_COLUMN_NEW(TYPE,   "TYPE",   int);
    135135
     
    280280    gfits_modify (&header, "DEC_OFF", "%lf", 1, rings->DEC_offset);
    281281
    282     gfits_modify (&header, "NX_SUB", "%d", 1, rings->NX_SUB);
    283     gfits_modify (&header, "NY_SUB", "%d", 1, rings->NY_SUB);
     282    gfits_modify (&header, "NX_SUB", "%f", 1, rings->NX_SUB);
     283    gfits_modify (&header, "NY_SUB", "%f", 1, rings->NY_SUB);
    284284    gfits_modify (&header, "PIXSCALE", "%lf", 1, rings->dPix);
    285285  }
     
    300300  gfits_define_bintable_column (&theader, "D", "X_CENT", "projection cell center pixel", "none", 1.0, 0.0);
    301301  gfits_define_bintable_column (&theader, "D", "Y_CENT", "projection cell center pixel", "none", 1.0, 0.0);
    302   gfits_define_bintable_column (&theader, "J", "X_GRID", "skycell grid spacing", "none", 1.0, 0.0);
    303   gfits_define_bintable_column (&theader, "J", "Y_GRID", "skycell grid spacing", "none", 1.0, 0.0);
     302  gfits_define_bintable_column (&theader, "E", "X_GRID", "skycell grid spacing", "none", 1.0, 0.0);
     303  gfits_define_bintable_column (&theader, "E", "Y_GRID", "skycell grid spacing", "none", 1.0, 0.0);
    304304  gfits_define_bintable_column (&theader, "D", "R_MIN",  "RA limit (lower)", "none", 1.0, 0.0);
    305305  gfits_define_bintable_column (&theader, "D", "R_MAX",  "RA limit (upper)", "none", 1.0, 0.0);
     
    307307  gfits_define_bintable_column (&theader, "D", "D_MAX",  "DEC limit (upper)", "none", 1.0, 0.0);
    308308  gfits_define_bintable_column (&theader, "D", "SCALE",  "pixel scale for projection cell", "none", 1.0, 0.0);
    309   gfits_define_bintable_column (&theader, "J", "NX_SUB", "skycell subdivision in x", "none", 1.0, 0.0);
    310   gfits_define_bintable_column (&theader, "J", "NY_SUB", "skycell subdivision in y", "none", 1.0, 0.0);
     309  gfits_define_bintable_column (&theader, "E", "NX_SUB", "skycell subdivision in x", "none", 1.0, 0.0);
     310  gfits_define_bintable_column (&theader, "E", "NY_SUB", "skycell subdivision in y", "none", 1.0, 0.0);
    311311  gfits_define_bintable_column (&theader, "J", "TYPE",   "type of tessellation", "none", 1.0, 0.0);
    312312
     
    330330  double *Xo            ; ALLOCATE (Xo    ,    double, Nout);
    331331  double *Yo            ; ALLOCATE (Yo    ,    double, Nout);
    332   int    *dX            ; ALLOCATE (dX    ,    int,    Nout);
    333   int    *dY            ; ALLOCATE (dY    ,    int,    Nout);
     332  float  *dX            ; ALLOCATE (dX    ,    float,  Nout);
     333  float  *dY            ; ALLOCATE (dY    ,    float,  Nout);
    334334  double *Rmin          ; ALLOCATE (Rmin  ,    double, Nout);
    335335  double *Rmax          ; ALLOCATE (Rmax  ,    double, Nout);
     
    337337  double *Dmax          ; ALLOCATE (Dmax  ,    double, Nout);
    338338  double *dPix          ; ALLOCATE (dPix  ,    double, Nout);
    339   int    *NX_SUB        ; ALLOCATE (NX_SUB,    int,    Nout);
    340   int    *NY_SUB        ; ALLOCATE (NY_SUB,    int,    Nout);
     339  float  *NX_SUB        ; ALLOCATE (NX_SUB,    float,  Nout);
     340  float  *NY_SUB        ; ALLOCATE (NY_SUB,    float,  Nout);
    341341  int    *TYPE          ; ALLOCATE (TYPE,      int,    Nout);
    342342
     
    559559    int xi = x / tess[myTess].tree->dX[zone][band];
    560560    int yi = y / tess[myTess].tree->dY[zone][band];
     561
     562    xi = MAX(MIN(xi, tess[myTess].NX_SUB - 1.0), 0);
     563    yi = MAX(MIN(yi, tess[myTess].NY_SUB - 1.0), 0);
     564
    561565    int N = xi + tess[myTess].tree->NX_SUB * yi;
    562566 
Note: See TracChangeset for help on using the changeset viewer.