IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41515


Ignore:
Timestamp:
Apr 2, 2021, 1:48:56 PM (5 years ago)
Author:
eugene
Message:

minor line-break cleanups; fix cgrid spacing for pseudocylindrical projections; some in-line initializations; allow projection center for pseudocylindrical projections to be non-zero for dec (changes projection center pixel)

Location:
trunk/Ohana/src/opihi/cmd.astro
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.astro/cdensify.c

    r41341 r41515  
    144144
    145145    float F = 1.0;
    146     if (vv) {
    147       F = isFloatScale ? Fs[i] : Is[i];
    148     }
     146    if (vv) { F = isFloatScale ? Fs[i] : Is[i]; }
    149147
    150148    switch (PSFTYPE) {
  • trunk/Ohana/src/opihi/cmd.astro/cgrid.c

    r41341 r41515  
    4040  OnPic = FALSE;                                                        \
    4141  First = TRUE;                                                         \
    42   for (d = firstDEC; (d < 90 + dD) && (LOnPic || NorthPole || SouthPole); d += dD) { \
     42  for (d = firstDEC; (d < 90 + dD) && (LOnPic || NorthPole || SouthPole || InvalidCorner); d += dD) { \
    4343    D = MAX (-90, MIN(90, d));                                          \
    4444    ADD_COORDINATE((RA), D);                                            \
     
    4747  First = TRUE;                                                         \
    4848  LOnPic = TRUE;                                                        \
    49   for (d = firstDEC; (d > -90 - dD) && (LOnPic || NorthPole || SouthPole); d -= dD) { \
     49  for (d = firstDEC; (d > -90 - dD) && (LOnPic || NorthPole || SouthPole || InvalidCorner); d -= dD) { \
    5050    D = MAX (-90, MIN(90, d));                                          \
    5151    ADD_COORDINATE((RA), D);                                            \
     
    5959  First = TRUE;                                                         \
    6060  lastRA = graphmode.coords.crval1 + 180.0;                             \
    61   for (r = firstRA; (r < lastRA + dR) && (LOnPic || NorthPole || SouthPole); r += dR) { \
     61  for (r = firstRA; (r < lastRA + dR) && (LOnPic || NorthPole || SouthPole || InvalidCorner); r += dR) { \
    6262    R = MIN (r, lastRA);                                        \
    6363    ADD_COORDINATE(R, D);                                               \
     
    6767  LOnPic = TRUE;                                                        \
    6868  lastRA = graphmode.coords.crval1 - 180.0;                             \
    69   for (r = firstRA; (r > lastRA - dR) && (LOnPic || NorthPole || SouthPole); r -= dR) { \
     69  for (r = firstRA; (r > lastRA - dR) && (LOnPic || NorthPole || SouthPole || InvalidCorner); r -= dR) { \
    7070    R = MAX (r, lastRA);                                        \
    7171    ADD_COORDINATE(R, D);                                               \
     
    167167    SouthPole = TRUE;
    168168
     169  // PSEUDOCYL modes need center R,D to be 0,0 and center pixel to be adjusted
     170  OhanaProjection proj = GetProjection (graphmode.coords.ctype);
     171  OhanaProjectionMode mode = GetProjectionMode (proj);
     172  int InvalidCorner = FALSE;
     173  if (mode == PROJ_MODE_PSEUDOCYL) {
     174    // for PSEUDOCYL, the ra range is 360 if the corners are invalid
     175    InvalidCorner |= XY_to_RD (&r, &d, graphmode.xmin, graphmode.ymin, &graphmode.coords);
     176    InvalidCorner |= XY_to_RD (&r, &d, graphmode.xmax, graphmode.ymin, &graphmode.coords);
     177    InvalidCorner |= XY_to_RD (&r, &d, graphmode.xmax, graphmode.ymax, &graphmode.coords);
     178    InvalidCorner |= XY_to_RD (&r, &d, graphmode.xmin, graphmode.ymax, &graphmode.coords);
     179  }   
     180
    169181  range = MIN (fabs(graphmode.coords.cdelt1*(graphmode.xmax-graphmode.xmin)), fabs(graphmode.coords.cdelt2*(graphmode.ymax-graphmode.ymin)));
    170   if (NorthPole || SouthPole) range = 360;
     182  if (NorthPole || SouthPole || InvalidCorner) range = 360;
    171183  dR = range * GRID_SPACING;
    172184  dD = range * GRID_SPACING;
  • trunk/Ohana/src/opihi/cmd.astro/coords.c

    r41379 r41515  
    77  int i, mode, form, N, Quiet;
    88  double Xin, Yin, Xout, Yout;
    9   char *MOSAIC;
    109  Coords coords, moscoords;
    1110  Buffer *buf, *mosbuffer;
    1211  Vector *xvec = NULL;
    1312  Vector *yvec = NULL;
     13  char *MOSAIC = NULL;
    1414
    1515  if ((N = get_argument (argc, argv, "-copy"))) {
     
    3636  }
    3737
    38   MOSAIC = NULL;
    3938  if ((N = get_argument (argc, argv, "-mosaic"))) {
    4039    remove_argument (N, &argc, argv);
  • trunk/Ohana/src/opihi/cmd.astro/region.c

    r41341 r41515  
    165165got_ctype:
    166166 
    167   graphmode.coords.crval1 = Ra;
    168   graphmode.coords.crval2 = Dec;
    169 
    170   float pc1_1 = (graphmode.flipeast)  ? -1 : 1;
    171   float pc2_2 = (graphmode.flipnorth) ? -1 : 1;
    172 
    173   graphmode.coords.pc1_1 =  cos(Angle*RAD_DEG)*pc1_1;
    174   graphmode.coords.pc1_2 =  sin(Angle*RAD_DEG)*pc2_2;
    175   graphmode.coords.pc2_1 = -sin(Angle*RAD_DEG)*pc1_1;
    176   graphmode.coords.pc2_2 =  cos(Angle*RAD_DEG)*pc2_2;
     167  // set the rotation
     168  {
     169    float pc1_1 = (graphmode.flipeast)  ? -1 : 1;
     170    float pc2_2 = (graphmode.flipnorth) ? -1 : 1;
     171
     172    graphmode.coords.pc1_1 =  cos(Angle*RAD_DEG)*pc1_1;
     173    graphmode.coords.pc1_2 =  sin(Angle*RAD_DEG)*pc2_2;
     174    graphmode.coords.pc2_1 = -sin(Angle*RAD_DEG)*pc1_1;
     175    graphmode.coords.pc2_2 =  cos(Angle*RAD_DEG)*pc2_2;
     176  }
     177
     178  // determine central pixel for projection:
     179  {
     180    // PSEUDOCYL modes need center R,D to be 0,0 and center pixel to be adjusted
     181    OhanaProjection proj = GetProjection (graphmode.coords.ctype);
     182    OhanaProjectionMode mode = GetProjectionMode (proj);
     183
     184    graphmode.coords.crpix1 = 0.0;
     185    graphmode.coords.crpix2 = 0.0;
     186
     187    if (mode == PROJ_MODE_PSEUDOCYL) {
     188      graphmode.coords.crval1 = Ra;
     189      graphmode.coords.crval2 = 0.0;
     190    } else {
     191      graphmode.coords.crval1 = Ra;
     192      graphmode.coords.crval2 = Dec;
     193    }
     194
     195    if (mode == PROJ_MODE_PSEUDOCYL) {
     196      double Xc, Yc;
     197      RD_to_XY (&Xc, &Yc, Ra, Dec, &graphmode.coords);
     198      graphmode.coords.crpix2 = -Yc;
     199      fprintf (stderr, "center pixel is %f, %f\n", Xc, Yc);
     200    }
     201  }
    177202
    178203  // ask kapa for coordinate limits, to get the right aspect ratio
Note: See TracChangeset for help on using the changeset viewer.