IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 26, 2006, 10:46:32 AM (21 years ago)
Author:
eugene
Message:

adding proper motion and parallax to addstar, dropping _PS from RA and DEC in average

Location:
trunk/Ohana/src/addstar
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/include/addstar.h

    r6675 r6683  
    6969double  SNLIMIT;
    7070int     ACCEPT_ASTROM;  // accept even bad astrometry solutions (NASTRO == 0)
     71int     ACCEPT_MOTION;  // accept reference proper motion measurements
    7172int     TEXTMODE;       // force input file to be loaded as RAW
    7273int     SUBPIX;         // apply a subpix correction
    … …  
    125126double     get_subpix             PROTO((double x, double y));
    126127Stars     *getgsc                 PROTO((SkyRegion *patch, int *NSTARS));
    127 Stars     *gettycho               PROTO((SkyRegion *catstats, int photcode, double epoch, int *Nstars));
     128Stars     *gettycho               PROTO((SkyRegion *catstats, int photcode, int *Nstars));
    128129Stars     *getusno                PROTO((SkyRegion *catstats, int photcode, int *Nstars));
    129 Stars     *getusnob               PROTO((SkyRegion *catstats, int photcode, double epoch, int *Nstars));
     130Stars     *getusnob               PROTO((SkyRegion *catstats, int photcode, int *Nstars));
    130131Image     *gimages                PROTO((FITS_DB *db, Image *image, Coords *mosaic, int *Npimage));
    131132Stars     *grefcat                PROTO((char *Refcat, SkyRegion *catstats, int photcode, int *nstars));
    … …  
    188189
    189190/**
    190   there is an inconsistency to be resolved: fixed structures (like Image)
    191   need a fixed bit-length time (e_time), but these functions all use the
    192   UNIX time_t types, which may be 32 or 64 bits, depending on the machine.
    193   This can be resolved by using time_t with these functions, but casting
    194   between e_time and time_t when necessary (ie, cannot return data to an
    195   e_time pointer from one of these functions)
     191    there is an inconsistency to be resolved: fixed structures (like Image)
     192    need a fixed bit-length time (e_time), but these functions all use the
     193    UNIX time_t types, which may be 32 or 64 bits, depending on the machine.
     194    This can be resolved by using time_t with these functions, but casting
     195    between e_time and time_t when necessary (ie, cannot return data to an
     196    e_time pointer from one of these functions)
    196197**/
    197198
  • trunk/Ohana/src/addstar/src/addstar.c

    r6236 r6683  
    4242
    4343  switch (options.mode) {
    44   case M_IMAGE:
    45     stars = gstars (argv[1], &Nstars, options.photcode, &image);
    46     if ((DUMP != NULL) && !strcmp (DUMP, "rawstars")) dump_rawstars (stars, Nstars);
    47     RegisterMosaic (MOSAIC);
    48     skylist = SkyListByImage (sky, -1, &image);
    49     overlap = gimages (&db, &image, MOSAIC, &Noverlap);
    50     break;
    51   case M_REFLIST:
    52     stars = grefstars (argv[1], options.photcode, &Nstars);
    53     skylist = SkyListForStars (sky, -1, stars, Nstars);
    54     break;
    55   case M_REFCAT:
    56     skylist = SkyListByPatch (sky, -1, &UserPatch);
    57     break;
     44    case M_IMAGE:
     45      stars = gstars (argv[1], &Nstars, options.photcode, &image);
     46      if ((DUMP != NULL) && !strcmp (DUMP, "rawstars")) dump_rawstars (stars, Nstars);
     47      RegisterMosaic (MOSAIC);
     48      skylist = SkyListByImage (sky, -1, &image);
     49      overlap = gimages (&db, &image, MOSAIC, &Noverlap);
     50      break;
     51    case M_REFLIST:
     52      stars = grefstars (argv[1], options.photcode, &Nstars);
     53      skylist = SkyListForStars (sky, -1, stars, Nstars);
     54      break;
     55    case M_REFCAT:
     56      skylist = SkyListByPatch (sky, -1, &UserPatch);
     57      break;
    5858  }
    5959  if (options.only_match || options.existing_regions) {
    … …  
    9797
    9898    switch (options.mode) {
    99     case M_IMAGE:
    100       Nsubset = Nstars;
    101       if (options.closest) {
    102         find_matches_closest (skylist[0].regions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, MOSAIC, options);
    103       } else {
    104         find_matches (skylist[0].regions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, MOSAIC, options);
    105       }
    106       break;
    107     case M_REFCAT:
    108       stars = grefcat (argv[1], skylist[0].regions[i], options.photcode, &Nstars);
    109     case M_REFLIST:
    110       subset = find_subset (skylist[0].regions[i], stars, Nstars, &Nsubset);
    111       find_matches_refstars (skylist[0].regions[i], subset, Nsubset, &catalog, options);
    112       if (Nsubset) free (subset);
    113       break;
     99      case M_IMAGE:
     100        Nsubset = Nstars;
     101        if (options.closest) {
     102          find_matches_closest (skylist[0].regions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, MOSAIC, options);
     103        } else {
     104          find_matches (skylist[0].regions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, MOSAIC, options);
     105        }
     106        break;
     107      case M_REFCAT:
     108        stars = grefcat (argv[1], skylist[0].regions[i], options.photcode, &Nstars);
     109      case M_REFLIST:
     110        subset = find_subset (skylist[0].regions[i], stars, Nstars, &Nsubset);
     111        find_matches_refstars (skylist[0].regions[i], subset, Nsubset, &catalog, options);
     112        if (Nsubset) free (subset);
     113        break;
    114114    }
    115115
  • trunk/Ohana/src/addstar/src/args.c

    r5585 r6683  
    190190  if ((N = get_argument (argc, argv, "-accept"))) {
    191191    ACCEPT_ASTROM = TRUE;
     192    remove_argument (N, &argc, argv);
     193  }
     194  if ((N = get_argument (argc, argv, "-accept-astrom"))) {
     195    ACCEPT_ASTROM = TRUE;
     196    remove_argument (N, &argc, argv);
     197  }
     198  /* accept proper-motion data from reference */
     199  ACCEPT_MOTION = FALSE;
     200  if ((N = get_argument (argc, argv, "-accept-motion"))) {
     201    ACCEPT_MOTION = TRUE;
    192202    remove_argument (N, &argc, argv);
    193203  }
    … …  
    258268  fprintf (stderr, "  -skyprobe                   : specify skyprobe mode\n");
    259269  fprintf (stderr, "  -accept                     : accept bad astrometry from header\n");
     270  fprintf (stderr, "  -accept-astrom              : accept bad astrometry from header\n");
     271  fprintf (stderr, "  -accept-motion              : accept proper-motion data from reference\n");
    260272  fprintf (stderr, "  -force                      : force read of database with inconsistent info\n");
    261273  fprintf (stderr, "  -v                          : verbose mode\n");
  • trunk/Ohana/src/addstar/src/find_matches.c

    r5443 r6683  
    7171  /* build spatial index (RA sort) */
    7272  for (i = 0; i < Nave; i++) {
    73     fRD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R_PS, catalog[0].average[i].D_PS, &tcoords);
     73    fRD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R, catalog[0].average[i].D, &tcoords);
    7474    N2[i] = i;
    7575    catalog[0].found[N2[i]] = -1;
    … …  
    138138      /** add measurements for this star **/
    139139      /** dR,dD now represent arcsec **/
    140       catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R_PS - stars[N].R);
    141       catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D_PS - stars[N].D);
     140      catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R - stars[N].R);
     141      catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D - stars[N].D);
    142142      catalog[0].measure[Nmeas].M_PS        = MIN (stars[N].M + MTIME, NO_MAG);
    143143      catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N].dM, NO_ERR);  /* error in input files stored in thousandths of mag */
    … …  
    159159      /* check for entries in the secfilt lists */
    160160      Mcat = PhotCat (&catalog[0].measure[Nmeas]);
    161       Mval = (Nsec == -1) ? &catalog[0].average[n].M_PS : &catalog[0].secfilt[n*Nsecfilt+Nsec].M_PS;
     161      Mval = (Nsec == -1) ? &catalog[0].average[n].M : &catalog[0].secfilt[n*Nsecfilt+Nsec].M_PS;
    162162      if (*Mval == NO_MAG) *Mval = Mcat;
    163163      /* in UPDATE mode, this value is not saved; use relphot to recalculate */
    … …  
    213213
    214214      /* should the catalog star be on this image? project into image coords */
    215       if (!in_image (catalog[0].average[n].R_PS, catalog[0].average[n].D_PS, image)) continue;
     215      if (!in_image (catalog[0].average[n].R, catalog[0].average[n].D, image)) continue;
    216216      add_miss_link (&catalog[0].average[n], next_miss, Nmiss);
    217217
    218218      /* calculate time of exposure for this coordinate in the image */
    219       RD_to_XY (&X, &Y, catalog[0].average[n].R_PS, catalog[0].average[n].D_PS, &image[0].coords);       
     219      RD_to_XY (&X, &Y, catalog[0].average[n].R, catalog[0].average[n].D, &image[0].coords);     
    220220      catalog[0].missing[Nmiss].t  = image[0].tzero + 1e-4*Y*image[0].trate;  /* trate is in 0.1 msec / row */
    221221      catalog[0].average[n].Nn ++;
    … …  
    245245    secz = airmass (image[0].secz_PS, stars[N].R, stars[N].D, image[0].sidtime, image[0].latitude);
    246246
    247     catalog[0].average[Nave].R_PS      = stars[N].R;
    248     catalog[0].average[Nave].D_PS      = stars[N].D;
    249     catalog[0].average[Nave].M_PS      = NO_MAG;
    250     catalog[0].average[Nave].dM_PS     = NO_MAG;
     247    catalog[0].average[Nave].R         = stars[N].R;
     248    catalog[0].average[Nave].D         = stars[N].D;
     249    catalog[0].average[Nave].M         = NO_MAG;
     250    catalog[0].average[Nave].dM        = NO_MAG;
    251251    catalog[0].average[Nave].Nm        = 1;
    252252    catalog[0].average[Nave].Nn        = 0;
    … …  
    257257    catalog[0].average[Nave].missing   = -1;
    258258    catalog[0].average[Nave].code      = 0;
     259
     260    catalog[0].average[Nave].dR        = 0;
     261    catalog[0].average[Nave].dD        = 0;
     262    catalog[0].average[Nave].uR        = 0;
     263    catalog[0].average[Nave].uD        = 0;
     264    catalog[0].average[Nave].duR       = 0;
     265    catalog[0].average[Nave].duD       = 0;
     266    catalog[0].average[Nave].P         = 0;
     267    catalog[0].average[Nave].dP        = 0;
    259268
    260269    for (j = 0; j < Nsecfilt; j++) {
    … …  
    283292
    284293    Mcat = PhotCat (&catalog[0].measure[Nmeas]);
    285     Mval = (Nsec == -1) ? &catalog[0].average[Nave].M_PS : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M_PS;
     294    Mval = (Nsec == -1) ? &catalog[0].average[Nave].M : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M_PS;
    286295    if (*Mval == NO_MAG) *Mval = Mcat;
    287296
    … …  
    295304      }
    296305      if (!FindMosaicForImage (overlap, Noverlap, j)) continue;
    297       if (!in_image (catalog[0].average[Nave].R_PS, catalog[0].average[Nave].D_PS, &overlap[j])) continue;
     306      if (!in_image (catalog[0].average[Nave].R, catalog[0].average[Nave].D, &overlap[j])) continue;
    298307      add_miss_link (&catalog[0].average[Nave], next_miss, Nmiss);
    299308
    300309      /* get time of exposure of this portion of the image */
    301       RD_to_XY (&X, &Y, catalog[0].average[Nave].R_PS, catalog[0].average[Nave].D_PS, &overlap[j].coords);       
     310      RD_to_XY (&X, &Y, catalog[0].average[Nave].R, catalog[0].average[Nave].D, &overlap[j].coords);     
    302311      catalog[0].missing[Nmiss].t  = overlap[j].tzero + 1e-4*Y*overlap[j].trate;  /* rough guess at time */
    303312      catalog[0].average[Nave].Nn ++;
  • trunk/Ohana/src/addstar/src/find_matches_closest.c

    r5443 r6683  
    7171  /* build spatial index (RA sort) */
    7272  for (i = 0; i < Nave; i++) {
    73     fRD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R_PS, catalog[0].average[i].D_PS, &tcoords);
     73    fRD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R, catalog[0].average[i].D, &tcoords);
    7474    N2[i] = i;
    7575    catalog[0].found[N2[i]] = -1;
    … …  
    154154    /** add measurements for this star **/
    155155    /** dR,dD now represent arcsec **/
    156     catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R_PS - stars[N].R);
    157     catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D_PS - stars[N].D);
     156    catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R - stars[N].R);
     157    catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D - stars[N].D);
    158158    catalog[0].measure[Nmeas].M_PS        = MIN (stars[N].M + MTIME, NO_MAG);
    159159    catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N].dM, NO_ERR);  /* error in input files stored in thousandths of mag */
    … …  
    175175    /* check for entries in the secfilt lists */
    176176    Mcat = PhotCat (&catalog[0].measure[Nmeas]);
    177     Mval = (Nsec == -1) ? &catalog[0].average[n].M_PS : &catalog[0].secfilt[n*Nsecfilt+Nsec].M_PS;
     177    Mval = (Nsec == -1) ? &catalog[0].average[n].M : &catalog[0].secfilt[n*Nsecfilt+Nsec].M_PS;
    178178    if (*Mval == NO_MAG) *Mval = Mcat;
    179179    /* in UPDATE mode, this value is not saved; use relphot to recalculate */
    … …  
    211211
    212212      /* should the catalog star be on this image? project into image coords */
    213       if (!in_image (catalog[0].average[n].R_PS, catalog[0].average[n].D_PS, image)) continue;
     213      if (!in_image (catalog[0].average[n].R, catalog[0].average[n].D, image)) continue;
    214214      add_miss_link (&catalog[0].average[n], next_miss, Nmiss);
    215215
    216216      /* calculate time of exposure for this coordinate in the image */
    217       RD_to_XY (&X, &Y, catalog[0].average[n].R_PS, catalog[0].average[n].D_PS, &image[0].coords);       
     217      RD_to_XY (&X, &Y, catalog[0].average[n].R, catalog[0].average[n].D, &image[0].coords);     
    218218      catalog[0].missing[Nmiss].t  = image[0].tzero + 1e-4*Y*image[0].trate;  /* trate is in 0.1 msec / row */
    219219      catalog[0].average[n].Nn ++;
    … …  
    243243    secz = airmass (image[0].secz_PS, stars[N].R, stars[N].D, image[0].sidtime, image[0].latitude);
    244244
    245     catalog[0].average[Nave].R_PS      = stars[N].R;
    246     catalog[0].average[Nave].D_PS      = stars[N].D;
    247     catalog[0].average[Nave].M_PS      = NO_MAG;
    248     catalog[0].average[Nave].dM_PS     = NO_MAG;
     245    catalog[0].average[Nave].R         = stars[N].R;
     246    catalog[0].average[Nave].D         = stars[N].D;
     247    catalog[0].average[Nave].M         = NO_MAG;
     248    catalog[0].average[Nave].dM        = NO_MAG;
    249249    catalog[0].average[Nave].Nm        = 1;
    250250    catalog[0].average[Nave].Nn        = 0;
    … …  
    255255    catalog[0].average[Nave].missing   = -1;
    256256    catalog[0].average[Nave].code      = 0;
     257
     258    catalog[0].average[Nave].dR        = 0;
     259    catalog[0].average[Nave].dD        = 0;
     260    catalog[0].average[Nave].uR        = 0;
     261    catalog[0].average[Nave].uD        = 0;
     262    catalog[0].average[Nave].duR       = 0;
     263    catalog[0].average[Nave].duD       = 0;
     264    catalog[0].average[Nave].P         = 0;
     265    catalog[0].average[Nave].dP        = 0;
    257266
    258267    for (j = 0; j < Nsecfilt; j++) {
    … …  
    281290
    282291    Mcat = PhotCat (&catalog[0].measure[Nmeas]);
    283     Mval = (Nsec == -1) ? &catalog[0].average[Nave].M_PS : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M_PS;
     292    Mval = (Nsec == -1) ? &catalog[0].average[Nave].M : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M_PS;
    284293    if (*Mval == NO_MAG) *Mval = Mcat;
    285294
    … …  
    293302      }
    294303      if (!FindMosaicForImage (overlap, Noverlap, j)) continue;
    295       if (!in_image (catalog[0].average[Nave].R_PS, catalog[0].average[Nave].D_PS, &overlap[j])) continue;
     304      if (!in_image (catalog[0].average[Nave].R, catalog[0].average[Nave].D, &overlap[j])) continue;
    296305      add_miss_link (&catalog[0].average[Nave], next_miss, Nmiss);
    297306
    298307      /* get time of exposure of this portion of the image */
    299       RD_to_XY (&X, &Y, catalog[0].average[Nave].R_PS, catalog[0].average[Nave].D_PS, &overlap[j].coords);       
     308      RD_to_XY (&X, &Y, catalog[0].average[Nave].R, catalog[0].average[Nave].D, &overlap[j].coords);     
    300309      catalog[0].missing[Nmiss].t  = overlap[j].tzero + 1e-4*Y*overlap[j].trate;  /* rough guess at time */
    301310      catalog[0].average[Nave].Nn ++;
  • trunk/Ohana/src/addstar/src/find_matches_refstars.c

    r5443 r6683  
    6262 
    6363  for (i = 0; i < Nave; i++) {
    64     fRD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R_PS, catalog[0].average[i].D_PS, &tcoords);
     64    fRD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R, catalog[0].average[i].D, &tcoords);
    6565    N2[i] = i;
    6666    catalog[0].found[N2[i]] = -1;
    … …  
    128128      /** add measurements for this star **/
    129129      /** *** dR,dD now in arcsec *** **/
    130       catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R_PS - stars[N][0].R);
    131       catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D_PS - stars[N][0].D);
     130      catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R - stars[N][0].R);
     131      catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D - stars[N][0].D);
    132132      catalog[0].measure[Nmeas].M_PS        = MIN (stars[N][0].M,  NO_MAG);
    133133      catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N][0].dM, NO_ERR);
    134134      catalog[0].measure[Nmeas].Mcal_PS     = 0;
    135       catalog[0].measure[Nmeas].t        = (TIMEREF == 0) ? stars[N][0].t : TIMEREF; /** careful : time_t vs e_time **/
    136       catalog[0].measure[Nmeas].averef   = n;
    137       catalog[0].measure[Nmeas].source   = stars[N][0].code;
    138       catalog[0].measure[Nmeas].dophot   = 0;
    139       catalog[0].measure[Nmeas].flags    = 0;
    140       catalog[0].measure[Nmeas].dt_PS    = 0xffff;
     135      catalog[0].measure[Nmeas].t           = (TIMEREF == 0) ? stars[N][0].t : TIMEREF; /** careful : time_t vs e_time **/
     136      catalog[0].measure[Nmeas].averef      = n;
     137      catalog[0].measure[Nmeas].source      = stars[N][0].code;
     138      catalog[0].measure[Nmeas].dophot      = 0;
     139      catalog[0].measure[Nmeas].flags       = 0;
     140      catalog[0].measure[Nmeas].dt_PS       = 0xffff;
    141141
    142142      catalog[0].measure[Nmeas].Mgal_PS     = NO_MAG;
    … …  
    146146      catalog[0].measure[Nmeas].theta       = NO_ERR;
    147147       
     148      if (ACCEPT_MOTION) {
     149        catalog[0].average[n].uR          = stars[N][0].uR;
     150        catalog[0].average[n].uD          = stars[N][0].uD;
     151        catalog[0].average[n].duR         = stars[N][0].duR;
     152        catalog[0].average[n].duD         = stars[N][0].duD;
     153        catalog[0].average[n].P           = stars[N][0].P;
     154        catalog[0].average[n].dP          = stars[N][0].dP;
     155      }
     156
    148157      /** don't update average / secfilt values for REF photcodes **/
    149158
    … …  
    193202    if (stars[N][0].found >= 0) continue;
    194203
    195     catalog[0].average[Nave].R_PS         = stars[N][0].R;
    196     catalog[0].average[Nave].D_PS         = stars[N][0].D;
    197     catalog[0].average[Nave].M_PS         = NO_MAG;
    198     catalog[0].average[Nave].dM_PS        = NO_MAG;
     204    catalog[0].average[Nave].R         = stars[N][0].R;
     205    catalog[0].average[Nave].D         = stars[N][0].D;
     206
     207    if (ACCEPT_MOTION) {
     208      catalog[0].average[Nave].dR    = stars[N][0].dR;
     209      catalog[0].average[Nave].dD    = stars[N][0].dD;
     210      catalog[0].average[Nave].uR    = stars[N][0].uR;
     211      catalog[0].average[Nave].uD    = stars[N][0].uD;
     212      catalog[0].average[Nave].duR   = stars[N][0].duR;
     213      catalog[0].average[Nave].duD   = stars[N][0].duD;
     214      catalog[0].average[Nave].P     = stars[N][0].P;
     215      catalog[0].average[Nave].dP    = stars[N][0].dP;
     216    } else {
     217      catalog[0].average[Nave].dR    = 0;
     218      catalog[0].average[Nave].dD    = 0;
     219      catalog[0].average[Nave].uR    = 0;
     220      catalog[0].average[Nave].uD    = 0;
     221      catalog[0].average[Nave].duR   = 0;
     222      catalog[0].average[Nave].duD   = 0;
     223      catalog[0].average[Nave].P     = 0;
     224      catalog[0].average[Nave].dP    = 0;
     225    }
     226
     227    catalog[0].average[Nave].M         = NO_MAG;
     228    catalog[0].average[Nave].dM        = NO_MAG;
    199229    catalog[0].average[Nave].Nm        = 1;
    200230    catalog[0].average[Nave].Nn        = 0;
    … …  
    217247    catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N][0].dM, NO_ERR);
    218248    catalog[0].measure[Nmeas].Mcal_PS     = 0;
    219     catalog[0].measure[Nmeas].t        = (stars[N][0].t == 0) ? TIMEREF : stars[N][0].t; /** careful : time_t vs e_time **/
    220     catalog[0].measure[Nmeas].averef   = Nave;
    221     catalog[0].measure[Nmeas].source   = stars[N][0].code;
    222     catalog[0].measure[Nmeas].dophot   = 0;
    223     catalog[0].measure[Nmeas].flags    = 0;
     249    catalog[0].measure[Nmeas].t           = (stars[N][0].t == 0) ? TIMEREF : stars[N][0].t; /** careful : time_t vs e_time **/
     250    catalog[0].measure[Nmeas].averef      = Nave;
     251    catalog[0].measure[Nmeas].source      = stars[N][0].code;
     252    catalog[0].measure[Nmeas].dophot      = 0;
     253    catalog[0].measure[Nmeas].flags       = 0;
    224254    catalog[0].measure[Nmeas].dt_PS       = 0xffff;
    225255
  • trunk/Ohana/src/addstar/src/gettycho.c

    r6675 r6683  
    66static SkyTable *tychoTable = NULL;
    77
    8 Stars *gettycho (SkyRegion *catstats, int photcode, double epoch, int *nstars) {
     8Stars *gettycho (SkyRegion *catstats, int photcode, int *nstars) {
    99
    1010  int i, j, nitems;
    … …  
    1414  int NTYCHO, Ntycho;
    1515  int firstRow, firstByte;
    16   Stars *stars;
    1716  short int TYCHO_B, TYCHO_V;
     17  e_time TychoEpoch;
    1818  SkyRegion *region;
    1919  SkyList  *skylist;
     20  Stars *stars;
    2021
    2122  /* require photcode */
    … …  
    4748
    4849  ALLOCATE (buffer, char, NITEM*NBYTE);
     50
     51  TychoEpoch = date_to_sec ("1991/04/02,07:30:00");
    4952
    5053  for (i = 0; i < skylist[0].Nregions; i++) {
    … …  
    8083        if (stars[Ntycho].D > UserPatch.Dmax) continue;
    8184
    82         stars[Ntycho].t     = 0;
     85        stars[Ntycho].dR  = 1000 * atof (&line[57]);
     86        stars[Ntycho].dD  = 1000 * atof (&line[64]);
     87
     88        /* XXX : we need to apply uR,uD to R,D to advance to 2000.0 */
     89        stars[Ntycho].uR  = atof (&line[41]);
     90        stars[Ntycho].uD  = atof (&line[49]);
     91
     92        stars[Ntycho].duR = atof (&line[69]);
     93        stars[Ntycho].duD = atof (&line[75]);
     94       
     95        stars[Ntycho].P   = 0;
     96        stars[Ntycho].dP  = 0;
     97
     98        /* Tycho uses J2000 equinox and 1991.25 epoch for coordinates */
     99        /* the magnitudes have no temporal information */
     100        stars[Ntycho].t   = TychoEpoch;
    83101        stars[Ntycho].found = -1;
    84102     
  • trunk/Ohana/src/addstar/src/getusnob.c

    r6675 r6683  
    44# define NELEM  20
    55
    6 Stars *getusnob (SkyRegion *catstats, int photcode, double epoch, int *nstars) {
     6Stars *getusnob (SkyRegion *catstats, int photcode, int *nstars) {
    77
    88  long int offset;
    … …  
    1313  FILE *f;
    1414  double dec;
    15   double uR, uD;
    1615  float m1, m2, mag;
    1716  int iDEC0, iDEC1, iRA0, iRA1;
    1817  int spd, spd_start, spd_end;
    1918  int NUSNO, Nusno, Nstars;
     19  short int USNO_RED, USNO_BLUE;
     20  e_time USNOepoch;
    2021  Stars *stars;
    21   short int USNO_RED, USNO_BLUE;
    2222
    2323  /* require photcode */
    … …  
    110110    }
    111111
     112    USNOepoch = date_to_sec ("2000/01/01,00:00:00");
     113
    112114    buf = buffer;
    113115    /* print out data from slice within RA and DEC range */
    … …  
    118120      if (buf[1] > iDEC1) continue;
    119121     
     122      /* USNO coords are reported for J2000 / epoch 2000.0 */
    120123      /* extract the basic stellar data */
    121124      bzero (&stars[Nusno], sizeof(Stars));
    122       stars[Nusno].R = buf[0]/360000.0;
    123       stars[Nusno].D = buf[1]/360000.0 - 90.0;
    124       stars[Nusno].dM    = NO_ERR;
    125       stars[Nusno].t     = 0;
     125      stars[Nusno].R   = buf[0]/360000.0;
     126      stars[Nusno].D   = buf[1]/360000.0 - 90.0;
     127
     128      /* XXX uR cos(D) or just uR ??? */
     129      stars[Nusno].uR  = 2.0 * ((buf[2]       % 10000) - 5000);
     130      stars[Nusno].uD  = 2.0 * ((buf[2]/10000 % 10000) - 5000);
     131
     132      stars[Nusno].duR = (buf[3]      % 1000);
     133      stars[Nusno].duD = (buf[3]/1000 % 1000);
     134
     135      stars[Nusno].dR  = 0.001 * (buf[4]      % 1000);
     136      stars[Nusno].dD  = 0.001 * (buf[4]/1000 % 1000);
     137
     138      stars[Nusno].P   = 0;
     139      stars[Nusno].dP  = 0;
     140
     141      /* USNO magnitude errors are reported as a fixed 0.3 mag */
     142      stars[Nusno].dM    = 0.3;
    126143      stars[Nusno].found = -1;
    127144     
     145      /* USNO-B uses J2000 equinox and 2000.0 epoch for coordinates */
     146      /* the magnitudes have no temporal information */
     147      stars[Nusno].t     = USNOepoch;
     148
    128149      /* one pass of addstar does either r or b */
    129       if (photcode == USNO_RED) {
    130         m1 = fabs(0.01 * (buf[7] % 10000)); /* 1st red mag */
     150      if (photcode == USNO_BLUE) {
     151        m1 = fabs(0.01 * (buf[5] % 10000)); /* 1st blue mag */
     152        m2 = fabs(0.01 * (buf[7] % 10000)); /* 1st blue mag */
     153        stars[Nusno].code  = USNO_BLUE;
     154      } else {
     155        m1 = fabs(0.01 * (buf[6] % 10000)); /* 1st red mag */
    131156        m2 = fabs(0.01 * (buf[8] % 10000)); /* 2nd red mag */
    132157        stars[Nusno].code  = USNO_RED;
    133       } else {
    134         m1 = fabs(0.01 * (buf[5] % 10000)); /* 1st blue mag */
    135         m2 = fabs(0.01 * (buf[6] % 10000)); /* 1st blue mag */
    136         stars[Nusno].code  = USNO_BLUE;
    137158      }
    138159
    … …  
    143164        mag = (m1) ? m1 : m2;
    144165      }
     166      stars[Nusno].M = (mag == 0.0) ? 32.0 : mag;
    145167
    146       uR = (buf[2] % 10000);
    147       uR = (uR - 5000.0) * 0.002 / 3600.0;
    148       uD = ((buf[2] / 10000) % 10000);
    149       uD = (uD - 5000.0) * 0.002 / 3600.0;
    150 
    151       /* need to carry the proper motions */
    152       stars[Nusno].M = (mag == 0.0) ? 32.0 : mag;
    153       stars[Nusno].R += uR*(epoch - 2000.0);
    154       stars[Nusno].D += uD*(epoch - 2000.0);
    155168      Nusno ++;
    156169      CHECK_REALLOCATE (stars, Stars, NUSNO, Nusno, 5000);
  • trunk/Ohana/src/addstar/src/greference.c

    r6675 r6683  
    2121  /* get stars from the USNO B catalog for the given region */
    2222  if (!strcasecmp (Refcat, "USNOB")) {
    23     stars = getusnob (region, photcode, 2000.0, &Nstars);
     23    stars = getusnob (region, photcode, &Nstars);
    2424  }
    2525
    2626  /* get stars from the USNO B catalog for the given region */
    2727  if (!strcasecmp (Refcat, "TYCHO")) {
    28     stars = gettycho (region, photcode, 2000.0, &Nstars);
     28    stars = gettycho (region, photcode, &Nstars);
    2929  }
    3030
  • trunk/Ohana/src/addstar/src/replace_match.c

    r5328 r6683  
    88  for (i = 0; i < average[0].Nm; i++) {
    99    if (measure[i].source != star[0].code) continue;
    10     measure[i].dR_PS       = 3600.0*(average[0].R_PS - star[0].R);
    11     measure[i].dD_PS       = 3600.0*(average[0].D_PS - star[0].D);
     10    measure[i].dR_PS       = 3600.0*(average[0].R - star[0].R);
     11    measure[i].dD_PS       = 3600.0*(average[0].D - star[0].D);
    1212    measure[i].M_PS        = MIN (star[0].M,  NO_MAG);
    1313    measure[i].dM_PS       = MIN (star[0].dM, NO_ERR);
  • trunk/Ohana/src/addstar/src/update_coords.c

    r5239 r6683  
    3333  r = r / Npt;  /* these are corrections in 1/100 arcsec to RA and DEC */
    3434  d = d / Npt;
    35   average[0].R_PS -= r / 3600.0;
    36   average[0].D_PS -= d / 3600.0;
     35  average[0].R -= r / 3600.0;
     36  average[0].D -= d / 3600.0;
    3737  m = average[0].offset;  /* first measurement of this star */
    3838  for (i = 0; i < average[0].Nm; i++) {
Note: See TracChangeset for help on using the changeset viewer.