IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 9, 2009, 3:41:26 PM (17 years ago)
Author:
beaumont
Message:

sync with trunk

Location:
branches/cnb_branches/cnb_branch_20090215
Files:
10 edited
3 copied

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090215

  • branches/cnb_branches/cnb_branch_20090215/Ohana

  • branches/cnb_branches/cnb_branch_20090215/Ohana/src/addstar/src/get2mass_full.c

    r21536 r23239  
    11# include "addstar.h"
    22# include "2mass.h"
     3
     4// XXX check to see if desired output format is PS1_V1 or later?  (use 16bit version if not?)
    35
    46// fill in the data for a JHK triplet star.  takes a pointer to the start of the line the
     
    171173
    172174  switch (qual) {
    173     case 'X': star[0].measure.photFlags |= 0x0000; break;
    174     case 'U': star[0].measure.photFlags |= 0x0001; break;
    175     case 'F': star[0].measure.photFlags |= 0x0002; break;
    176     case 'E': star[0].measure.photFlags |= 0x0003; break;
    177     case 'A': star[0].measure.photFlags |= 0x0004; break;
    178     case 'B': star[0].measure.photFlags |= 0x0005; break;
    179     case 'C': star[0].measure.photFlags |= 0x0006; break;
    180     case 'D': star[0].measure.photFlags |= 0x0007; break;
     175    case 'A': star[0].measure.photFlags |= 0x00000001; break; // was: 0x0004
     176    case 'B': star[0].measure.photFlags |= 0x00000002; break; // was: 0x0005
     177    case 'C': star[0].measure.photFlags |= 0x00000004; break; // was: 0x0006
     178    case 'D': star[0].measure.photFlags |= 0x00000008; break; // was: 0x0007
     179    case 'E': star[0].measure.photFlags |= 0x00000010; break; // was: 0x0003
     180    case 'F': star[0].measure.photFlags |= 0x00000020; break; // was: 0x0002
     181    case 'U': star[0].measure.photFlags |= 0x00000040; break; // was: 0x0001
     182    case 'X': star[0].measure.photFlags |= 0x00000080; break; // was: 0x0000
    181183    default:
    182184      fprintf (stderr, "error!\n");
     
    189191
    190192  switch (qual) {
    191     case '0': star[0].measure.photFlags |= 0x0000; break;
    192     case '1': star[0].measure.photFlags |= 0x0010; break;
    193     case '2': star[0].measure.photFlags |= 0x0020; break;
    194     case '3': star[0].measure.photFlags |= 0x0030; break;
    195     case '4': star[0].measure.photFlags |= 0x0040; break;
    196     case '6': star[0].measure.photFlags |= 0x0050; break;
    197     case '9': star[0].measure.photFlags |= 0x0060; break;
     193    case '0': star[0].measure.photFlags |= 0x00000100; break; // was: 0x0000
     194    case '1': star[0].measure.photFlags |= 0x00000200; break; // was: 0x0010
     195    case '2': star[0].measure.photFlags |= 0x00000400; break; // was: 0x0020
     196    case '3': star[0].measure.photFlags |= 0x00000800; break; // was: 0x0030
     197    case '4': star[0].measure.photFlags |= 0x00001000; break; // was: 0x0040
     198    case '6': star[0].measure.photFlags |= 0x00002000; break; // was: 0x0050
     199    case '9': star[0].measure.photFlags |= 0x00004000; break; // was: 0x0060
    198200    default:
    199201      fprintf (stderr, "error!\n");
     
    206208
    207209  switch (qual) {
    208     case 'p': star[0].measure.photFlags |= 0x0000; break;
    209     case 'c': star[0].measure.photFlags |= 0x0100; break;
    210     case 'd': star[0].measure.photFlags |= 0x0200; break;
    211     case 's': star[0].measure.photFlags |= 0x0300; break;
    212     case 'b': star[0].measure.photFlags |= 0x0400; break;
    213     case '0': star[0].measure.photFlags |= 0x0500; break;
     210    case 'p': star[0].measure.photFlags |= 0x00010000; break; // was: 0x0000
     211    case 'c': star[0].measure.photFlags |= 0x00020000; break; // was: 0x0100
     212    case 'd': star[0].measure.photFlags |= 0x00040000; break; // was: 0x0200
     213    case 's': star[0].measure.photFlags |= 0x00080000; break; // was: 0x0300
     214    case 'b': star[0].measure.photFlags |= 0x00010000; break; // was: 0x0400
     215    case '0': star[0].measure.photFlags |= 0x00020000; break; // was: 0x0500
    214216    default:
    215217      fprintf (stderr, "error!\n");
     
    222224
    223225  switch (qual) {
    224     case '0': star[0].measure.photFlags &= ~0x0008; break;
    225     case '1': star[0].measure.photFlags &= ~0x0008; break;
    226     default:  star[0].measure.photFlags |=  0x0008; break;
     226    case '0': star[0].measure.photFlags &= ~0x00300000; break; // was: ~0x0008
     227    case '1': star[0].measure.photFlags |=  0x00100000; break; // was: ~0x0008
     228    default:  star[0].measure.photFlags |=  0x00200000; break; // was:  0x0008
    227229  }     
    228230  return (TRUE);
     
    232234
    233235  switch (qual) {
    234     case '0': star[0].measure.photFlags &= ~0x0080; break;
    235     case '1': star[0].measure.photFlags &= ~0x0080; break;
    236     default: 
    237       star[0].measure.photFlags |= 0x0080;
     236    case '0': star[0].measure.photFlags &= ~0x00c00000; break; // was: ~0x0080
     237    case '1': star[0].measure.photFlags |=  0x00400000; break; // was: ~0x0080
     238    default:  star[0].measure.photFlags |=  0x00800000;        // was:  0x0080
    238239      star[0].measure.extNsigma = 100.0;
    239240      break;
     
    245246
    246247  switch (qual) {
    247     case '0': star[0].measure.photFlags &= ~0x0800; break;
    248     case '1': star[0].measure.photFlags &= ~0x0800; break;
    249     default:  star[0].measure.photFlags |=  0x0800; break;
     248    case '0': star[0].measure.photFlags &= ~0x03000000; break; // was: ~0x0800
     249    case '1': star[0].measure.photFlags |=  0x01000000; break; // was: ~0x0800
     250    default:  star[0].measure.photFlags |=  0x02000000; break; // was:  0x0800
    250251  }     
    251252  return (TRUE);
     
    255256
    256257  switch (qual) {
    257     case '0': star[0].measure.photFlags &= ~0x1000; break;
    258     case '1': star[0].measure.photFlags &= ~0x1000; break;
    259     default:  star[0].measure.photFlags |=  0x1000; break;
     258    case '0': star[0].measure.photFlags &= ~0x0c000000; break; // was: ~0x1000
     259    case '1': star[0].measure.photFlags |=  0x04000000; break; // was: ~0x1000
     260    default:  star[0].measure.photFlags |=  0x08000000; break; // was:  0x1000
    260261  }     
    261262  return (TRUE);
     
    265266
    266267  switch (qual) {
    267     case '0': star[0].measure.photFlags &= ~0x2000; break;
    268     case '1': star[0].measure.photFlags |=  0x2000; break;
     268    case '0': star[0].measure.photFlags &= ~0x10000000; break; // was: ~0x2000
     269    case '1': star[0].measure.photFlags |=  0x10000000; break; // was:  0x2000
    269270    default:  abort();
    270271  }     
     
    272273}
    273274
     275// unused photFlags:
     276// 0x0000.8000
     277// 0x0004.0000
     278// 0x0008.0000
     279// 0x2000.0000
     280// 0x4000.0000
     281// 0x8000.0000
  • branches/cnb_branches/cnb_branch_20090215/Ohana/src/addstar/src/sky_tessalation.c

    r23199 r23239  
    240240  // integer number of dec zones between -90 and +90
    241241
    242   nDEC = 180.0 / CELLSIZE;
    243   dDEC = 180.0 / nDEC;
     242  // in fact, we place a single image on each pole, so the real range of dec is 180.0 - CELLSIZE:
     243
     244  nDEC = (180.0 - CELLSIZE) / CELLSIZE;
     245  dDEC = (180.0 - CELLSIZE) / nDEC;
     246  nDEC += 2;
     247
     248  // a test
     249  // for (dec = 0.0 + 0.5*dDEC; dec < +90.0; dec += dDEC) {
    244250
    245251  // generate the a collection of rectangles for each ring
    246   for (dec = -90.0 + 0.5*dDEC; dec < +90.0; dec += dDEC) {
     252  for (dec = -90.0; dec < +90.0 + 0.5*dDEC; dec += dDEC) {
    247253
    248254    ring = sky_rectangle_ring (dec, dDEC, &Nring);
     255    if (!ring) continue;
    249256
    250257    // subdivide each image (Nx x Ny subcells)
     
    529536SkyRectangle *sky_rectangle_ring (float dec, float dDEC, int *nring) {
    530537
    531   int i, nRA, NX, NY;
    532   float dRA, decLower;
     538  int i, NX, NY, nRA;
    533539  SkyRectangle *ring;
     540  float theta, dRA;
    534541
    535542  // 'dec' is a guess at the center of the cell; in fact, we need to choose decLower and
     
    537544
    538545  // we can determine the 'lower' bound (bound closest to the equator):
    539   decLower = (dec > 0.0) ? dec - 0.5*dDEC : dec + 0.5*dDEC;
    540 
    541   // Subdivide the 'lower' bound into an integer number of segments:
    542   nRA = cos(dec*RAD_DEG) * 360.0 / CELLSIZE; // CELLSIZE is a projection size
    543   dRA = 360.0 / nRA;                         // dRA is a size in RA degrees
     546  float decLower = (dec > 0.0) ? dec - 0.5*dDEC : dec + 0.5*dDEC;
     547
     548  // solve for actual cellsize (\theta):  tan(\delta_{n+1} - \theta/2) = tan(\delta_n + \theta/2)cos(\alpha_n / 2)
     549  float decUpper = (dec > 0.0) ? dec + dDEC : dec - dDEC;
     550
     551  if (fabs(dec) + 0.5*dDEC > 90.0) {
     552    // onPole = TRUE;
     553    theta = dDEC;
     554    nRA = 1;
     555    dRA = theta / cos(decLower*RAD_DEG); // make a square at the pole
     556  } else {
     557    // onPole = FALSE;
     558    // Subdivide the 'lower' bound into an integer number of segments:
     559    nRA = cos(RAD_DEG*decLower) * 360.0 / CELLSIZE; // CELLSIZE is a projection size
     560    dRA = 360.0 / nRA;                         // dRA is a size in RA degrees == \alpha_n
     561
     562    // tan(decUpper - theta/2) = tan(dec + theta/2) cos(dRA / 2);
     563
     564    // we solve this equation for theta (fairly ugly: expand the tangents into sin/cos, expand the
     565    // sum-of-angle sine and cosine, multiply through, convert via half-angle formulae and write
     566    // as a quadratic expression in sine(theta/2)
     567 
     568    float sd1 = sin(RAD_DEG*decUpper);
     569    float cd1 = cos(RAD_DEG*decUpper);
     570    float sd2 = sin(RAD_DEG*dec);
     571    float cd2 = cos(RAD_DEG*dec);
     572    float   k = cos(RAD_DEG*dRA/2.0);
     573
     574    float c1 =  (sd1*cd2 + sd2*cd1)*(1.0 - k);
     575    float c2 =  (sd1*cd2 - sd2*cd1)*(1.0 + k);
     576    float c3 = -(sd1*sd2 + cd1*cd2)*(1.0 + k);
     577
     578    float A = SQ(c3) + SQ(c2);
     579    float B = 2*c1*c3;
     580    float C = SQ(c1) - SQ(c2);
     581
     582    float arg = SQ(B) - 4.0*A*C;
     583
     584    float root;
     585
     586    if (dec >= 0.0) {
     587      root = (-B + sqrt (arg)) / (2.0*A);
     588      theta = +DEG_RAD*asin(root);
     589    } else {
     590      root = (-B - sqrt (arg)) / (2.0*A);
     591      theta = -DEG_RAD*asin(root);
     592    }
     593
     594    // the negative solution yields a negative cellsize
     595    // float root2 = (-B - sqrt (arg)) / (2.0*A);
     596    // float theta2 = DEG_RAD*asin(root2);
     597
     598    // test lines:
     599    // float r1 = tan(RAD_DEG*(decUpper - 0.5*theta1));
     600    // float r2 = tan(RAD_DEG*(dec + 0.5*theta1));
     601    // fprintf (stdout, "%f %f  %f  %f  %f %f  %f %f  %f %f %f\n", dec, decUpper, dRA, arg, root1, root2, theta1, theta2, r1, r2, k*r2);
     602  }
     603  fprintf (stdout, "%f %f  %f x %f (%d)\n", dec, decUpper, dRA, theta, nRA);
    544604
    545605  // I think we need to return the value of dec for the next ring, but I am not sure...
     
    559619 
    560620    // range values are in projected degrees
    561     NX = cos(dec*RAD_DEG) * dRA  * 3600.0 / SCALE;
    562     NY =                    dDEC * 3600.0 / SCALE;
     621    NX = cos(decLower*RAD_DEG) * dRA   * 3600.0 / SCALE;
     622    NY =                         theta * 3600.0 / SCALE;
    563623
    564624    // crpix1,crpix2 is the projection center
     
    576636
    577637
    578     fprintf (stderr, "%f %f  : %f %f\n",
    579             ring[i].coords.crval1, ring[i].coords.crval2,
    580             ring[i].coords.crpix1, ring[i].coords.crpix2);
     638    // fprintf (stderr, "%f %f  : %f %f\n",
     639    // ring[i].coords.crval1, ring[i].coords.crval2,
     640    // ring[i].coords.crpix1, ring[i].coords.crpix2);
    581641  }
    582642
  • branches/cnb_branches/cnb_branch_20090215/Ohana/src/imregister/base/get_fwhm.c

  • branches/cnb_branches/cnb_branch_20090215/Ohana/src/imregister/detrend/usage.c

  • branches/cnb_branches/cnb_branch_20090215/Ohana/src/imregister/imreg/load_probes.c

  • branches/cnb_branches/cnb_branch_20090215/Ohana/src/libdvo

    • Property svn:ignore
      •  

        old new  
        1 lib
         1
  • branches/cnb_branches/cnb_branch_20090215/Ohana/src/libdvo/lib

    • Property svn:ignore
      •  

        old new  
        1 *.linux
        2 *.lin64
        3 *.sol
        4 *.sun
        5 *.sid
        6 *.hp
        7 *.irix
        8 *.darwin.dylib
        9 *.darwin_x86.dylib
         1*.a
         2*.so
  • branches/cnb_branches/cnb_branch_20090215/Ohana/src/libfits/lib

    • Property svn:ignore
      •  

        old new  
        1 *.linux
        2 *.lin64
        3 *.sol
        4 *.sun
        5 *.sid
        6 *.hp
        7 *.irix
        8 *.darwin.dylib
        9 *.darwin_x86.dylib
         1*.a
         2*.so
  • branches/cnb_branches/cnb_branch_20090215/Ohana/src/libkapa/lib

    • Property svn:ignore
      •  

        old new  
        1 *.linux
        2 *.lin64
        3 *.sol
        4 *.sun
        5 *.sid
        6 *.hp
        7 *.irix
        8 *.darwin.dylib
        9 *.darwin_x86.dylib
         1*.a
         2*.so
  • branches/cnb_branches/cnb_branch_20090215/Ohana/src/libohana/lib

    • Property svn:ignore
      •  

        old new  
        1 *.linux
        2 *.lin64
        3 *.sol
        4 *.sun
        5 *.sid
        6 *.hp
        7 *.irix
        8 *.darwin.dylib
        9 *.darwin_x86.dylib
         1*.a
         2*.so
  • branches/cnb_branches/cnb_branch_20090215/Ohana/src/libtap/lib

    • Property svn:ignore
      •  

        old new  
        1 *.linux
        2 *.lin64
        3 *.sol
        4 *.sun
        5 *.sid
        6 *.hp
        7 *.irix
        8 *.darwin.dylib
        9 *.darwin_x86.dylib
         1*.a
         2*.so
Note: See TracChangeset for help on using the changeset viewer.