IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37386


Ignore:
Timestamp:
Sep 11, 2014, 3:39:54 PM (12 years ago)
Author:
eugene
Message:

adding image maps

Location:
branches/eam_branches/ipp-20140904/Ohana/src
Files:
77 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/LoadDataPMM.c

    r36485 r37386  
    193193
    194194    // XXX for now, we define a totally fake coordinate system centered on the plate center
    195     strcpy (image[0].coords.ctype, "DEC--TAN");
     195    InitCoords (&image[0].coords, "DEC--TAN");
    196196   
    197197    image[0].coords.crval1  = pmm_get_ra (RA);
     
    203203    image[0].coords.crpix2 = 0.5*PLATE_NY;
    204204    image[0].coords.cdelt1 = image[0].coords.cdelt2 = 0.9 / 3600.0;
    205 
    206     image[0].coords.pc1_1 = 0.0;
    207     image[0].coords.pc1_2 = 1.0;
    208     image[0].coords.pc2_1 = 1.0;
    209     image[0].coords.pc2_2 = 0.0;
    210 
    211     image[0].coords.Npolyterms = 0;
    212     memset (image[0].coords.polyterms, 0, 2*7*sizeof(float));
    213205
    214206    image[0].NX = PLATE_NX;
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/ReadStarsSDSS.c

    r36485 r37386  
    201201   
    202202    // XXX for now, we define a totally fake coordinate system centered on the first listed star
    203     strcpy (images[N].coords.ctype, "DEC--TAN");
    204    
     203    InitCoords (&images[N].coords, "DEC--TAN");
    205204    images[N].coords.crval1 = stars[0].average.R;
    206205    images[N].coords.crval2 = stars[0].average.D;
    207    
    208206    images[N].coords.crpix1 = stars[0].measure.Xccd;
    209207    images[N].coords.crpix2 = stars[0].measure.Yccd;
    210208    images[N].coords.cdelt1 = images[N].coords.cdelt2 = 0.4 / 3600.0;
    211 
    212     images[N].coords.pc1_1 = 0.0;
    213     images[N].coords.pc1_2 = 1.0;
    214     images[N].coords.pc2_1 = 1.0;
    215     images[N].coords.pc2_2 = 0.0;
    216 
    217     images[N].coords.Npolyterms = 0;
    218     memset (images[N].coords.polyterms, 0, 2*7*sizeof(float));
    219209
    220210    images[N].NX = 2048;
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/fakeimage.c

    r37378 r37386  
    33Image *fakeimage (char *rootname, off_t *Nimage, int photcode) {
    44
    5   int i, j, Nx, Ny, Nchips;
     5  int i, Nx, Ny, Nchips;
    66  double pltscale, pixscale;
    77  double Rmin, Rmax, Dmin, Dmax;
     
    3333
    3434  /* create a mosaic distortion structure */
    35   strcpy (MOSAIC.ctype, "DEC--DIS");
     35  InitCoords (&MOSAIC, "DEC--DIS");
    3636  MOSAIC.crval1 = FAKE_RA;
    3737  MOSAIC.crval2 = FAKE_DEC;
    38  
    39   MOSAIC.crpix1 = MOSAIC.crpix2 = 0.0;
    4038 
    4139  /* mosaic 'pixels' are millimeters */
     
    4947
    5048  MOSAIC.Npolyterms = 3;
    51   for (i = 0; i < 7; i++) {
    52     MOSAIC.polyterms[i][0] = 0;
    53     MOSAIC.polyterms[i][1] = 0;
    54   }
    5549  ScanConfig (config, "DPLATE_X",   "%lf", 0, &pltscale);
    5650  MOSAIC.polyterms[3][0] = pltscale;  // L : X^3 Y^0
     
    8377    strcpy (image[i+1].name, name);
    8478
    85     strcpy (image[i+1].coords.ctype, "DEC--WRP");
     79    InitCoords (&image[i+1].coords, "DEC--WRP");
    8680   
    8781    image[i+1].coords.crval1 = dX*pixscale;
    8882    image[i+1].coords.crval2 = dY*pixscale;
    89    
    90     image[i+1].coords.crpix1 = image[i+1].coords.crpix2 = 0.0;
     83
    9184    image[i+1].coords.cdelt1 = image[i+1].coords.cdelt2 = pixscale;
    9285
    93     image[i+1].coords.pc1_1 = 1.0;
    94     image[i+1].coords.pc1_2 = 0.0;
    95     image[i+1].coords.pc2_1 = 0.0;
    96     image[i+1].coords.pc2_2 = 1.0;
    97 
    98     image[i+1].coords.Npolyterms = 0;
    99     for (j = 0; j < 7; j++) {
    100       image[i+1].coords.polyterms[j][0] = 0;
    101       image[i+1].coords.polyterms[j][1] = 0;
    102     }
    10386    image[i+1].coords.mosaic = &MOSAIC;
    10487
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/find_matches.c

    r37036 r37386  
    5353   * coordops.update.c).  We use the center of the region (catalog) for crval1,2.
    5454   */
     55  InitCoords (&tcoords, "DEC--ARC");
    5556  tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax);
    5657  if (region[0].Dmax < 90) {
     
    5960    tcoords.crval2 = 90.0;
    6061  }
    61   tcoords.crpix1 = 0;
    62   tcoords.crpix2 = 0;
    6362  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    64   tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
    65   tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
    66   tcoords.Npolyterms = 1;
    67   strcpy (tcoords.ctype, "DEC--ARC");
    6863
    6964  /* build spatial index (RA sort) referencing input array sequence */
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/find_matches_closest.c

    r37036 r37386  
    5353   * far from the projection pole. We use the center of the region (catalog) for crval1,2.
    5454   */
     55  InitCoords (&tcoords, "DEC--ARC");
    5556  tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax);
    5657  if (region[0].Dmax < 90) {
     
    5960    tcoords.crval2 = 90.0;
    6061  }
    61   tcoords.crpix1 = 0;
    62   tcoords.crpix2 = 0;
    6362  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    64   tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
    65   tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
    66   tcoords.Npolyterms = 1;
    67   strcpy (tcoords.ctype, "DEC--ARC");
    6863
    6964  /* build spatial index (RA sort) referencing input array sequence */
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/find_matches_closest_refstars.c

    r37036 r37386  
    4747   * far from the projection pole. We use the center of the region (catalog) for crval1,2.
    4848   */
     49  InitCoords (&tcoords, "DEC--ARC");
    4950  tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax);
    5051  if (region[0].Dmax < 90) {
     
    5354    tcoords.crval2 = 90.0;
    5455  }
    55   tcoords.crpix1 = 0.0;
    56   tcoords.crpix2 = 0.0;
    5756  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    58   tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
    59   tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
    60   tcoords.Npolyterms = 0;
    61   strcpy (tcoords.ctype, "DEC--ARC");
    6257 
    6358  /* build spatial index (RA sort) referencing input array sequence */
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/find_matches_refstars.c

    r37036 r37386  
    5151  /* project onto rectilinear grid with 1 arcsec pixels, sort by X */
    5252  /* reference for coords is catalog center */
     53  InitCoords (&tcoords, "DEC--ZEA");
    5354  tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax);
    5455  tcoords.crval2 = 0.5*(region[0].Dmin + region[0].Dmax);
    55   tcoords.crpix1 = tcoords.crpix2 = 0.0;
    5656  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    57   tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
    58   tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
    59   strcpy (tcoords.ctype, "DEC--ZEA");
    60   tcoords.Npolyterms = 0;
    6157 
    6258  for (i = 0; i < Nstars; i++) {
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadsupercos_plates.c

    r36485 r37386  
    118118
    119119    // for now, we define a fake coordinate system based on the boresite center
    120     strcpy (image[Nimage].coords.ctype, "DEC--TAN");
     120    InitCoords (&image[Nimage].coords, "DEC--TAN");
    121121   
    122122    image[Nimage].coords.crval1 = RAo;
     
    126126    image[Nimage].coords.crpix2 = 0.5*image[Nimage].NY;
    127127    image[Nimage].coords.cdelt1 = image[Nimage].coords.cdelt2 = scale;
    128 
    129     image[Nimage].coords.pc1_1 = 0.0;
    130     image[Nimage].coords.pc1_2 = 1.0;
    131     image[Nimage].coords.pc2_1 = 1.0;
    132     image[Nimage].coords.pc2_2 = 0.0;
    133 
    134     image[Nimage].coords.Npolyterms = 0;
    135     memset (image[Nimage].coords.polyterms, 0, 2*7*sizeof(float));
    136128
    137129    Nimage ++;
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/mkcmf.c

    r37246 r37386  
    200200   
    201201  /* bore site center guess */
    202   strcpy (coords.ctype, "DEC--TAN");
     202  InitCoords (&coords, "DEC--TAN");
    203203  coords.crval1 = RA;
    204204  coords.crval2 = DEC;
     
    208208  coords.cdelt1 = 0.25/3600.0;
    209209  coords.cdelt2 = 0.25/3600.0;
    210 
    211   coords.pc1_1  = 1;
    212   coords.pc2_2  = 1;
    213   coords.pc1_2  = 0;
    214   coords.pc2_1  = 0;
    215   coords.Npolyterms = 1;
    216210
    217211  // load stars and generate complete output fields
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/sky_tessalation.c

    r36485 r37386  
    581581
    582582  memset (rectangle, 0, sizeof(SkyRectangle));
     583
     584  InitCoords (&rectangle[0].coords, "DEC--TAN");
     585
    583586  rectangle[0].coords.crval1 = CENTER_RA;
    584587  rectangle[0].coords.crval2 = CENTER_DEC;
     
    609612  rectangle[0].coords.cdelt2 = SCALE / 3600.0;
    610613
    611   strcpy (rectangle[0].coords.ctype, "DEC--TAN");
    612 
    613614  rectangle[0].NX = NX;
    614615  rectangle[0].NY = NY;
     
    699700  for (i = 0; i < nRA; i++) {
    700701    memset (&ring[i], 0, sizeof(SkyRectangle));
    701     memset (&ring[i].coords, 0, sizeof(Coords));
     702
     703    InitCoords (&ring[i].coords, "DEC--TAN");
    702704    ring[i].coords.crval1 = i*dRA;
    703705    ring[i].coords.crval2 = dec;
    704706
    705707    ring[i].coords.pc1_1 = +1.0 * X_PARITY;
    706     ring[i].coords.pc1_2 = +0.0;
    707     ring[i].coords.pc2_1 = -0.0;
    708     ring[i].coords.pc2_2 = +1.0;
    709708 
    710709    // range values are in projected degrees
     
    718717    ring[i].coords.cdelt1 = SCALE / 3600.0;
    719718    ring[i].coords.cdelt2 = SCALE / 3600.0;
    720 
    721     strcpy (ring[i].coords.ctype, "DEC--TAN");
    722719
    723720    ring[i].NX = NX*(1.0 + PADDING);
     
    771768
    772769      memset (&ring[N], 0, sizeof(SkyRectangle));
    773       memset (&ring[N].coords, 0, sizeof(Coords));
     770      InitCoords (&ring[N].coords, "DEC--TAN");
    774771
    775772      ring[N].coords.crval1 = ra / d2r;
     
    779776
    780777      ring[N].coords.pc1_1 = +1.0 * X_PARITY;
    781       ring[N].coords.pc1_2 = +0.0;
    782       ring[N].coords.pc2_1 = -0.0;
    783       ring[N].coords.pc2_2 = +1.0;
    784778 
    785779      // range values are in projected degrees
     
    793787      ring[N].coords.cdelt1 = SCALE / 3600.0;
    794788      ring[N].coords.cdelt2 = SCALE / 3600.0;
    795 
    796       strcpy (ring[N].coords.ctype, "DEC--TAN");
    797789
    798790      ring[N].NX = NX*(1.0 + PADDING);
     
    10991091
    11001092  ALLOCATE (refcoords, Coords, 1);
    1101   refcoords[0].crval1 = refcoords[0].crval2 = 0.0;
    1102   refcoords[0].crpix1 = refcoords[0].crpix2 = 0.0;
     1093  InitCoords (refcoords, "DEC--TAN");
    11031094  refcoords[0].cdelt1 = refcoords[0].cdelt2 = scale / 3600;
    1104   refcoords[0].pc1_1 = refcoords[0].pc2_2 = 1.0;
    1105   refcoords[0].pc1_2 = refcoords[0].pc2_1 = 0.0;
    1106   refcoords[0].Npolyterms = 0;
    1107   memset (refcoords[0].polyterms, 0, 14*sizeof(float));
    1108   strcpy (refcoords[0].ctype, "DEC--TAN");
    11091095  return (TRUE);
    11101096}
  • branches/eam_branches/ipp-20140904/Ohana/src/checkastro/src/bcatalog.c

    r36833 r37386  
    191191  /* project coordinates to a plane centered on the object with units of arcsec */
    192192  Coords coords;
     193  InitCoords (&coords, "DEC--SIN");
    193194  coords.crval1 = Rc;
    194195  coords.crval2 = Dc;
    195   coords.crpix1 = 0;
    196   coords.crpix2 = 0;
    197196  coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0;
    198   coords.pc1_1  = coords.pc2_2 = 1.0;
    199   coords.pc1_2  = coords.pc2_1 = 0.0;
    200   coords.Npolyterms = 1;
    201   strcpy (coords.ctype, "DEC--SIN");
    202197
    203198  // convert all average R,D values to X,Y:
  • branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/merge_catalogs_old.c

    r37116 r37386  
    6464   * coordops.update.c).  We use the center of the region (catalog) for crval1,2.
    6565   */
     66
     67  InitCoords (&tcoords, "DEC--ARC");
    6668  tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax);
    6769  if (region[0].Dmax < 90) {
     
    7072    tcoords.crval2 = 90.0;
    7173  }
    72   tcoords.crpix1 = 0;
    73   tcoords.crpix2 = 0;
    7474  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    75   tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
    76   tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
    77   tcoords.Npolyterms = 1;
    78   strcpy (tcoords.ctype, "DEC--ARC");
    7975
    8076  if (VERBOSE) fprintf (stderr, "merging %s into %s\n", input[0].filename, output[0].filename);
  • branches/eam_branches/ipp-20140904/Ohana/src/fixcat/src/gcatstats.c

    r36481 r37386  
    4646  /* project onto rectilinear grid with 1 arcsec pixels, sort by X */
    4747  /* reference for coords is center of field  */
     48  InitCoords (&catstats[0].coords, "DEC--TAN");
    4849  catstats[0].coords.crval1 = RaCenter;
    4950  catstats[0].coords.crval2 = DecCenter;
    50   catstats[0].coords.crpix1 = catstats[0].coords.crpix2 = 0.0;
    5151  catstats[0].coords.cdelt1 = catstats[0].coords.cdelt2 = 1.0 / 3600.0;
    52   catstats[0].coords.pc1_1 = catstats[0].coords.pc2_2 = 1.0;
    53   catstats[0].coords.pc1_2 = catstats[0].coords.pc2_1 = 0.0;
    54   strcpy (catstats[0].coords.ctype, "DEC--TAN");
    5552
    5653  X1 = catstats[0].X;
  • branches/eam_branches/ipp-20140904/Ohana/src/gastro/src/gfitpoly.c

    r27435 r37386  
    261261    det = 1.0 / (a1*b2 - a2*b1);
    262262
     263    InitCoords (coords, "DEC--PLY");
     264
    263265    coords[0].pc1_1 = p11*a1 + p12*b1*(S2/S1);
    264266    coords[0].pc2_1 = p21*a1 + p22*b1*(S2/S1);
     
    273275
    274276    coords[0].Npolyterms = NORDER;
    275     strcpy (coords[0].ctype, "DEC--PLY");
    276277
    277278    /* generate higher order terms from vector */
  • branches/eam_branches/ipp-20140904/Ohana/src/gastro/src/gstars.c

    r36481 r37386  
    7979  if (!strcasecmp (ROUGH_ASTROMETRY, "config")) {
    8080    /* default values for coords */
    81     strcpy (coords[0].ctype, "DEC--TAN");
     81    InitCoords (coords, "DEC--TAN");
    8282    coords[0].pc1_1 = CCD_PC1_1; coords[0].pc1_2 = CCD_PC1_2;
    8383    coords[0].pc2_1 = CCD_PC2_1; coords[0].pc2_2 = CCD_PC2_2;
    8484    coords[0].cdelt1 = coords[0].cdelt2 = ASEC_PIX / 3600.0;
    85     coords[0].Npolyterms = 0;
    8685    coords[0].crpix1 = 0.5*(*NX);
    8786    coords[0].crpix2 = 0.5*(*NY);
  • branches/eam_branches/ipp-20140904/Ohana/src/gastro2/src/gproject2.c

    r12332 r37386  
    1919
    2020  /* create Tangent Plane to Sky transformation from input coords */
    21   strcpy (TPtoSky.ctype, coords[0].ctype);
     21  InitCoords (&TPtoSky, coords[0].ctype);
    2222  TPtoSky.crval1 = coords[0].crval1;
    2323  TPtoSky.crval2 = coords[0].crval2;
    2424
    25   TPtoSky.cdelt1 = TPtoSky.cdelt2 = 1;
    26   TPtoSky.crpix1 = TPtoSky.crpix2 = 0;
    27   TPtoSky.pc1_1 = TPtoSky.pc2_2 = 1;
    28   TPtoSky.pc1_2 = TPtoSky.pc2_1 = 0;
    29   TPtoSky.Npolyterms = 0;
    30   for (i = 0; i < 7; i++) {
    31     TPtoSky.polyterms[i][0] = 0;
    32     TPtoSky.polyterms[i][1] = 0;
    33   }
    34 
    3525  /* create Focal Plane to Tangent Plane transformation from input coords */
    36   strcpy (FPtoTP.ctype, "FP---PLY");
    37   FPtoTP.crval1 = FPtoTP.crval2 = 0;
    38 
     26  InitCoords (&FPtoTP, "FP---PLY");
    3927  FPtoTP.cdelt1 = coords[0].cdelt1;
    4028  FPtoTP.cdelt2 = coords[0].cdelt2;
  • branches/eam_branches/ipp-20140904/Ohana/src/gastro2/src/gstars2.c

    r37054 r37386  
    2828
    2929  /* default values for coords */
    30   strcpy (Target[0].coords.ctype, "DEC--TAN");
     30  InitCoords (&Target[0].coords, "DEC--TAN");
    3131  Target[0].coords.pc1_1 = CCD_PC1_1; Target[0].coords.pc1_2 = CCD_PC1_2;
    3232  Target[0].coords.pc2_1 = CCD_PC2_1; Target[0].coords.pc2_2 = CCD_PC2_2;
    3333  Target[0].coords.cdelt1 = Target[0].coords.cdelt2 = ASEC_PIX / 3600.0;
    34   Target[0].coords.Npolyterms = 0;
    3534  Target[0].coords.crpix1 = 0.5*NX;
    3635  Target[0].coords.crpix2 = 0.5*NY;
  • branches/eam_branches/ipp-20140904/Ohana/src/getstar/src/MatchImages.c

    r37378 r37386  
    2323  /* we keep the original crpix1,2 and crref1,2 */
    2424  /* for mosaic astrometry, the grid should be w.r.t. the tangent-plane, not chip coords */
     25  InitCoords (&tcoords, "DEC--TAN");
    2526  if (!strcmp (&image[0].coords.ctype[4], "-WRP")) {
    2627    myAssert (image[0].coords.mosaic, "should already have tested this");
    2728    tcoords = image[0].coords.mosaic[0];
    2829    tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    29     tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
    30     tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
    31     tcoords.Npolyterms = 1;
    32     strcpy (tcoords.ctype, "DEC--TAN");
    3330    /* register so image->sky conversions below have correct mosaic */
    3431  } else {
    3532    tcoords = image[0].coords;
    3633    tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    37     tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
    38     tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
    39     tcoords.Npolyterms = 1;
    40     strcpy (tcoords.ctype, "DEC--TAN");
    4134  }
    4235
  • branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/Graphs.c

    r36487 r37386  
    5757  graph[0].data.flipnorth = FALSE;      // +North = +Y by default
    5858
    59   graph[0].data.coords.pc1_1 = graph[0].data.coords.pc2_2 = 1.0;
    60   graph[0].data.coords.pc1_2 = graph[0].data.coords.pc2_1 = 0.0;
    61   graph[0].data.coords.crval1 = 0.0;
    62   graph[0].data.coords.crval2 = 0.0;
    63   graph[0].data.coords.crpix1 = 0.0;
    64   graph[0].data.coords.crpix2 = 0.0;
    65   graph[0].data.coords.cdelt1 = graph[0].data.coords.cdelt2 = 1.0;
    66   strcpy (graph[0].data.coords.ctype, "DEC--LIN");
     59  InitCoords (&graph[0].data.coords, "DEC--LIN");
    6760  strcpy (graph[0].data.axis, "2222");
    6861  strcpy (graph[0].data.ticks, "2222");
  • branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/Image.c

    r36487 r37386  
    1111  channel->slope = 1;
    1212
    13   channel->coords.pc1_1 = channel->coords.pc2_2 = 1.0;
    14   channel->coords.pc1_2 = channel->coords.pc2_1 = 0.0;
    15   channel->coords.crval1 = 0.0;
    16   channel->coords.crval2 = 0.0;
    17   channel->coords.crpix1 = 0.0;
    18   channel->coords.crpix2 = 0.0;
    19   channel->coords.cdelt1 = channel->coords.cdelt2 = 1.0;
    20   strcpy (channel->coords.ctype, "DEC--LIN");
    21   channel->coords.Npolyterms = 0;
     13  InitCoords (&channel->coords, "DEC--LIN");
    2214
    2315  channel->matrix.datasize = 0; /* a flag to show there is no data in the matrix */
  • branches/eam_branches/ipp-20140904/Ohana/src/libautocode/Makefile.Targets

    r37376 r37386  
    11AOBJS = \
    22$(ASRC)/coords-disk.$(ARCH).o \
     3$(ASRC)/AstromOffsetMap_Disk.$(ARCH).o \
    34$(ASRC)/average.$(ARCH).o \
    45$(ASRC)/average-loneos.$(ARCH).o \
     
    9899AINCS = \
    99100$(AINC)/coords-disk.h \
     101$(AINC)/AstromOffsetMap_Disk.h \
    100102$(AINC)/average.h \
    101103$(AINC)/average-loneos.h \
  • branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/common.h

    r37376 r37386  
    3434# define DVO_IMAGE_NAME_LEN 117
    3535
    36 typedef struct {
    37   int Nx;
    38   int Ny;
    39   float *value;
    40   float dX;
    41   float dY;
    42   float Xo;
    43   float Yo;
    44 } ImageMap;
    45 
    46 /* Internal version of Coords (see CoordsDisk in libautocode/def/coords-disk.d) */
    47 typedef struct Coords {
    48   double           crval1;               // coordinate at reference pixel
    49   double           crval2;               // coordinate at reference pixel
    50   float            crpix1;               // coordinate of reference pixel
    51   float            crpix2;               // coordinate of reference pixel
    52   float            cdelt1;               // degrees per pixel
    53   float            cdelt2;               // degrees per pixel
    54   float            pc1_1;                // rotation matrix
    55   float            pc1_2;                // rotation matrix
    56   float            pc2_1;                // rotation matrix
    57   float            pc2_2;                // rotation matrix
    58   float            polyterms[7][2];      // higher order warping terms
    59   char             ctype[15];            // coordinate type
    60   char             Npolyterms;           // order of polynomial
    61   struct Coords   *mosaic;               // pointer to parent mosaic
    62   ImageMap        *imageMap;             // pointer to image map transformation
    63 } Coords;
    64 
    65 typedef struct Image {
    66   Coords           coords;               // astrometric data
    67   e_time           tzero;                // readout time (row 0)
    68   unsigned int     nstar;                // number of stars on image
    69   float            secz;                 // airmass (mag)
    70   unsigned short   NX;                   // image width
    71   unsigned short   NY;                   // image height
    72   float            apmifit;              // aperture correction (mag)
    73   float            dapmifit;             // apmifit error (mag)
    74   float            Mcal;                 // calibration mag (mag)
    75   float            dMcal;                // error on Mcal (mag)
    76   short            Xm;                   // image chisq (10*log(value))
    77   short            photcode;             // identifier for CCD,
    78   float            exptime;              // exposure time (seconds)
    79   float            sidtime;              // sidereal time of exposure
    80   float            latitude;             // observatory latitude (degrees)
    81   float            RAo;                  // image center (degrees)
    82   float            DECo;                 // image center (degrees)
    83   float            Radius;               // image radius (degrees)
    84   float            refColorBlue;         // median astrometry ref color
    85   float            refColorRed;          // median astrometry ref color
    86   char             name[117];            // name of original image
    87   unsigned char    detection_limit;      // detection limit (10*mag)
    88   unsigned char    saturation_limit;     // saturation limit (10*mag)
    89   unsigned char    cerror;               // astrometric error (50*arcsec)
    90   unsigned char    fwhm_x;               // PSF x width (25*arcsec)
    91   unsigned char    fwhm_y;               // PSF y width (25*arcsec)
    92   unsigned char    trate;                // scan rate (100 usec/pixel)
    93   unsigned char    ccdnum;               // CCD ID number
    94   unsigned int     flags;                // image quality flags
    95   unsigned int     imageID;              // internal image ID
    96   unsigned int     parentID;             // associated ref image
    97   unsigned int     externID;             // external image ID
    98   unsigned short   sourceID;             // analysis source ID
    99   short            nLinkAstrom;          // mean number of matched measurements for astrometry
    100   short            nLinkPhotom;          // mean number of matched measurements for astrometry
    101   short            ubercalDist;          // distance to nearest ubercal image
    102   float            dXpixSys;             // systematic astrometry error in X
    103   float            dYpixSys;             // systematic astrometry error in Y
    104   float            dMagSys;              // systematic photometry error
    105   unsigned short   nFitAstrom;           // number of stars used for astrometry cal
    106   unsigned short   nFitPhotom;           // number of stars used for photometry cal
    107   unsigned int     photom_map_id;        // reference to 2D zero point map
    108   unsigned int     astrom_map_id;        // reference to 2D astrometry map
    109   struct Image    *parent;               // pointer to parent mosaic (not save to disk)
    110 } Image;
    111 
    11236/*** rawshort is used to handle the broken pre-autocode photreg tables
    11337     fix the tables and remove this
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/Makefile

    r37035 r37386  
    8686$(SRC)/skyregion_gsc.$(ARCH).o    \
    8787$(SRC)/skyregion_ops.$(ARCH).o \
     88$(SRC)/AstromOffsetMapIO.$(ARCH).o    \
     89$(SRC)/AstromOffsetMapOps.$(ARCH).o \
    8890$(SRC)/dvo_set_skyregion.$(ARCH).o \
    8991$(SRC)/dvo_set_catdir.$(ARCH).o \
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/dvo.h

    r37377 r37386  
    3636
    3737typedef enum {DVO_CAT_OPEN_FAIL, DVO_CAT_OPEN_OK, DVO_CAT_OPEN_EMPTY} DVOCatalogOpenModes;
    38 
    39 typedef enum {
    40   PROJ_NONE, // undefined
    41   PROJ_ZEA, // zenithal
    42   PROJ_ZPL, // zenithal
    43   PROJ_ARC, // zenithal
    44   PROJ_STG, // zenithal
    45   PROJ_SIN, // zenithal
    46   PROJ_TAN, // zenithal
    47   PROJ_TNX, // zenithal
    48   PROJ_DIS, // zenithal (TAN + polyterms)
    49   PROJ_LIN, // cartesian
    50   PROJ_PLY, // cartesian
    51   PROJ_WRP, // cartesian
    52   PROJ_AIT, // pseudocyl
    53   PROJ_GLS, // pseudocyl
    54   PROJ_PAR, // pseudocyl
    55 } OhanaProjection;
    56 
    57 typedef enum {
    58   PROJ_MODE_NONE,
    59   PROJ_MODE_CARTESIAN,
    60   PROJ_MODE_ZENITHAL,
    61   PROJ_MODE_PSEUDOCYL,
    62 } OhanaProjectionMode;
    6338
    6439// these are used as NAN for types of int values
     
    202177} DVOSecfiltFlags;
    203178
     179/* definitions for parallel dvo host information
     180   XXX : need better names (safer namespace)
     181*/
     182
     183typedef enum {
     184  DATA_ON_TGT  = 0x01,
     185  DATA_ON_BCK  = 0x02,
     186  DATA_USE_BCK = 0x04,
     187
     188  DATA_COPY_FAILURE = 0x80,
     189} SkyTableDataFlags;
     190
     191typedef enum {
     192  HOST_STDIN = 0,
     193  HOST_STDOUT = 1,
     194  HOST_STDERR = 2,
     195} HostInfoIOfd;
     196
    204197/*** general dvo structures (internal use only / not IO) ***/
    205198
     
    252245  e_time *tstop;
    253246} FlatCorrectionTable;
    254 
    255 /* definitions for parallel dvo host information
    256    XXX : need better names (safer namespace)
    257 */
    258 
    259 typedef enum {
    260   DATA_ON_TGT  = 0x01,
    261   DATA_ON_BCK  = 0x02,
    262   DATA_USE_BCK = 0x04,
    263 
    264   DATA_COPY_FAILURE = 0x80,
    265 } SkyTableDataFlags;
    266 
    267 typedef enum {
    268   HOST_STDIN = 0,
    269   HOST_STDOUT = 1,
    270   HOST_STDERR = 2,
    271 } HostInfoIOfd;
    272247
    273248typedef struct {
     
    738713int   gfits_db_free                PROTO((FITS_DB *db));
    739714
    740 /* in coords.c, using libautocode/def/coords.d */
    741 int  XY_to_LM (double *L, double *M, double x,  double y,   Coords *coords);
    742 int  LM_to_XY (double *x,  double *y,   double L, double M, Coords *coords);
    743 int  RD_to_LM (double *L, double *M, double ra,  double dec,   Coords *coords);
    744 int  LM_to_RD (double *ra, double *dec,   double L, double M, Coords *coords);
    745 int  XY_to_RD (double *ra, double *dec, double x,  double y,   Coords *coords);
    746 int  RD_to_XY (double *x,  double *y,   double ra, double dec, Coords *coords);
    747 int  fXY_to_RD (float *ra, float *dec, double x,  double y,   Coords *coords);
    748 int  fRD_to_XY (float *x,  float *y,   double ra, double dec, Coords *coords);
    749 int  GetCoords (Coords *coords, Header *header);
    750 int  PutCoords (Coords *coords, Header *header);
    751 void RegisterMosaic (Coords *coords);
    752 void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch);
    753 OhanaProjection GetProjection (char *ctype);
    754 int SetProjection (char *ctype, OhanaProjection proj);
    755 OhanaProjectionMode GetProjectionMode (OhanaProjection proj);
    756 
    757715char *libdvo_version (void);
    758716
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/libdvo_astro.h

    r31635 r37386  
    1 #ifdef notdef
    2 # include "external.h"
    3 # include "shell.h"
    4 # include "dvomath.h"
    5 # include "convert.h"
    6 # include "display.h"
    7 # include "data.h"
    8 #endif
     1# ifndef LIBDVO_ASTRO_H
     2# define LIBDVO_ASTRO_H
    93
    10 # ifndef ASTRO_H
    11 # define ASTRO_H
     4typedef enum {
     5  COORD_NONE,
     6  COORD_CELESTIAL,
     7  COORD_GALACTIC,
     8  COORD_ECLIPTIC
     9} CoordTransformSystem;
    1210
    13 void InitAstro (void);
    14 void FreeAstro (void);
     11typedef enum {
     12  PROJ_NONE, // undefined
     13  PROJ_ZEA, // zenithal
     14  PROJ_ZPL, // zenithal
     15  PROJ_ARC, // zenithal
     16  PROJ_STG, // zenithal
     17  PROJ_SIN, // zenithal
     18  PROJ_TAN, // zenithal
     19  PROJ_TNX, // zenithal
     20  PROJ_DIS, // zenithal (TAN + polyterms)
     21  PROJ_LIN, // cartesian
     22  PROJ_PLY, // cartesian (allow polyterms)
     23  PROJ_WRP, // cartesian (allow polyterms, require mosaic)
     24  PROJ_AIT, // pseudocyl
     25  PROJ_GLS, // pseudocyl
     26  PROJ_PAR, // pseudocyl
     27} OhanaProjection;
     28
     29typedef enum {
     30  PROJ_MODE_NONE,
     31  PROJ_MODE_CARTESIAN,
     32  PROJ_MODE_ZENITHAL,
     33  PROJ_MODE_PSEUDOCYL,
     34} OhanaProjectionMode;
    1535
    1636typedef struct {
     
    2949} CoordTransform;
    3050
    31 typedef enum {COORD_NONE, COORD_CELESTIAL, COORD_GALACTIC, COORD_ECLIPTIC} CoordTransformSystem;
     51typedef struct {
     52  int Nx;
     53  int Ny;
     54  float dX;
     55  float dY;
     56  float **dXv;
     57  float **dYv;
     58  unsigned int ID;
     59  unsigned int imageID;
     60} AstromOffsetMap;
     61
     62typedef struct {
     63  int Nmap;
     64  AstromOffsetMap *map;
     65  int *IDtoSeq;
     66  int MaxID;
     67} AstromOffsetTable;
     68
     69/* Internal version of Coords (see CoordsDisk in libautocode/def/coords-disk.d) */
     70typedef struct Coords {
     71  double           crval1;               // coordinate at reference pixel
     72  double           crval2;               // coordinate at reference pixel
     73  float            crpix1;               // coordinate of reference pixel
     74  float            crpix2;               // coordinate of reference pixel
     75  float            cdelt1;               // degrees per pixel
     76  float            cdelt2;               // degrees per pixel
     77  float            pc1_1;                // rotation matrix
     78  float            pc1_2;                // rotation matrix
     79  float            pc2_1;                // rotation matrix
     80  float            pc2_2;                // rotation matrix
     81  float            polyterms[7][2];      // higher order warping terms
     82  char             ctype[15];            // coordinate type
     83  char             Npolyterms;           // order of polynomial
     84  struct Coords   *mosaic;               // pointer to parent mosaic
     85  AstromOffsetMap *offsetMap;            // pointer to offset map transformation
     86} Coords;
     87
     88typedef struct Image {
     89  Coords           coords;               // astrometric data
     90  e_time           tzero;                // readout time (row 0)
     91  unsigned int     nstar;                // number of stars on image
     92  float            secz;                 // airmass (mag)
     93  unsigned short   NX;                   // image width
     94  unsigned short   NY;                   // image height
     95  float            apmifit;              // aperture correction (mag)
     96  float            dapmifit;             // apmifit error (mag)
     97  float            Mcal;                 // calibration mag (mag)
     98  float            dMcal;                // error on Mcal (mag)
     99  short            Xm;                   // image chisq (10*log(value))
     100  short            photcode;             // identifier for CCD,
     101  float            exptime;              // exposure time (seconds)
     102  float            sidtime;              // sidereal time of exposure
     103  float            latitude;             // observatory latitude (degrees)
     104  float            RAo;                  // image center (degrees)
     105  float            DECo;                 // image center (degrees)
     106  float            Radius;               // image radius (degrees)
     107  float            refColorBlue;         // median astrometry ref color
     108  float            refColorRed;          // median astrometry ref color
     109  char             name[117];            // name of original image
     110  unsigned char    detection_limit;      // detection limit (10*mag)
     111  unsigned char    saturation_limit;     // saturation limit (10*mag)
     112  unsigned char    cerror;               // astrometric error (50*arcsec)
     113  unsigned char    fwhm_x;               // PSF x width (25*arcsec)
     114  unsigned char    fwhm_y;               // PSF y width (25*arcsec)
     115  unsigned char    trate;                // scan rate (100 usec/pixel)
     116  unsigned char    ccdnum;               // CCD ID number
     117  unsigned int     flags;                // image quality flags
     118  unsigned int     imageID;              // internal image ID
     119  unsigned int     parentID;             // associated ref image
     120  unsigned int     externID;             // external image ID
     121  unsigned short   sourceID;             // analysis source ID
     122  short            nLinkAstrom;          // mean number of matched measurements for astrometry
     123  short            nLinkPhotom;          // mean number of matched measurements for astrometry
     124  short            ubercalDist;          // distance to nearest ubercal image
     125  float            dXpixSys;             // systematic astrometry error in X
     126  float            dYpixSys;             // systematic astrometry error in Y
     127  float            dMagSys;              // systematic photometry error
     128  unsigned short   nFitAstrom;           // number of stars used for astrometry cal
     129  unsigned short   nFitPhotom;           // number of stars used for photometry cal
     130  unsigned int     photom_map_id;        // reference to 2D zero point map
     131  unsigned int     astrom_map_id;        // reference to 2D astrometry map
     132  struct Image    *parent;               // pointer to parent mosaic (not save to disk)
     133} Image;
    32134
    33135CoordTransform *InitTransform (CoordTransformSystem input, CoordTransformSystem output);
    34136int ApplyTransform (double *x, double *y, double X, double Y, CoordTransform *transform);
    35137
     138/* in coords.c */
     139void InitCoords (Coords *coords, char *projection);
     140int  XY_to_LM (double *L, double *M, double x,  double y,   Coords *coords);
     141int  LM_to_XY (double *x,  double *y,   double L, double M, Coords *coords);
     142int  RD_to_LM (double *L, double *M, double ra,  double dec,   Coords *coords);
     143int  LM_to_RD (double *ra, double *dec,   double L, double M, Coords *coords);
     144int  XY_to_RD (double *ra, double *dec, double x,  double y,   Coords *coords);
     145int  RD_to_XY (double *x,  double *y,   double ra, double dec, Coords *coords);
     146int  fXY_to_RD (float *ra, float *dec, double x,  double y,   Coords *coords);
     147int  fRD_to_XY (float *x,  float *y,   double ra, double dec, Coords *coords);
     148int  GetCoords (Coords *coords, Header *header);
     149int  PutCoords (Coords *coords, Header *header);
     150void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch);
     151OhanaProjection GetProjection (char *ctype);
     152int SetProjection (char *ctype, OhanaProjection proj);
     153OhanaProjectionMode GetProjectionMode (OhanaProjection proj);
     154
     155/* in AstromOffsetMapIO.c */
     156AstromOffsetTable *AstromOffsetMapLoad (char *filename, int VERBOSE);
     157int AstromOffsetMapSave (AstromOffsetTable *table, char *filename);
     158AstromOffsetTable *AstromOffsetMapToTable(AstromOffsetMap_Disk_6x6 *map_disk, off_t Nmap);
     159AstromOffsetMap_Disk_6x6 *AstromOffsetTableToMap(AstromOffsetTable *table, off_t *Nmap);
     160
     161/* in AstromOffsetMapOps.c */
     162float AstromOffsetMapValue (AstromOffsetMap *map, float x, float y, int xdir);
     163int AstromOffsetMapFit (AstromOffsetMap *map, float *x, float *y, float *f, int Npts, int xdir);
     164
    36165# endif
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/ImageMetadataSelection.c

    r36490 r37386  
    1313 
    1414  /* field defines a frame with 0,0 at the field center, and 1 arcsec / pixel */
    15   field.crpix1 = field.crpix2 = 0.0;
     15  InitCoords (&field, "DEC--SIN");
    1616  field.cdelt1 = field.cdelt2 = 1.0 / 3600;
    17   field.pc1_1  = field.pc2_2  = 1.0;
    18   field.pc1_2  = field.pc2_1  = 0.0;
    19   field.Npolyterms = 0;
    20   strcpy (field.ctype, "DEC--SIN");
    2117
    2218  /* mosaic defines a frame with 0,0 at the mosaic center, and 1 arcsec / pixel */
    23   mosaic.crpix1 = mosaic.crpix2 = 0.0;
     19  InitCoords (&mosaic, "DEC--SIN");
    2420  mosaic.cdelt1 = mosaic.cdelt2 = 1.0 / 3600;
    25   mosaic.pc1_1  = mosaic.pc2_2  = 1.0;
    26   mosaic.pc1_2  = mosaic.pc2_1  = 0.0;
    27   mosaic.Npolyterms = 0;
    28   strcpy (mosaic.ctype, "DEC--SIN");
    2921
    3022  if ((image = ImageMetadataLoad (filename, &Nimage)) == NULL) return (FALSE);
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/ImageSelection.c

    r37377 r37386  
    2222
    2323  if (mosaicMode) {
    24       /* mosaic defines a frame with 0,0 at the mosaic center, and 1 arcsec / pixel */
    25       mosaic.crpix1 = mosaic.crpix2 = 0.0;
    26       mosaic.cdelt1 = mosaic.cdelt2 = 1.0 / 3600;
    27       mosaic.pc1_1  = mosaic.pc2_2  = 1.0;
    28       mosaic.pc1_2  = mosaic.pc2_1  = 0.0;
    29       mosaic.Npolyterms = 0;
    30       strcpy (mosaic.ctype, "DEC--SIN");
     24    /* mosaic defines a frame with 0,0 at the mosaic center, and 1 arcsec / pixel */
     25    InitCoords (&mosaic, "DEC--SIN");
     26    mosaic.cdelt1 = mosaic.cdelt2 = 1.0 / 3600;
    3127  }
    3228
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/coord_systems.c

    r31635 r37386  
    11# include "dvo.h"
    2 # include "libdvo_astro.h"
    32   
    43CoordTransform *InitTransform (CoordTransformSystem input, CoordTransformSystem output) {
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/coordops.c

    r37377 r37386  
    33/* note that Coords.ctype carries the DEC (ctype2) value */
    44
    5 // this was previously coded not-thread-safe: I've added the mosaic link directly to the Coords structure
    6 # if (0)
    7 static Coords mosaic;
    8 static int gotMosaic = FALSE;
    9 
    10 void RegisterMosaic (Coords *coords) {
    11   mosaic = *coords;
    12   gotMosaic = TRUE;
    13 }
    14 
    15 int isRegisteredMosaic () {
    16   return (gotMosaic);
    17 }
    18 
    19 int GetMosaicCoords (Coords *coords) {
    20   *coords = mosaic;
    21   return (TRUE);
    22 }
    23 # endif
     5// default coordinates have unit scale and no rotation
     6void InitCoords (Coords *coords, char *projection) {
     7  coords->crval1 = 0.0;
     8  coords->crval2 = 0.0;
     9  coords->crpix1 = 0.0;
     10  coords->crpix2 = 0.0;
     11
     12  coords->cdelt1 = 1.0;
     13  coords->cdelt2 = 1.0;
     14
     15  coords->pc1_1 = 1.0; // EW is flipped relative to sky parity (dRA/dX > 0)
     16  coords->pc2_2 = 1.0;
     17  coords->pc2_1 = 0.0;
     18  coords->pc1_2 = 0.0;
     19
     20  coords->Npolyterms = 1;
     21  coords->mosaic = NULL;
     22  coords->offsetMap = NULL;
     23
     24  memset (coords->polyterms, 0, 7*2*sizeof(float));
     25
     26  if (projection) {
     27    strcpy (coords->ctype, projection);
     28  } else {
     29    strcpy (coords->ctype, "NONE");
     30  }
     31}
    2432
    2533int XY_to_LM (double *L, double *M, double x, double y, Coords *coords) {
     
    3139  proj = GetProjection (coords[0].ctype);
    3240  mode = GetProjectionMode (proj);
     41
     42  // if we have an image map, it should be applied to the pixel coordinates
     43  // before anything else is done.  It is easier to invert the map if it is
     44  // of the form (dX,dY) = f(X,Y), then if (dL,dM) = f(X,Y).
     45  if (coords[0].Npolyterms == -1) {
     46    myAssert (coords[0].offsetMap, "offsetMap is requested by not defined");
     47    float dX = AstromOffsetMapValue (coords->offsetMap, x, y, TRUE);
     48    float dY = AstromOffsetMapValue (coords->offsetMap, x, y, FALSE);
     49    x += dX;
     50    y += dY;
     51  }
    3352
    3453  /** convert pixel coordinates to cartesian system **/
     
    390409  *y = Yo / coords[0].cdelt2 + coords[0].crpix2;
    391410
     411  // if we have an image map, it should be applied to the pixel coordinates
     412  // after anything else is done.  It is easier to invert the map if it is
     413  // of the form (dX,dY) = f(X,Y), then if (dL,dM) = f(X,Y).
     414  if (coords[0].Npolyterms == -1) {
     415    myAssert (coords[0].offsetMap, "offsetMap is requested by not defined");
     416
     417    double xraw = *x;
     418    double yraw = *y;
     419
     420    double dXo = 0.0;
     421    double dYo = 0.0;
     422
     423    int i;
     424    for (i = 0; i < 4; i++) {
     425      double dX = AstromOffsetMapValue (coords->offsetMap, xraw, yraw, TRUE);
     426      double dY = AstromOffsetMapValue (coords->offsetMap, xraw, yraw, FALSE);
     427
     428      dX -= dXo;
     429      dY -= dYo;
     430
     431      xraw -= dX;
     432      yraw -= dY;
     433
     434      dXo += dX;
     435      dYo += dY;
     436    }
     437
     438    *x = xraw;
     439    *y = yraw;
     440
     441    // I need to iterate since the position at which I have first made the correction is
     442    // not the true position.  but if dX,dY is small and the gradient of dX,dY is also
     443    // small, then even a single pass gets us close.
     444
     445    // XXX test this and use a while (hypot(dX,dY) > XXX) condition
     446  }
    392447  return (TRUE);
    393448}
     
    458513 
    459514  rotate = 0.0;
    460   coords[0].crval1 = coords[0].crpix1 = coords[0].cdelt1 = 0.0;
    461   coords[0].crval2 = coords[0].crpix2 = coords[0].cdelt2 = 0.0;
    462   coords[0].pc1_1 = coords[0].pc2_2 = 1.0;
    463   coords[0].pc2_1 = coords[0].pc1_2 = 0.0;
    464   coords[0].Npolyterms = 1;
    465   strcpy (coords[0].ctype, "NONE");
     515
     516  InitCoords (coords, NULL);
    466517 
    467518  mode = COORD_TYPE_NONE;
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c

    r37377 r37386  
    222222    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
    223223    out[i].coords.mosaic   = NULL;
    224     out[i].coords.imageMap = NULL;
     224    out[i].coords.offsetMap = NULL;
    225225
    226226    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c

    r37377 r37386  
    217217    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
    218218    out[i].coords.mosaic   = NULL;
    219     out[i].coords.imageMap = NULL;
     219    out[i].coords.offsetMap = NULL;
    220220
    221221    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_3.c

    r37377 r37386  
    2121    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
    2222    out[i].coords.mosaic   = NULL;
    23     out[i].coords.imageMap = NULL;
     23    out[i].coords.offsetMap = NULL;
    2424
    2525    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c

    r37377 r37386  
    148148    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
    149149    out[i].coords.mosaic   = NULL;
    150     out[i].coords.imageMap = NULL;
     150    out[i].coords.offsetMap = NULL;
    151151
    152152    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c

    r37377 r37386  
    241241    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
    242242    out[i].coords.mosaic   = NULL;
    243     out[i].coords.imageMap = NULL;
     243    out[i].coords.offsetMap = NULL;
    244244
    245245    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c

    r37377 r37386  
    252252    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
    253253    out[i].coords.mosaic   = NULL;
    254     out[i].coords.imageMap = NULL;
     254    out[i].coords.offsetMap = NULL;
    255255
    256256    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c

    r37377 r37386  
    262262    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
    263263    out[i].coords.mosaic   = NULL;
    264     out[i].coords.imageMap = NULL;
     264    out[i].coords.offsetMap = NULL;
    265265
    266266    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c

    r37377 r37386  
    301301    // this is only save because the initial 120 bytes in Coords match CoordsDisk
    302302    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
    303     out[i].coords.mosaic   = NULL;
    304     out[i].coords.imageMap = NULL;
     303    out[i].coords.mosaic    = NULL;
     304    out[i].coords.offsetMap = NULL;
    305305
    306306    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c

    r37377 r37386  
    679679    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
    680680    out[i].coords.mosaic   = NULL;
    681     out[i].coords.imageMap = NULL;
     681    out[i].coords.offsetMap = NULL;
    682682
    683683    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_elixir.c

    r37377 r37386  
    213213    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
    214214    out[i].coords.mosaic   = NULL;
    215     out[i].coords.imageMap = NULL;
     215    out[i].coords.offsetMap = NULL;
    216216
    217217    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_loneos.c

    r37377 r37386  
    191191    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
    192192    out[i].coords.mosaic   = NULL;
    193     out[i].coords.imageMap = NULL;
     193    out[i].coords.offsetMap = NULL;
    194194
    195195    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c

    r37377 r37386  
    230230    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
    231231    out[i].coords.mosaic   = NULL;
    232     out[i].coords.imageMap = NULL;
     232    out[i].coords.offsetMap = NULL;
    233233
    234234    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c

    r37377 r37386  
    230230    memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk));
    231231    out[i].coords.mosaic   = NULL;
    232     out[i].coords.imageMap = NULL;
     232    out[i].coords.offsetMap = NULL;
    233233
    234234    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
  • branches/eam_branches/ipp-20140904/Ohana/src/libkapa/src/KapaWindow.c

    r36488 r37386  
    9898  graphdata[0].lweight = graphdata[0].size = 1.0;
    9999   
    100   graphdata[0].coords.pc1_1 = graphdata[0].coords.pc2_2 = 1.0;
    101   graphdata[0].coords.pc1_2 = graphdata[0].coords.pc2_1 = 0.0;
    102   strcpy (graphdata[0].coords.ctype, "DEC--LIN");
    103   graphdata[0].coords.crval1 = 0.0;
    104   graphdata[0].coords.crval2 = 0.0;
    105   graphdata[0].coords.crpix1 = 0.0;
    106   graphdata[0].coords.crpix2 = 0.0;
    107   graphdata[0].coords.cdelt1 = graphdata[0].coords.cdelt2 = 1.0;
    108   graphdata[0].flipeast = TRUE;
     100  InitCoords (&graphdata[0].coords, "DEC--LIN");
     101  graphdata[0].flipeast = TRUE; // default coords has EW flipped relative to sky
    109102  graphdata[0].flipnorth = FALSE;
    110103
  • branches/eam_branches/ipp-20140904/Ohana/src/libohana/Makefile

    r33646 r37386  
    3535$(SRC)/time.$(ARCH).o            \
    3636$(SRC)/gaussj.$(ARCH).o          \
     37$(SRC)/vstats.$(ARCH).o          \
    3738$(SRC)/config.$(ARCH).o          \
    3839$(SRC)/Fread.$(ARCH).o           \
  • branches/eam_branches/ipp-20140904/Ohana/src/libohana/include/ohana.h

    r37356 r37386  
    242242// sorting is now defined as a macro call
    243243# include <ohana_sort.h>
     244
     245// vector statistics options
     246typedef enum {
     247  VSTATS_NONE,
     248  VSTATS_MEAN,
     249  VSTATS_MEDIAN,
     250  VSTATS_WT_MEAN,
     251  VSTATS_INNER_MEAN,
     252  VSTATS_INNER_WTMEAN,
     253  VSTATS_CHI_INNER_MEAN,
     254  VSTATS_CHI_INNER_WTMEAN
     255} VStatsMode;
     256
     257typedef struct {
     258  double median;
     259  double mean;
     260  double sigma;
     261  double error;
     262  double chisq;
     263  double min;
     264  double max;
     265  double Upper80;
     266  double Lower20;
     267  double total;
     268  int    Nmeas;
     269  VStatsMode statmode;
     270} VStatsType;
    244271
    245272/* socket / pipe communication buffer */
     
    388415int rconnect (char *command, char *hostname, char *shell, int *stdio, int *errorInfo, int doHandshake);
    389416
     417int vstats_setmode (VStatsType *stats, char *mode);
     418int vstats_getstats (double *value, double *dvalue, double *weight, int N, VStatsType *stats);
     419int vstats_getstats_f (float *value, float *dvalue, float *weight, int N, VStatsType *stats);
     420
    390421/*
    391422#   define F_SETFL         4   
  • branches/eam_branches/ipp-20140904/Ohana/src/markrock/src/gcatstats.c

    r36481 r37386  
    3434  /* project onto rectilinear grid with 1 arcsec pixels, sort by X */
    3535  /* reference for coords is center of field  */
     36  InitCoords (&catstats[0].coords, "DEC--TAN");
    3637  catstats[0].coords.crval1 = RaCenter;
    3738  catstats[0].coords.crval2 = DecCenter;
    38   catstats[0].coords.crpix1 = catstats[0].coords.crpix2 = 0.0;
    3939  catstats[0].coords.cdelt1 = catstats[0].coords.cdelt2 = 1.0 / 3600.0;
    40   catstats[0].coords.pc1_1 = catstats[0].coords.pc2_2 = 1.0;
    41   catstats[0].coords.pc1_2 = catstats[0].coords.pc2_1 = 0.0;
    42   strcpy (catstats[0].coords.ctype, "DEC--TAN");
    43 
     40 
    4441  X1 = catstats[0].X;
    4542  Y1 = catstats[0].Y;
  • branches/eam_branches/ipp-20140904/Ohana/src/markstar/src/gcatstats.c

    r36483 r37386  
    4444  /* project onto rectilinear grid with 1 arcsec pixels, sort by X */
    4545  /* reference for coords is center of field  */
     46  InitCoords (&catstats[0].coords, "DEC--TAN");
    4647  catstats[0].coords.crval1 = RaCenter;
    4748  catstats[0].coords.crval2 = DecCenter;
    48   catstats[0].coords.crpix1 = catstats[0].coords.crpix2 = 0.0;
    4949  catstats[0].coords.cdelt1 = catstats[0].coords.cdelt2 = 1.0 / 3600.0;
    50   catstats[0].coords.pc1_1 = catstats[0].coords.pc2_2 = 1.0;
    51   catstats[0].coords.pc1_2 = catstats[0].coords.pc2_1 = 0.0;
    52   strcpy (catstats[0].coords.ctype, "DEC--TAN");
    5350
    5451  X1 = catstats[0].X;
  • branches/eam_branches/ipp-20140904/Ohana/src/mosastro/src/chips.c

    r7401 r37386  
    2121
    2222    /* bore site center guess */
    23     strcpy (chip[i].map.ctype, "DEC--PLY");
    24     chip[i].map.crpix1 = 0.0;
    25     chip[i].map.crpix2 = 0.0;
    26     chip[i].map.cdelt1 = 1.0;
    27     chip[i].map.cdelt2 = 1.0;
     23    InitCoords (&chip[i].map, "DEC--PLY");
    2824
    2925    /* find (L,M) coords of reference pixel (0,0) */
  • branches/eam_branches/ipp-20140904/Ohana/src/mosastro/src/fakefield.c

    r3401 r37386  
    2222
    2323  /* bore site center guess */
    24   strcpy (field.project.ctype, "DEC--TAN");
    25   field.project.crpix1 = 0;
    26   field.project.crpix2 = 0;
     24  InitCoords (&field.project, "DEC--TAN");
    2725 
    2826  /* set TP plate scale */
     
    3028  field.project.cdelt2 = 1.0/3600.0;
    3129
    32   /** allow guess at field rotation?? **/
    33   field.project.pc1_1  = 1;
    34   field.project.pc2_2  = 1;
    35   field.project.pc1_2  = 0;
    36   field.project.pc2_1  = 0;
    37   field.project.Npolyterms = 1;
    38 
    3930  /** distort only has power in polyterms **/
    40   strcpy (field.distort.ctype, "DEC--PLY");
    41   field.distort.crval1 = 0.0;
    42   field.distort.crval2 = 0.0;
    43   field.distort.crpix1 = 0.0;
    44   field.distort.crpix2 = 0.0;
    45   field.distort.cdelt1 = 1.0;
    46   field.distort.cdelt2 = 1.0;
    47  
    48   field.distort.pc1_1  = 1;
    49   field.distort.pc2_2  = 1;
    50   field.distort.pc1_2  = 0;
    51   field.distort.pc2_1  = 0;
    52 
    53   /* how do we handle renormalization? (fixed at 1000 pixels??) */
    54   field.distort.Npolyterms = 3;
    55   for (i = 0; i < 7; i++) {
    56     field.distort.polyterms[i][0] = 0;
    57     field.distort.polyterms[i][1] = 0;
    58   }
     31  InitCoords (&field.distort, "DEC--PLY");
    5932
    6033  return (1);
  • branches/eam_branches/ipp-20140904/Ohana/src/mosastro/src/field.c

    r7401 r37386  
    1212
    1313  /* bore site center guess */
    14   strcpy (field.project.ctype, "DEC--TAN");
     14  InitCoords (&field.project, "DEC--TAN");
    1515
    1616  # if (PSASTRO_MODE)
     
    2323  # endif
    2424
    25   field.project.crpix1 = 0;
    26   field.project.crpix2 = 0;
    27  
    2825  /* measure average plate scale - would be better using parabolic min... */
    2926  field.project.cdelt1 = 0;
     
    4744           3600*field.project.cdelt1, 3600*field.project.cdelt2);
    4845
    49   /** allow guess at field rotation?? **/
    50   field.project.pc1_1  = 1;
    51   field.project.pc2_2  = 1;
    52   field.project.pc1_2  = 0;
    53   field.project.pc2_1  = 0;
    54   field.project.Npolyterms = 1;
    55 
    5646  /* bore site center guess */
    57   strcpy (field.distort.ctype, "DEC--PLY");
    58   field.distort.crval1 = 0.0;
    59   field.distort.crval2 = 0.0;
    60   field.distort.crpix1 = 0.0;
    61   field.distort.crpix2 = 0.0;
    62   field.distort.cdelt1 = 1.0;
    63   field.distort.cdelt2 = 1.0;
    64  
    65   /** allow guess at field rotation?? **/
    66   field.distort.pc1_1  = 1;
    67   field.distort.pc2_2  = 1;
    68   field.distort.pc1_2  = 0;
    69   field.distort.pc2_1  = 0;
    70 
    71   /* allow 2nd and 3rd order? */
    72   /* how do we handle renormalization? (fixed at 1000 pixels??) */
    73   field.distort.Npolyterms = 1;
    74   for (i = 0; i < 7; i++) {
    75     field.distort.polyterms[i][0] = 0;
    76     field.distort.polyterms[i][1] = 0;
    77   }
     47  InitCoords (&field.distort, "DEC--PLY");
    7848  return (TRUE);
    7949}
     
    138108int load_field (char *filename) {
    139109
    140   int i;
    141110  Coords coords;
    142111  Header header;
     
    156125
    157126  /* bore site center guess */
    158   strcpy (field.project.ctype, "DEC--TAN");
     127  InitCoords (&field.project, "DEC--TAN");
    159128  field.project.crval1 = 0.5*(field.Rmin + field.Rmax);
    160129  field.project.crval2 = 0.5*(field.Dmin + field.Dmax);
    161   field.project.crpix1 = 0;
    162   field.project.crpix2 = 0;
    163130 
    164131  /* measure average plate scale - would be better using parabolic min... */
     
    174141
    175142  /* bore site center guess */
    176   strcpy (field.distort.ctype, "DEC--PLY");
    177   field.distort.crval1 = 0.0;
    178   field.distort.crval2 = 0.0;
    179   field.distort.crpix1 = 0.0;
    180   field.distort.crpix2 = 0.0;
    181   field.distort.cdelt1 = 1.0;
    182   field.distort.cdelt2 = 1.0;
    183  
    184   /** allow guess at field rotation?? **/
    185   field.distort.pc1_1  = 1;
    186   field.distort.pc2_2  = 1;
    187   field.distort.pc1_2  = 0;
    188   field.distort.pc2_1  = 0;
     143  InitCoords (&field.distort, "DEC--PLY");
    189144
    190   /* allow 2nd and 3rd order? */
    191   /* how do we handle renormalization? (fixed at 1000 pixels??) */
    192   field.distort.Npolyterms = coords.Npolyterms;
    193   for (i = 0; i < 7; i++) {
    194     field.distort.polyterms[i][0] = coords.polyterms[i][0];
    195     field.distort.polyterms[i][1] = coords.polyterms[i][1];
    196   }
    197145  return (TRUE);
    198146}
  • branches/eam_branches/ipp-20140904/Ohana/src/mosastro/src/fitpoly.c

    r16058 r37386  
    130130  double R;
    131131
     132  InitCoords (coords, "DEC--PLY");
     133
    132134  /* update the higher order terms */
    133135  if (NORDER > 1) {
     
    166168
    167169  coords[0].Npolyterms = NORDER;
    168   strcpy (coords[0].ctype, "DEC--PLY");
    169170}
    170171
  • branches/eam_branches/ipp-20140904/Ohana/src/mosastro/src/mkobs.c

    r7080 r37386  
    104104
    105105      /* Chip-Sky terms */
    106       strcpy (coords.ctype, "DEC--WRP");
     106      InitCoords (&coords, "DEC--WRP");
    107107      coords.crval1 = Ro;
    108108      coords.crval2 = Do;
     
    124124      }
    125125
    126       coords.pc1_1  = 1;
    127       coords.pc2_2  = 1;
    128       coords.pc1_2  = 0;
    129       coords.pc2_1  = 0;
    130       coords.Npolyterms = 1;
    131 
    132126      header = mkheader (2*dX, 2*dY, Nstars, &coords);
    133127
  • branches/eam_branches/ipp-20140904/Ohana/src/mosastro/src/mkstandards.c

    r7080 r37386  
    3232
    3333  /* bore site center guess */
    34   strcpy (coords.ctype, "DEC--TAN");
     34  InitCoords (&coords, "DEC--TAN");
    3535  coords.crval1 = atof(argv[1]);
    3636  coords.crval2 = atof(argv[2]);
    3737  coords.crpix1 = dX;
    3838  coords.crpix2 = dX;
    39  
    4039  coords.cdelt1 = 1/3600.0;
    4140  coords.cdelt2 = 1/3600.0;
    42 
    43   coords.pc1_1  = 1;
    44   coords.pc2_2  = 1;
    45   coords.pc1_2  = 0;
    46   coords.pc2_1  = 0;
    47   coords.Npolyterms = 1;
    4841
    4942  if (Random) {
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.astro/cdensify.c

    r36489 r37386  
    9797  // generate the PSF in a local tangent plane
    9898  Coords coords;
    99   coords.crpix1 = coords.crpix2 = 0.0;
    100   coords.crval1 = coords.crval2 = 0.0;
    101   coords.cdelt1 = coords.cdelt2 = 1.0;
    102   coords.pc1_1  = coords.pc2_2  = 1.0;
    103   coords.pc1_2  = coords.pc2_1  = 0.0;
    104   coords.Npolyterms = 0;
    105   strcpy (coords.ctype, "DEC--TAN");
     99  InitCoords (&coords, "DEC--TAN");
    106100
    107101  r = vr[0].elements.Flt;
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.astro/fitplx.c

    r36489 r37386  
    104104  /* project coordinates to a plane centered on the object with units of arcsec */
    105105  Coords coords;
     106  InitCoords (&coords, "DEC--SIN");
    106107  coords.crval1 = Rmean;
    107108  coords.crval2 = Dmean;
    108   coords.crpix1 = 0;
    109   coords.crpix2 = 0;
    110109  coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0;
    111   coords.pc1_1  = coords.pc2_2 = 1.0;
    112   coords.pc1_2  = coords.pc2_1 = 0.0;
    113   coords.Npolyterms = 1;
    114   strcpy (coords.ctype, "DEC--SIN");
    115110
    116111  double *X, *Y, *t, *pX, *pY, *dX, *dY;
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.astro/fitpm.c

    r36489 r37386  
    100100  /* project coordinates to a plane centered on the object with units of arcsec */
    101101  Coords coords;
     102  InitCoords (&coords, "DEC--SIN");
    102103  coords.crval1 = Rmean;
    103104  coords.crval2 = Dmean;
    104   coords.crpix1 = 0;
    105   coords.crpix2 = 0;
    106105  coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0;
    107   coords.pc1_1  = coords.pc2_2 = 1.0;
    108   coords.pc1_2  = coords.pc2_1 = 0.0;
    109   coords.Npolyterms = 1;
    110   strcpy (coords.ctype, "DEC--SIN");
    111106
    112107  double *X, *Y, *t, *dX, *dY;
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.astro/region.c

    r36489 r37386  
    8080  if (!ohana_str_to_radec (&Ra, &Dec, argv[1], argv[2])) return (FALSE);
    8181  Radius = atof (argv[3]);
    82   strcpy (graphmode.coords.ctype, "DEC--TAN");
     82  InitCoords (&graphmode.coords, "DEC--TAN");
     83
    8384  if (argc == 5) {
    8485    if (!strcasecmp (argv[4], "TAN"))
     
    99100      strcpy (graphmode.coords.ctype, "DEC--PAR");
    100101  }
     102 
     103  graphmode.coords.crval1 = Ra;
     104  graphmode.coords.crval2 = Dec;
    101105
    102  
     106  graphmode.coords.pc1_1 = (graphmode.flipeast) ? -1 : 1;
     107  graphmode.coords.pc2_2 = (graphmode.flipnorth) ? -1 : 1;
     108
    103109  /* ask kapa for coordinate limits, to get the right aspect ratio */
    104110  KapaGetLimits (kapa, &dx, &dy);
     
    132138  set_int_variable ("NORTH_UP", !graphmode.flipnorth);
    133139
    134   graphmode.coords.pc1_1 = (graphmode.flipeast) ? -1 : 1;
    135   graphmode.coords.pc2_2 = (graphmode.flipnorth) ? -1 : 1;
    136 
    137   graphmode.coords.pc1_2 = graphmode.coords.pc2_1 = 0.0;
    138   graphmode.coords.crval1 = Ra;
    139   graphmode.coords.crval2 = Dec;
    140   graphmode.coords.crpix1 = 0.0;
    141   graphmode.coords.crpix2 = 0.0;
    142   graphmode.coords.cdelt1 = graphmode.coords.cdelt2 = 1.0;
    143 
    144140  if (!NoClear) KapaClearSections (kapa);
    145141  KapaSetLimits (kapa, &graphmode);
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/find_matches.c

    r36489 r37386  
    3838   * far from the projection pole. We use the center of the region (catalog) for crval1,2.
    3939   */
     40  InitCoords (&tcoords, "DEC--ARC");
    4041  tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax);
    4142  if (region[0].Dmax < 90) {
     
    4445    tcoords.crval2 = 90.0;
    4546  }
    46   tcoords.crpix1 = 0;
    47   tcoords.crpix2 = 0;
    4847  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    49   tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
    50   tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
    51   tcoords.Npolyterms = 1;
    52   strcpy (tcoords.ctype, "DEC--ARC");
    5348
    5449  // this region includes a boundary layer of size RADIUS
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/gimages.c

    r37378 r37386  
    128128      if (fabs(Ro - Ra) > 120.0) continue;
    129129
     130      InitCoords (&local, "DEC--TAN");
    130131      local.crval1 = Ro;
    131132      local.crval2 = Do;
    132       local.crpix1 = local.crpix2 = 0.0;
    133133      local.cdelt1 = local.cdelt2 = 1.0/3600.0;
    134       local.pc1_1 = local.pc2_2 = 1.0;
    135       local.pc2_1 = local.pc1_2 = 0.0;
    136       local.Npolyterms = 1;
    137       strcpy (local.ctype, "DEC--TAN");
    138134
    139135      if (typehash == DistortImage) {
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/objectcoverage.c

    r34088 r37386  
    147147  strcpy (buf[0].file, "(empty)");
    148148
     149  InitCoords (&coords, projection);
    149150  coords.crval1 = RaCenter;
    150151  coords.crval2 = DecCenter;
    151152  coords.crpix1 = 0.5*Nx;
    152153  coords.crpix2 = 0.5*Ny;
    153   strcpy (coords.ctype, projection);
    154   coords.pc1_1 = -1.0;
     154  coords.pc1_1 = -1.0; // sky parity
    155155  coords.pc2_2 = +1.0;
    156   coords.pc1_2 =  0.0;
    157   coords.pc2_1 =  0.0;
    158156  coords.cdelt1 = coords.cdelt2 = pixscale;
    159   coords.Npolyterms = 0;
    160157
    161158  PutCoords (&coords, &buf[0].header);
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/showtile.c

    r36489 r37386  
    2828
    2929  /* reference for coords is this image */
    30   coords.crpix1 = coords.crpix2 = 0.0;
    31   coords.crval1 = coords.crval2 = 0.0;
    32   coords.cdelt1 = coords.cdelt2 = 1.0;
    33   coords.pc1_1  = coords.pc2_2  = 1.0;
    34   coords.pc1_2  = coords.pc2_1  = 0.0;
    35   coords.Npolyterms = 0;
    36   strcpy (coords.ctype, "DEC--TAN");
     30  InitCoords (&coords, "DEC--TAN");
    3731 
    3832  /* fill in top-left region */
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/simage.c

    r36489 r37386  
    4242  }
    4343  /* get astrometry information */
    44   strcpy (coords.ctype, "NONE");
    45   gfits_scan (&header, "CTYPE2",   "%s",  1, coords.ctype);
    46   if (strcmp (coords.ctype, "DEC--PLY")) {
    47     gprint (GP_ERR, "ERROR: wrong astrometric info in header\n");
     44  if (!GetCoords (&coords, &header)) {
     45    gprint (GP_ERR, "ERROR: can't get coord info from header\n");
    4846    return (FALSE);
    4947  }
    50   gfits_scan (&header, "CDELT1",   "%f", 1, &coords.cdelt1);
    51   gfits_scan (&header, "CDELT2",   "%f", 1, &coords.cdelt2);
    52   gfits_scan (&header, "CRVAL1",   "%lf", 1, &coords.crval1);
    53   gfits_scan (&header, "CRVAL2",   "%lf", 1, &coords.crval2); 
    54   gfits_scan (&header, "CRPIX1",   "%f", 1, &coords.crpix1);
    55   gfits_scan (&header, "CRPIX2",   "%f", 1, &coords.crpix2);
    56   gfits_scan (&header, "PC001001", "%f", 1, &coords.pc1_1);
    57   gfits_scan (&header, "PC001002", "%f", 1, &coords.pc1_2);
    58   gfits_scan (&header, "PC002001", "%f", 1, &coords.pc2_1);
    59   gfits_scan (&header, "PC002002", "%f", 1, &coords.pc2_2);
    60   /* RA Terms */
    61   gfits_scan (&header, "PCA1X2Y0", "%f", 1, &coords.polyterms[0][0]);
    62   gfits_scan (&header, "PCA1X1Y1", "%f", 1, &coords.polyterms[1][0]);
    63   gfits_scan (&header, "PCA1X0Y2", "%f", 1, &coords.polyterms[2][0]);
    64   gfits_scan (&header, "PCA1X3Y0", "%f", 1, &coords.polyterms[3][0]);
    65   gfits_scan (&header, "PCA1X2Y1", "%f", 1, &coords.polyterms[4][0]);
    66   gfits_scan (&header, "PCA1X1Y2", "%f", 1, &coords.polyterms[5][0]);
    67   gfits_scan (&header, "PCA1X0Y3", "%f", 1, &coords.polyterms[6][0]);
    68   /* Dec Terms */                           
    69   gfits_scan (&header, "PCA2X2Y0", "%f", 1, &coords.polyterms[0][1]);
    70   gfits_scan (&header, "PCA2X1Y1", "%f", 1, &coords.polyterms[1][1]);
    71   gfits_scan (&header, "PCA2X0Y2", "%f", 1, &coords.polyterms[2][1]);
    72   gfits_scan (&header, "PCA2X3Y0", "%f", 1, &coords.polyterms[3][1]);
    73   gfits_scan (&header, "PCA2X2Y1", "%f", 1, &coords.polyterms[4][1]);
    74   gfits_scan (&header, "PCA2X1Y2", "%f", 1, &coords.polyterms[5][1]);
    75   gfits_scan (&header, "PCA2X0Y3", "%f", 1, &coords.polyterms[6][1]);
    76   coords.Npolyterms = 2; /* how many do we use? */
    7748
    7849  /* find number of stars */
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/skycoverage.c

    r37378 r37386  
    204204  strcpy (buf[0].file, "(empty)");
    205205
     206  InitCoords (&coords, projection);
    206207  coords.crval1 = RaCenter;
    207208  coords.crval2 = DecCenter;
    208209  coords.crpix1 = 0.5*Nx;
    209210  coords.crpix2 = 0.5*Ny;
    210   strcpy (coords.ctype, projection);
    211   coords.pc1_1 = -1.0;
     211  coords.pc1_1 = -1.0; // sky parity
    212212  coords.pc2_2 = +1.0;
    213   coords.pc1_2 =  0.0;
    214   coords.pc2_1 =  0.0;
    215213  coords.cdelt1 = coords.cdelt2 = pixscale;
    216   coords.Npolyterms = 0;
    217214
    218215  PutCoords (&coords, &buf[0].header);
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/include/astro.h

    r31635 r37386  
    1212void FreeAstro (void);
    1313
    14 typedef struct {
    15   int    isIdentity;          // identity transformation
    16   double phi;                 // saved in radians
    17   double Xo;                  // saved in radians
    18   double xo;                  // saved in degrees
    19   double sin_phi_cos_Xo;      // pre-computed values
    20   double sin_phi_sin_Xo;      // pre-computed values
    21   double cos_phi_cos_Xo;      // pre-computed values
    22   double cos_phi_sin_Xo;      // pre-computed values
    23   double cos_phi;             // pre-computed values
    24   double sin_phi;             // pre-computed values
    25   double cos_Xo;              // pre-computed values
    26   double sin_Xo;              // pre-computed values
    27 } CoordTransform;
    28 
    29 #ifndef MOVED_TO_LIBDVO
    30 typedef enum {COORD_NONE, COORD_CELESTIAL, COORD_GALACTIC, COORD_ECLIPTIC} CoordTransformSystem;
    31 #endif
    32 
    33 CoordTransform *InitTransform (CoordTransformSystem input, CoordTransformSystem output);
    34 int ApplyTransform (double *x, double *y, double X, double Y, CoordTransform *transform);
    35 
    3614# endif
  • branches/eam_branches/ipp-20140904/Ohana/src/photdbc/src/find_images.c

    r36481 r37386  
    1919
    2020  /* we make positional comparisons in the projection of catalog */
     21  InitCoords (&tcoords, "DEC--TAN");
    2122  tcoords.crval1 = 0.5*(region[0].RA[0]  + region[0].RA[1]);
    2223  tcoords.crval2 = 0.5*(region[0].DEC[0] + region[0].DEC[1]);
    23   tcoords.crpix1 = tcoords.crpix2 = 0.0;
    2424  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    25   tcoords.pc1_1  = tcoords.pc2_2 = 1.0;
    26   tcoords.pc1_2  = tcoords.pc2_1 = 0.0;
    27   strcpy (tcoords.ctype, "DEC--TAN");
    2825
    2926  timage = gfits_table_get_Image (&db[0].ftable, &Ntimage, &db[0].swapped);
  • branches/eam_branches/ipp-20140904/Ohana/src/photdbc/src/join_stars.c

    r37045 r37386  
    5050
    5151  /* coordinate system for projection */
     52  InitCoords (&tcoords, "DEC--TAN");
    5253  tcoords.crval1 = Rmid;
    5354  tcoords.crval2 = Dmid;
    54   tcoords.crpix1 = tcoords.crpix2 = 0.0;
    5555  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    56   tcoords.pc1_1  = tcoords.pc2_2 = 1.0;
    57   tcoords.pc1_2  = tcoords.pc2_1 = 0.0;
    58   tcoords.Npolyterms = 0;
    59   strcpy (tcoords.ctype, "DEC--TAN");
    6056 
    6157  /* project & sort coordinates in local linear frame */
  • branches/eam_branches/ipp-20140904/Ohana/src/photdbc/src/select_images.c

    r37378 r37386  
    3434
    3535  // the comparison is made in the catalog local projection. below we set crval1,2
    36   tcoords.crpix1 = tcoords.crpix2 = 0.0;
     36  InitCoords (&tcoords, "DEC--TAN");
    3737  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    38   tcoords.pc1_1  = tcoords.pc2_2 = 1.0;
    39   tcoords.pc1_2  = tcoords.pc2_1 = 0.0;
    40   strcpy (tcoords.ctype, "DEC--TAN");
    4138
    4239  ALLOCATE (skycoords, SkyRegionCoords, skylist[0].Nregions);
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/UpdateObjects.c

    r37261 r37386  
    6969
    7070  /* project coordinates to a plane centered on the object with units of arcsec */
    71   coords.crval1 = 0;
    72   coords.crval2 = 0;
    73   coords.crpix1 = 0;
    74   coords.crpix2 = 0;
     71  InitCoords (&coords, "DEC--SIN");
    7572  coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0;
    76   coords.pc1_1  = coords.pc2_2 = 1.0;
    77   coords.pc1_2  = coords.pc2_1 = 0.0;
    78   coords.Npolyterms = 1;
    79   strcpy (coords.ctype, "DEC--SIN");
    8073
    8174  // use J2000 as a reference time
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/bcatalog.c

    r36833 r37386  
    2727
    2828  /* for outlier rejection, project coordinates to a plane centered on the object with units of arcsec */
    29   coords.crval1 = 0;
    30   coords.crval2 = 0;
    31   coords.crpix1 = 0;
    32   coords.crpix2 = 0;
     29  InitCoords (&coords, "DEC--SIN");
    3330  coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0;
    34   coords.pc1_1  = coords.pc2_2 = 1.0;
    35   coords.pc1_2  = coords.pc2_1 = 0.0;
    36   coords.Npolyterms = 1;
    37   strcpy (coords.ctype, "DEC--SIN");
    3831
    3932  // XXX in the future, use catalog[0].Nsecfilt only?  allow catalogs to have variable Nsecfilt?
     
    269262  /* project coordinates to a plane centered on the object with units of arcsec */
    270263  Coords coords;
     264  InitCoords (&coords, "DEC--SIN");
    271265  coords.crval1 = Rc;
    272266  coords.crval2 = Dc;
    273   coords.crpix1 = 0;
    274   coords.crpix2 = 0;
    275267  coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0;
    276   coords.pc1_1  = coords.pc2_2 = 1.0;
    277   coords.pc1_2  = coords.pc2_1 = 0.0;
    278   coords.Npolyterms = 1;
    279   strcpy (coords.ctype, "DEC--SIN");
    280268
    281269  // convert all average R,D values to X,Y:
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/high_speed_objects.c

    r37038 r37386  
    149149
    150150  // define a local projection
     151  InitCoords (&tcoords, "DEC--ARC");
    151152  tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax);
    152153  if (region[0].Dmax < 90) {
     
    155156    tcoords.crval2 = 90.0;
    156157  }
    157   tcoords.crpix1 = 0;
    158   tcoords.crpix2 = 0;
    159158  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    160   tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
    161   tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
    162   tcoords.Npolyterms = 1;
    163   strcpy (tcoords.ctype, "DEC--ARC");
    164159
    165160  /* build spatial index (RA sort) referencing input array sequence */
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/hpm_objects.c

    r37038 r37386  
    126126
    127127  // define a local projection
     128  InitCoords (&tcoords, "DEC--ARC");
    128129  tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax);
    129130  if (region[0].Dmax < 90) {
     
    132133    tcoords.crval2 = 90.0;
    133134  }
    134   tcoords.crpix1 = 0;
    135   tcoords.crpix2 = 0;
    136135  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    137   tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
    138   tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
    139   tcoords.Npolyterms = 1;
    140136  strcpy (tcoords.ctype, "DEC--ARC");
    141137
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/select_images.c

    r37378 r37386  
    2323  int InRange, found;
    2424  double Ri[5], Di[5], Xi[5], Yi[5], dx, dy;
    25   Coords tcoords;
    2625  SkyRegionCoords *skycoords;
    2726 
     
    4645
    4746  // the comparison is made in the catalog local projection. below we set crval1,2
    48   tcoords.crpix1 = tcoords.crpix2 = 0.0;
     47  Coords tcoords;
     48  InitCoords (&tcoords, "DEC--TAN");
    4949  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    50   tcoords.pc1_1  = tcoords.pc2_2 = 1.0;
    51   tcoords.pc1_2  = tcoords.pc2_1 = 0.0;
    52   strcpy (tcoords.ctype, "DEC--TAN");
    5350
    5451  ALLOCATE (skycoords, SkyRegionCoords, skylist[0].Nregions);
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/testparallax.c

    r36482 r37386  
    4949
    5050  /* project coordinates to a plane centered on the object with units of arcsec */
    51   coords.crval1 = 0;
    52   coords.crval2 = 0;
    53   coords.crpix1 = 0;
    54   coords.crpix2 = 0;
     51  InitCoords (&coords, "DEC--SIN");
    5552  coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0;
    56   coords.pc1_1  = coords.pc2_2 = 1.0;
    57   coords.pc1_2  = coords.pc2_1 = 0.0;
    58   coords.Npolyterms = 1;
    59   strcpy (coords.ctype, "DEC--SIN");
    6053
    6154  // use one point as a local reference
  • branches/eam_branches/ipp-20140904/Ohana/src/relphot/src/MosaicOps.c

    r37378 r37386  
    582582    }
    583583
    584     strcpy (mosaic[i].coords.ctype, "DEC--TAN");
     584    InitCoords (&mosaic[i].coords, "DEC--TAN");
    585585    mosaic[i].coords.crval1 = Rmid;
    586586    mosaic[i].coords.crval2 = Dmid;
    587     mosaic[i].coords.crpix1 = 0.0;
    588     mosaic[i].coords.crpix2 = 0.0;
    589587    mosaic[i].coords.cdelt1 = 1.0 / 3600.0;
    590588    mosaic[i].coords.cdelt2 = 1.0 / 3600.0;
    591     mosaic[i].coords.pc1_1  = 1.0;
    592     mosaic[i].coords.pc2_2  = 1.0;
    593     mosaic[i].coords.pc1_2  = 0.0;
    594     mosaic[i].coords.pc2_1  = 0.0;
    595589
    596590    mosaic[i].Mcal   = 0.0;
     
    663657    }
    664658    dS /= MosaicN_Image[i];
    665     strcpy (mosaic[i].coords.ctype, "DEC--TAN");
     659
     660    InitCoords (&mosaic[i].coords, "DEC--TAN");
    666661    mosaic[i].coords.crval1 = Rmin;
    667662    mosaic[i].coords.crval2 = Dmin;
    668     mosaic[i].coords.crpix1 = 0.0;
    669     mosaic[i].coords.crpix2 = 0.0;
    670663    mosaic[i].coords.cdelt1 = dS;
    671664    mosaic[i].coords.cdelt2 = dS;
    672     mosaic[i].coords.pc1_1  = 1.0;
    673     mosaic[i].coords.pc2_2  = 1.0;
    674     mosaic[i].coords.pc1_2  = 0.0;
    675     mosaic[i].coords.pc2_1  = 0.0;
     665
    676666    RD_to_XY (&dX, &dY, Rmax, Dmax, &mosaic[i].coords);
    677667
  • branches/eam_branches/ipp-20140904/Ohana/src/relphot/src/select_images.c

    r37378 r37386  
    3636
    3737  // the comparison is made in the catalog local projection. below we set crval1,2
    38   tcoords.crpix1 = tcoords.crpix2 = 0.0;
     38  InitCoords (&tcoords, "DEC--TAN");
    3939  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    40   tcoords.pc1_1  = tcoords.pc2_2 = 1.0;
    41   tcoords.pc1_2  = tcoords.pc2_1 = 0.0;
    42   strcpy (tcoords.ctype, "DEC--TAN");
    4340
    4441  double RminSkyRegion = region[0].Rmin;
     
    397394
    398395  // the comparison is made in the catalog local projection. below we set crval1,2
    399   tcoords.crpix1 = tcoords.crpix2 = 0.0;
     396  InitCoords (&tcoords, "DEC--TAN");
    400397  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    401   tcoords.pc1_1  = tcoords.pc2_2 = 1.0;
    402   tcoords.pc1_2  = tcoords.pc2_1 = 0.0;
    403 
    404   tcoords.Npolyterms = 0;
    405   memset (tcoords.polyterms, 0, 14*sizeof(float));
    406   strcpy (tcoords.ctype, "DEC--TAN");
    407398
    408399  /* compare with each region file */
  • branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/find_image_sgroups.c

    r37378 r37386  
    1818  }
    1919
    20   coords.crpix1 = coords.crpix2 = 0.0;
    21   coords.cdelt1 = coords.cdelt2 = 1.0; /* scale is degrees, radius in degrees */
    22   coords.pc1_1 = coords.pc2_2 = 1.0;
    23   coords.pc1_2 = coords.pc2_1 = 0.0;
    24   strcpy (coords.ctype, "DEC--TAN");
     20  InitCoords (&coords, "DEC--TAN");
    2521 
    2622  Ngroup = 0;
  • branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/update_dvo_uniphot.c

    r36481 r37386  
    5757  glob (line, 0, NULL, &pglob);
    5858
    59   coords.crpix1 = coords.crpix2 = 0.0;
    60   coords.cdelt1 = coords.cdelt2 = 1.0; /* scale is degrees, radius in degrees */
    61   coords.pc1_1 = coords.pc2_2 = 1.0;
    62   coords.pc1_2 = coords.pc2_1 = 0.0;
    63   strcpy (coords.ctype, "DEC--TAN");
     59  InitCoords (&coords, "DEC--TAN");
    6460 
    6561  for (i = 0; i < pglob.gl_pathc; i++) {
Note: See TracChangeset for help on using the changeset viewer.