IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5328


Ignore:
Timestamp:
Oct 14, 2005, 6:29:26 AM (21 years ago)
Author:
eugene
Message:

replaced "thiscode" as global with photcode passed by argument,
added explicit quality airmass option (for skyprobe)
added explicit subpix option (for skyprobe)
replace skyprobe global with above two.

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

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/Makefile

    r5289 r5328  
    99INC     =       $(HOME)/include
    1010SRC     =       $(HOME)/src
    11 DEF     =       $(HOME)/def
    12 DFS     =       $(HOME)/dfs
    1311MAN     =       $(HOME)/doc
    1412DESTBIN =       $(LBIN)
     
    6058$(SRC)/RegionOps.$(ARCH).o \
    6159$(SRC)/replace_match.$(ARCH).o \
    62 $(SRC)/save_pt_catalog.$(ARCH).o \
    6360$(SRC)/SetSignals.$(ARCH).o \
    6461$(SRC)/sort_lists.$(ARCH).o \
     
    107104default: $(PROGRAM)
    108105
    109 COMMOBJ = \
    110 $(DFS)/AddstarClientOptions.$(ARCH).o \
    111 $(DFS)/Stars.$(ARCH).o
    112 
    113 COMMINC = \
    114 $(DFS)/AddstarClientOptions.h \
    115 $(DFS)/Stars.h
    116 
    117 autocode: $(COMMOBJ)
    118 
    119106ADDSTARC = $(SRC)/addstarc.$(ARCH).o $(CLIENT)
    120107ADDSTARD = $(SRC)/addstard.$(ARCH).o $(SERVER)
     
    152139        $(CC) $^ -o $@ $(LFLAGS)
    153140
    154 $(INC)/commcode.h: $(COMMINC)
    155         cat $(DEF)/common.h >  $(INC)/commcode.h
    156         cat $(COMMINC)      >> $(INC)/commcode.h
    157         @echo "# endif"     >> $(INC)/commcode.h
    158         @echo done with commcode.h
    159 
    160 $(DFS)/%.c: $(DEF)/%.d $(DEF)/commcode.c $(INC)/commcode.h
    161         @if [ ! -d $(DFS) ]; then mkdir -p $(DFS); fi
    162         generate $< $(DEF)/commcode.c $@
    163 
    164 $(DFS)/%.h: $(DEF)/%.d $(DEF)/commcode.h
    165         @if [ ! -d $(DFS) ]; then mkdir -p $(DFS); fi
    166         generate $< $(DEF)/commcode.h $@
    167 
    168141$(DESTBIN)/%: $(BIN)/%.$(ARCH)
    169142        @if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
     
    189162        rm -f `find . -name "*~"`
    190163        rm -f `find . -name "#*"`
    191         rm -f $(DFS)/*.h
    192         rm -f $(DFS)/*.c
    193         rm -f $(INC)/commcode.h
  • trunk/Ohana/src/addstar/doc/notes.txt

    r5293 r5328  
     1
     2todo goals:
     3
     4  o move addstar/gstars to AddstarClientOptions
     5  o add thiscode to AddstarClientOptions
     6  o address MOSAIC somehow
     7  o replace skyprobe mode
     8  - address the cat & ref modes in client/server
     9 
     10  * add airmass quality to options
     11  * deal with Myyyy as sky value
     12  * better way to interpret flips header info for sky?
     13  * fix unlink empty file problem
     14  * programs like relphot and dvo need to be provided
     15    with sorted measure tables; add this as a feature
     16    of the load_catalog API?
     17
     182005.10.13
     19
     20  I am working to minimize usage of globals and cleanup addstar
     21  functions to make them more appropriate for the client / server
     22  model. 
     23
     24  I have dropped save_pt_catalog, and modified load_pt_catalog, as
     25  well as the load_catalog functions.  Now, the choice of elements to
     26  load is made by setting flags in the catalog structure itself
     27  (catalog.catflags).  Thus this information is carried around by the
     28  catalog variable.  the load_pt_catalog function now only returns
     29  true.  it is now necessary to check the state of the disk file by
     30  examining Nave_disk to decide if the file is empty or not.  This is
     31  perhaps too limiting: it prevents us from using only one of the
     32  catalog tables (say measure without average).  The concern I have is
     33  to manage the process of cleaning up the catalogs if no data is
     34  added to them:  I don't want addstar to leave behind empty files
     35  (plus, I think this breaks the lock/load state logic).  Thus,
     36  whenever addstar unlocks / closes a file, if the Nave_disk +
     37  Naverage is 0, the file should be unlinked.
    138
    2392005.10.12
  • trunk/Ohana/src/addstar/include/2mass.h

    r4299 r5328  
    1010
    1111GSCRegion *get2mass_acc (GSCRegion *patch, int *nfiles, char *path, char *accel);
    12 Stars *get2mass_2DR_data (GSCRegion *region, GSCRegion *patch, int *nstars);
    13 Stars *get2mass_AS_data (GSCRegion *region, GSCRegion *patch, int *nstars);
     12Stars *get2mass_2DR_data (GSCRegion *region, GSCRegion *patch, int photcode, int *nstars);
     13Stars *get2mass_AS_data (GSCRegion *region, GSCRegion *patch, int phocode, int *nstars);
  • trunk/Ohana/src/addstar/include/addstar.h

    r5322 r5328  
    5252
    5353/* these globals modify the behavior of gstars (KEEP) */
    54 double SNLIMIT;
    55 int    ACCEPT_ASTROM;  // accept even bad astrometry solutions (NASTRO == 0)
    56 int    TEXTMODE;       // force input file to be loaded as RAW
    57 char  *DUMP;           // dump out intermediate results
    58 int    XOVERSCAN;      // used to modify stored image dimensions
    59 int    YOVERSCAN;      // used to modify stored image dimensions
    60 int    XMIN;           // used to filter loaded star list
    61 int    XMAX;           // used to filter loaded star list
    62 int    YMIN;           // used to filter loaded star list
    63 int    YMAX;           // used to filter loaded star list
    64 double Latitude;       // carried into image structure from config
     54double  SNLIMIT;
     55int     ACCEPT_ASTROM;  // accept even bad astrometry solutions (NASTRO == 0)
     56int     TEXTMODE;       // force input file to be loaded as RAW
     57int     SUBPIX;         // apply a subpix correction
     58char   *DUMP;           // dump out intermediate results
     59int     XOVERSCAN;      // used to modify stored image dimensions
     60int     YOVERSCAN;      // used to modify stored image dimensions
     61int     XMIN;           // used to filter loaded star list
     62int     XMAX;           // used to filter loaded star list
     63int     YMIN;           // used to filter loaded star list
     64int     YMAX;           // used to filter loaded star list
     65double  Latitude;       // carried into image structure from config
     66Coords *MOSAIC;         // carries the mosaic into gstars
    6567
    6668/* these globals are used separately by both client and server (KEEP) */
     
    6870int    VERBOSE;
    6971
    70 /* add to options as an int / keep the global? */
    71 PhotCode *thiscode;
    72 
    73 /* how to carry this around? */
    74 Coords   *MOSAIC;
    75 
    76 /* globals set by command-line options (AddstarClientOptions) */
    77 /* move into AddstarClientOptions completely */
    78 # if (0)
    79 int    MODE;
    80 int    EXISTING_REGIONS;
    81 int    ONLY_MATCH;
    82 int    SKIP_MISSED;
    83 int    REPLACE;
    84 int    CLOSEST;
    85 int    NOSORT;
    86 int    UPDATE;
    87 int    ONLY_IMAGES;
    88 int    CALIBRATE;
    89 double DEFAULT_RADIUS;   // XXX add to AddstarClientOptions
    90 double NSIGMA;           // XXX add to AddstarClientOptions
    91 # endif
    92 
    9372/* modify server behavoir (make this an addstar cleanup mode?) */
    9473int    FORCE_READ;
    9574
    96 int   SKYPROBE; 
    9775// XXX this should be replaced with
    9876// 1) an airmass accuracy option
     
    126104int        dump_rawstars          PROTO((Stars *stars, int Nstars));
    127105int        edge_check             PROTO((double *x1, double *y1, double *x2, double *y2));
    128 void       find_matches           PROTO((GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, AddstarClientOptions options));
    129 void       find_matches_closest   PROTO((GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, AddstarClientOptions options));
     106void       find_matches           PROTO((GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, Coords *mosaic, AddstarClientOptions options));
     107void       find_matches_closest   PROTO((GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, Coords *mosaic, AddstarClientOptions options));
    130108void       find_matches_refstars  PROTO((GSCRegion *region, Stars **stars, int Nstars, Catalog *catalog, AddstarClientOptions options));
    131109Stars    **find_subset            PROTO((GSCRegion *region, Stars *stars, int Nstars, int *NSTARS));
    132110int        gcatalog               PROTO((Catalog *catalog));
    133 Stars     *get2mass               PROTO((GSCRegion *patch, int *NSTARS, int mode));
     111Stars     *get2mass               PROTO((GSCRegion *patch, int photcode, int mode, int *NSTARS));
    134112double     get_subpix             PROTO((double x, double y));
    135113Stars     *getgsc                 PROTO((GSCRegion *patch, int *NSTARS));
    136 Stars     *getusno                PROTO((GSCRegion *catstats, int *Nstars));
    137 Image     *gimages                PROTO((FITS_DB *db, Image *image, int *Npimage));
    138 Stars     *grefcat                PROTO((char *Refcat, GSCRegion *catstats, int *nstars));
    139 Stars     *grefstars              PROTO((char *file, int *Nstars));
    140 GSCRegion *gregion_image          PROTO((Image *image, int *Nregions));
     114Stars     *getusno                PROTO((GSCRegion *catstats, int photcode, int *Nstars));
     115Image     *gimages                PROTO((FITS_DB *db, Image *image, Coords *mosaic, int *Npimage));
     116Stars     *grefcat                PROTO((char *Refcat, GSCRegion *catstats, int photcode, int *nstars));
     117Stars     *grefstars              PROTO((char *file, int photcode, int *Nstars));
     118GSCRegion *gregion_image          PROTO((Image *image, Coords *mosaic, int *Nregions));
    141119GSCRegion *gregion_match          PROTO((GSCRegion *regions, int *nregions));
    142120GSCRegion *gregion_patch          PROTO((GSCRegion *patch, int *nregions));
     
    144122GSCRegion *gregion_stars          PROTO((Stars *stars, int Nstars, int *Nregion));
    145123GSCRegion *gregions               PROTO((Image *image, int *Nregions));
    146 Stars     *gstars                 PROTO((char *file, int *NSTARS, Image *image));
     124Stars     *gstars                 PROTO((char *file, int *NSTARS, int photcode, Image *image));
    147125void       help                   PROTO(());
    148126int        in_image               PROTO((double r, double d, Image *image));
  • trunk/Ohana/src/addstar/src/addstar.c

    r5322 r5328  
    3131  }
    3232
    33   if (SKYPROBE) load_subpix ();
    34 
    3533  /* we use the image table to lock db access -- perhaps this is not necessary?*/
    3634  lock_image_db (&db, ImageCat);
     
    4139  switch (options.mode) {
    4240  case M_IMAGE:
    43     stars = gstars (argv[1], &Nstars, &image);
     41    stars = gstars (argv[1], &Nstars, options.photcode, &image);
    4442    if ((DUMP != NULL) && !strcmp (DUMP, "rawstars")) dump_rawstars (stars, Nstars);
    45     regions = gregion_image (&image, &Nregions);
     43    regions = gregion_image (&image, MOSAIC, &Nregions);
    4644    /* lock_image_db (&db, ImageCat); */
    47     overlap = gimages (&db, &image, &Noverlap);
     45    overlap = gimages (&db, &image, MOSAIC, &Noverlap);
    4846    /* unlock_image_db (&db); */
    4947    break;
    5048  case M_REFLIST:
    51     stars = grefstars (argv[1], &Nstars);
     49    stars = grefstars (argv[1], options.photcode, &Nstars);
    5250    regions = gregion_stars (stars, Nstars, &Nregions);
    5351    break;
     
    9593      Nsubset = Nstars;
    9694      if (options.closest) {
    97         find_matches_closest (&regions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, options);
     95        find_matches_closest (&regions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, MOSAIC, options);
    9896      } else {
    99         find_matches (&regions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, options);
     97        find_matches (&regions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, MOSAIC, options);
    10098      }
    10199      break;
    102100    case M_REFCAT:
    103       stars = grefcat (argv[1], &regions[i], &Nstars);
     101      stars = grefcat (argv[1], &regions[i], options.photcode, &Nstars);
    104102    case M_REFLIST:
    105103      subset = find_subset (&regions[i], stars, Nstars, &Nsubset);
  • trunk/Ohana/src/addstar/src/addstarc.c

    r5322 r5328  
    1414
    1515  /* load data */
    16   stars = gstars (argv[1], &Nstars, &image);
     16  stars = gstars (argv[1], &Nstars, MOSAIC, &image);
    1717
    1818  /* set up server connection */
  • trunk/Ohana/src/addstar/src/airmass.c

    r5014 r5328  
    11# include "addstar.h"
     2
     3static AirmassQuality = FALSE;
     4
     5void SetAirmassQuality (int quality) {
     6  AirmassQuality = quality;
     7}
    28
    39float airmass (float secz_image, double ra, double dec, double st, double latitude) {
     
    511  double hour, cosz, secz;
    612
    7   if (!SKYPROBE) return (secz_image);
     13  if (!AirmassQuality) return (secz_image);
    814
    915  /*** make this optional? we may not have ST... ***/
  • trunk/Ohana/src/addstar/src/args.c

    r5322 r5328  
    55 
    66  int N;
     7  int QUALITY_AIRMASS;
    78
    89  /* check for help request */
     
    4344  }
    4445  /* override any header PHOTCODE values */
    45   thiscode = NULL;
    4646  options.photcode = 0;
    4747  if ((N = get_argument (argc, argv, "-p"))) {
    4848    remove_argument (N, &argc, argv);
    4949    options.photcode = GetPhotcodeCodebyName (argv[N]);
    50     thiscode = GetPhotcodebyName (argv[N]);
    5150    remove_argument (N, &argc, argv);
    5251  }
     
    148147
    149148  /*** optional situations ***/
    150   /* treat data specially for skyprobe (calibration, subpix) */
    151   SKYPROBE = FALSE;
     149  /* choose high quality airmass vs low quality airmass (per-star vs per-image) */
     150  QUALITY_AIRMASS = FALSE;
     151  if ((N = get_argument (argc, argv, "-quality-airmass"))) {
     152    remove_argument (N, &argc, argv);
     153    QUALITY_AIRMASS = TRUE;
     154  }
     155  /* choose high quality airmass vs low quality airmass (per-star vs per-image) */
     156  SUBPIX = FALSE;
     157  if ((N = get_argument (argc, argv, "-subpix"))) {
     158    remove_argument (N, &argc, argv);
     159    SUBPIX = TRUE;
     160  }
     161  /* skyprobe means: subpix correction and quality airmass */
    152162  if ((N = get_argument (argc, argv, "-skyprobe"))) {
    153     SKYPROBE = TRUE;
    154     remove_argument (N, &argc, argv);
    155     /* XXX EAM : define airmass calculation method?
    156                  set calibrate to true
    157                  perhaps a 'skyprobe' data format (for image.sky issue)
    158     */
    159   }
     163    remove_argument (N, &argc, argv);
     164    QUALITY_AIRMASS = TRUE;
     165    SUBPIX = TRUE;
     166  }
     167  SetAirmassQuality (QUALITY_AIRMASS);
     168  if (SUBPIX) load_subpix ();
     169
    160170  /* define 2MASS quality flags to keep */
    161171  SELECT_2MASS_QUALITY = NULL;
     
    196206  }
    197207
     208  if ((options.mode == M_REFLIST) && (options.photcode == 0)) {
     209    fprintf (stderr, "photcode must be specified for -ref\n");
     210    exit (2);
     211  }
    198212
    199213  if (argc != 2) {
  • trunk/Ohana/src/addstar/src/args_client.c

    r5322 r5328  
    55 
    66  int N;
     7  int QUALITY_AIRMASS;
    78
    89  /* check for help request */
     
    146147
    147148  /*** optional situations ***/
    148   /* treat input data specially for skyprobe (calibration, subpix) */
    149   SKYPROBE = FALSE;
     149  /* choose high quality airmass vs low quality airmass (per-star vs per-image) */
     150  QUALITY_AIRMASS = FALSE;
     151  if ((N = get_argument (argc, argv, "-quality-airmass"))) {
     152    remove_argument (N, &argc, argv);
     153    QUALITY_AIRMASS = TRUE;
     154  }
     155  /* choose high quality airmass vs low quality airmass (per-star vs per-image) */
     156  SUBPIX = FALSE;
     157  if ((N = get_argument (argc, argv, "-subpix"))) {
     158    remove_argument (N, &argc, argv);
     159    SUBPIX = TRUE;
     160  }
     161  /* skyprobe means: subpix correction and quality airmass */
    150162  if ((N = get_argument (argc, argv, "-skyprobe"))) {
    151     SKYPROBE = TRUE;
    152     remove_argument (N, &argc, argv);
    153   }
     163    remove_argument (N, &argc, argv);
     164    QUALITY_AIRMASS = TRUE;
     165    SUBPIX = TRUE;
     166  }
     167  if (SUBPIX) load_subpix ();
     168
    154169  /* define 2MASS quality flags to keep */
    155170  SELECT_2MASS_QUALITY = NULL;
  • trunk/Ohana/src/addstar/src/calibrate.c

    r5267 r5328  
    66void InitCalibration () {
    77
    8     fprintf (stderr, "calibrating the image...  %d\n", thiscode[0].equiv);
     8    fprintf (stderr, "calibrating the image...\n");
    99    Ncal = 0;
    1010    NCAL = 1000;
     
    4747  float CalM0, CalM1, CalM2, dCalM;
    4848  short CalC0, CalC1, CalC2;
     49  PhotCode *code;
    4950
    5051  found0 = found1 = found2 = FALSE;
    5152  CalM0 = CalM1 = CalM2 = dCalM = NO_MAG;
    5253
    53   CalC0 = thiscode[0].equiv;
    54   CalC1 = thiscode[0].c1;
    55   CalC2 = thiscode[0].c2;
     54  code  = GetPhotcodebyCode (new[0].source);
     55  CalC0 = code[0].equiv;
     56  CalC1 = code[0].c1;
     57  CalC2 = code[0].c2;
    5658
    5759  m = average[0].offset;
     
    8587  float N, M1, M2, Klam, Clam, Xlam, Mabs, *Dmag, *dDmag;
    8688  float dMo, dMr, Mw, Dmed, W1, W2, NSigma;
    87  
     89  PhotCode *code;
     90
     91  code = GetPhotcodebyCode (image[0].source);
     92
    8893  /* reject multiple matched-stars */
    8994  /* find maximum value of Nstar[] */
     
    109114  ALLOCATE (dDmag, float, Ncal);
    110115  Nkeep = 0;
    111   Clam = thiscode[0].C*0.001;
    112   Klam = thiscode[0].K;
    113   Xlam = thiscode[0].X[0];
     116  Clam = code[0].C*0.001; /* photcode.C still in millimags */
     117  Klam = code[0].K;
     118  Xlam = code[0].X[0];
    114119  for (i = 0; i < Ncal; i++) {
    115120    /* if this entry has too many (or two few?) matches, skip it */
     
    121126    /* skip stars brighter than 8.0 */
    122127    /* XXX EAM : perhaps make this more flexible?? */
    123     if (SKYPROBE) {
    124       if (Mabs > 9.0) continue;
    125       if (Mabs < 5.0) continue;
    126     }
     128    if (Mabs > 9.0) continue;
     129    if (Mabs < 5.0) continue;
    127130   
    128131    /* XXX EAM: note the artificial 0.005 dmag here */
  • trunk/Ohana/src/addstar/src/find_matches.c

    r5322 r5328  
    11# include "addstar.h"
    22
    3 void find_matches (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, AddstarClientOptions options) {
     3void find_matches (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, Coords *mosaic, AddstarClientOptions options) {
    44
    55  int i, j, n, N, J;
     
    99  int *N1, *N2,  *next_meas, *next_miss;
    1010  int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch;
    11   Coords tcoords;
    1211  int Nsecfilt, Nsec;
    1312  float Mcat, *Mval, MTIME;
    1413  double dtime;
    1514  struct timeval start, stop;
     15  PhotCode *code;
     16  Coords tcoords;
    1617
    1718  gettimeofday (&start, NULL);
     19
     20  code = GetPhotcodebyCode (options.photcode);
    1821
    1922  /* photcode data - must by of type DEP, (PRI, SEC) - probably should restrict to DEP */
    2023  Nsecfilt = GetPhotcodeNsecfilt ();
    21   Nsec = (thiscode[0].type == PHOT_DEP) ?
    22     GetPhotcodeNsec (thiscode[0].equiv) :
    23     GetPhotcodeNsec (thiscode[0].code);
     24  Nsec = (code[0].type == PHOT_DEP) ? GetPhotcodeNsec (code[0].equiv) : GetPhotcodeNsec (code[0].code);
    2425  /* this function requires incoming stars to have the same photcode */
    2526
     
    4647  /* for mosaic astrometry, the grid should be w.r.t. the tangent-plane, not chip coords */
    4748  if (!strcmp (&image[0].coords.ctype[4], "-WRP")) {
    48     tcoords = MOSAIC[0];
     49    tcoords = mosaic[0];
    4950    tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    5051    tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
     
    199200
    200201  /* add reference for undetected catalog stars */
    201   if (!strcmp (&image[0].coords.ctype[4], "-WRP")) RegisterMosaic (MOSAIC);
     202  if (!strcmp (&image[0].coords.ctype[4], "-WRP")) RegisterMosaic (mosaic);
    202203  for (j = 0; (j < Nave) && !options.skip_missed; j++) {
    203204    n = N2[j];
  • trunk/Ohana/src/addstar/src/find_matches_closest.c

    r5322 r5328  
    11# include "addstar.h"
    22
    3 void find_matches_closest (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, AddstarClientOptions options) {
     3void find_matches_closest (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, Coords *mosaic, AddstarClientOptions options) {
    44
    55  int i, j, n, N, J, Jmin;
     
    1414  double dtime;
    1515  struct timeval start, stop;
     16  PhotCode *code;
    1617
    1718  gettimeofday (&start, NULL);
     19
     20  code = GetPhotcodebyCode (options.photcode);
    1821
    1922  /* photcode data - must by of type DEP, (PRI, SEC) - probably should restrict to DEP */
    2023  Nsecfilt = GetPhotcodeNsecfilt ();
    21   Nsec = (thiscode[0].type == PHOT_DEP) ?
    22     GetPhotcodeNsec (thiscode[0].equiv) :
    23     GetPhotcodeNsec (thiscode[0].code);
     24  Nsec = (code[0].type == PHOT_DEP) ? GetPhotcodeNsec (code[0].equiv) : GetPhotcodeNsec (code[0].code);
    2425  /* this function requires incoming stars to have the same photcode */
    2526
     
    4647  /* for mosaic astrometry, the grid should be w.r.t. the tangent-plane, not chip coords */
    4748  if (!strcmp (&image[0].coords.ctype[4], "-WRP")) {
    48     tcoords = MOSAIC[0];
     49    tcoords = mosaic[0];
    4950    tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    5051    tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
     
    197198
    198199  /** add reference for undetected catalog stars **/
    199   if (!strcmp (&image[0].coords.ctype[4], "-WRP")) RegisterMosaic (MOSAIC);
     200  if (!strcmp (&image[0].coords.ctype[4], "-WRP")) RegisterMosaic (mosaic);
    200201  for (j = 0; (j < Nave) && !options.skip_missed; j++) {
    201202    n = N2[j];
  • trunk/Ohana/src/addstar/src/get2mass.c

    r4772 r5328  
    22# include "2mass.h"
    33
    4 Stars *get2mass (GSCRegion *patch, int *NSTARS, int mode) {
     4Stars *get2mass (GSCRegion *patch, int photcode, int mode, int *NSTARS) {
    55 
    66  char *path;
     
    1313  NAMED_PHOTCODE (TM_H, "2MASS_H");
    1414  NAMED_PHOTCODE (TM_K, "2MASS_K");
    15   if (thiscode == NULL) Shutdown ("photcode not specified");
    16   if (thiscode[0].code == TM_J) goto good_code;
    17   if (thiscode[0].code == TM_H) goto good_code;
    18   if (thiscode[0].code == TM_K) goto good_code;
     15  if (photcode == TM_J) goto good_code;
     16  if (photcode == TM_H) goto good_code;
     17  if (photcode == TM_K) goto good_code;
    1918  Shutdown ("2MASS photcode not specified");
    2019
     
    3130    switch (mode) {
    3231      case 0:
    33         refcat = get2mass_AS_data (&regions[i], patch, &Nrefcat);
     32        refcat = get2mass_AS_data (&regions[i], patch, photcode, &Nrefcat);
    3433        if (VERBOSE) fprintf (stderr, "loaded %d stars from 2MASS (allsky)\n", Nrefcat);
    3534        break;
    3635      case 1:
    37         refcat = get2mass_2DR_data (&regions[i], patch, &Nrefcat);
     36        refcat = get2mass_2DR_data (&regions[i], patch, photcode, &Nrefcat);
    3837        if (VERBOSE) fprintf (stderr, "loaded %d stars from 2MASS (dr2)\n", Nrefcat);
    3938        break;
  • trunk/Ohana/src/addstar/src/get2mass_as.c

    r4772 r5328  
    1313e_time get2mass_time (char *ptr, char *buffer, int Nbound, int Nbyte);
    1414
    15 Stars *get2mass_AS_data (GSCRegion *region, GSCRegion *patch, int *nstars) {
     15Stars *get2mass_AS_data (GSCRegion *region, GSCRegion *patch, int photcode, int *nstars) {
    1616 
    1717  int FilterSkip, TimeSkip;
     
    3333  DEC1 = MIN (patch[0].DEC[1], UserPatch.DEC[1]);
    3434
    35   code = thiscode[0].code;
    3635  FilterSkip = TimeSkip = 0;
    37   if (thiscode[0].code == TM_J) {
     36  if (photcode == TM_J) {
    3837      FilterSkip = 6;
    3938      TimeSkip = 23;
    4039      Qentry   = 0;
    4140  }
    42   if (thiscode[0].code == TM_H) {
     41  if (photcode == TM_H) {
    4342      FilterSkip = 10;
    4443      TimeSkip = 19;
    4544      Qentry   = 1;
    4645  }
    47   if (thiscode[0].code == TM_K) {
     46  if (photcode == TM_K) {
    4847      FilterSkip = 14;
    4948      TimeSkip = 15;
    5049      Qentry   = 2;
    5150  }
    52   if (!FilterSkip) Shutdown ("invalid photcode %d", thiscode[0].code);
     51  if (!FilterSkip) Shutdown ("invalid photcode %s", GetPhotcodeNamebyCode(photcode));
    5352
    5453  filename = region[0].filename;
  • trunk/Ohana/src/addstar/src/get2mass_dr2.c

    r4299 r5328  
    55# define NLINE 30000
    66
    7 Stars *get2mass_2DR_data (GSCRegion *region, GSCRegion *patch, int *nstars) {
     7Stars *get2mass_2DR_data (GSCRegion *region, GSCRegion *patch, int photcode, int *nstars) {
    88 
    99  int i, Nstars, NSTARS, Nbyte, Nline;
     
    6464      stars[Nstars].found = -1;
    6565
    66       if (thiscode[0].code == TM_J) {
     66      if (photcode == TM_J) {
    6767        dparse (&J,  1, &buffer[NBYTE*i + 53]);
    6868        dparse (&dJ, 2, &buffer[NBYTE*i + 53]);
     
    7171        stars[Nstars].code = TM_J;
    7272      }
    73       if (thiscode[0].code == TM_H) {
     73      if (photcode == TM_H) {
    7474        dparse (&H,  1, &buffer[NBYTE*i + 72]);
    7575        dparse (&dH, 2, &buffer[NBYTE*i + 72]);
     
    7878        stars[Nstars].code = TM_H;
    7979      }
    80       if (thiscode[0].code == TM_K) {
     80      if (photcode == TM_K) {
    8181        dparse (&K,  1, &buffer[NBYTE*i + 91]);
    8282        dparse (&dK, 2, &buffer[NBYTE*i + 91]);
  • trunk/Ohana/src/addstar/src/getusno.c

    r3376 r5328  
    99  1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10};
    1010
    11 Stars *getusno (GSCRegion *catstats, int *Nstars) {
     11Stars *getusno (GSCRegion *catstats, int photcode, int *Nstars) {
    1212
    1313  long int offset;
     
    2727  NAMED_PHOTCODE (USNO_RED, "USNO_RED");
    2828  NAMED_PHOTCODE (USNO_BLUE, "USNO_BLUE");
    29   if (thiscode == NULL) Shutdown ("photcode not specified");
    30   if (thiscode[0].code == USNO_RED) goto good_code;
    31   if (thiscode[0].code == USNO_BLUE) goto good_code;
     29  if (photcode == USNO_RED) goto good_code;
     30  if (photcode == USNO_BLUE) goto good_code;
    3231  Shutdown ("USNO photcode not specified");
    3332good_code:
     
    130129
    131130        /* one pass of addstar does either r or b */
    132         if (thiscode[0].code == USNO_RED) {
     131        if (photcode == USNO_RED) {
    133132          stars[Nusno].code  = USNO_RED;
    134133          stars[Nusno].M     = fabs (0.1*(buf[2] - 1000*((int)(buf[2]/1000))));
    135134        }
    136         if (thiscode[0].code == USNO_BLUE) {   
     135        if (photcode == USNO_BLUE) {   
    137136          stars[Nusno].code  = USNO_BLUE;
    138137          stars[Nusno].M     = fabs (0.1*((int)(buf[2] - 1000000*((int)(buf[2]/1000000))) / 1000));
  • trunk/Ohana/src/addstar/src/gimages.c

    r4864 r5328  
    22
    33/* given image, find catalog images which overlap it */
    4 Image *gimages (FITS_DB *db, Image *image, int *Npimage) {
     4Image *gimages (FITS_DB *db, Image *image, Coords *mosaic, int *Npimage) {
    55 
    66  int i, j, k, addtolist;
     
    3737  /* for mosaic astrometry, the grid should be w.r.t. the tangent-plane, not chip coords */
    3838  if (!strcmp (&image[0].coords.ctype[4], "-WRP")) {
    39     tcoords = MOSAIC[0];
     39    tcoords = mosaic[0];
    4040    tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    4141    tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
     
    4343    tcoords.Npolyterms = 1;
    4444    strcpy (tcoords.ctype, "RA---TAN");
    45     RegisterMosaic (MOSAIC);
     45    RegisterMosaic (mosaic);
    4646    /* register so image->sky conversions below have correct mosaic */
    4747  } else {
  • trunk/Ohana/src/addstar/src/greference.c

    r4299 r5328  
    11# include "addstar.h"
     2# define LOAD_ALLSKY 0
     3# define LOAD_DR2    1
    24
    3 Stars *grefcat (char *Refcat, GSCRegion *catstats, int *nstars) {
     5Stars *grefcat (char *Refcat, GSCRegion *catstats, int photcode, int *nstars) {
    46
    57  int Nstars;
     
    1416  /* get stars from USNO for the given region */
    1517  if (!strcasecmp (Refcat, "USNO")) {
    16     stars = getusno (catstats, &Nstars);
     18    stars = getusno (catstats, photcode, &Nstars);
    1719  }
    1820
     
    2426  /* get stars from 2MASS for the given region */
    2527  if (!strcasecmp (Refcat, "2MASS")) {
    26     stars = get2mass (catstats, &Nstars, 0);
     28    stars = get2mass (catstats, photcode, LOAD_ALLSKY, &Nstars);
    2729  }
    2830 
    2931  /* get stars from 2MASS for the given region */
    3032  if (!strcasecmp (Refcat, "2MASS-ALLSKY")) {
    31     stars = get2mass (catstats, &Nstars, 0);
     33    stars = get2mass (catstats, photcode, LOAD_ALLSKY, &Nstars);
    3234  }
    3335 
    3436  /* get stars from 2MASS for the given region */
    3537  if (!strcasecmp (Refcat, "2MASS-DR2")) {
    36     stars = get2mass (catstats, &Nstars, 1);
     38    stars = get2mass (catstats, photcode, LOAD_DR2, &Nstars);
    3739  }
    3840 
  • trunk/Ohana/src/addstar/src/grefstars.c

    r3376 r5328  
    22
    33/* read ASCII file with ref star data */
    4 Stars *grefstars (char *file, int *Nstars) {
     4Stars *grefstars (char *file, int photcode, int *Nstars) {
    55
    66  FILE *f;
     
    88  Stars *stars;
    99  char line[256];
    10 
    11   /* require photcode */
    12   if (thiscode == NULL) Shutdown ("photcode not specified");
    1310
    1411  /* open file */
     
    3128    while (stars[N].R >= 360.0) stars[N].R -= 360.0;
    3229    stars[N].t = 0;
    33     stars[N].code = thiscode[0].code;
     30    stars[N].code = photcode;
    3431    stars[N].found = FALSE;
    3532    CHECK_REALLOCATE (stars, Stars, NSTARS, N+1, 100);
     
    3835  return (stars);
    3936}
    40 
    41 /* add the photcode here */
  • trunk/Ohana/src/addstar/src/gregion_image.c

    r3389 r5328  
    22
    33/* given image with coords, find regions which overlap image */
    4 GSCRegion *gregion_image (Image *image, int *Nregions) {
     4GSCRegion *gregion_image (Image *image, Coords *mosaic, int *Nregions) {
    55 
    66  GSCRegion *regions, impatch;
     
    1414
    1515  if (!strcmp (&image[0].coords.ctype[4], "-WRP")) {
    16     if (MOSAIC == NULL) Shutdown ("no mosaic for WRP image (use -mosaic)");
    17     RegisterMosaic (MOSAIC);
     16    if (mosaic == NULL) Shutdown ("no mosaic for WRP image (use -mosaic)");
     17    RegisterMosaic (mosaic);
    1818  }   
    1919
  • trunk/Ohana/src/addstar/src/gstars.c

    r5287 r5328  
    11# include "addstar.h"
    22
    3 Stars *gstars (char *file, int *NSTARS, Image *image) {
     3Stars *gstars (char *file, int *NSTARS, int photcode, Image *image) {
    44
    55  FILE *f;
    66  int j, N, Nbytes, extend;
    77  int itmp, hour, min;
    8   char *name, *c, photcode[64], line[80];
     8  char *name, *c, photname[64], line[80];
    99  double tmp, sec, dMs;
    1010  Stars *stars, *rdstars;
     
    5959 
    6060  /* get photcode from header */
    61   if (thiscode == NULL) {
    62     fits_scan (&header, "PHOTCODE", "%s", 1, photcode);
    63     thiscode = GetPhotcodebyName (photcode);
    64   }
    65   if (thiscode == NULL) {
    66     fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", photcode);
    67     exit (1);
    68   }
    69   image[0].source = thiscode[0].code;
     61  if (photcode == 0) {
     62    if (!fits_scan (&header, "PHOTCODE", "%s", 1, photname)) {
     63      fprintf (stderr, "ERROR: photcode not supplied in header\n");
     64      exit (1);
     65    }
     66    photcode = GetPhotcodeCodebyName (photname);
     67    if (photcode == 0) {
     68      fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", photname);
     69      exit (1);
     70    }
     71  }
     72  if (photcode == 0) {
     73    fprintf (stderr, "ERROR: no valid photcode is supplied\n");
     74    exit (1);
     75  }
     76  image[0].source = photcode;
    7077
    7178  image[0].NX -= XOVERSCAN;
     
    141148  ***/
    142149
    143   if (SKYPROBE) {
     150  /** I'm essentially using subpix to be synonymous with SKYPROBE */
     151  if (SUBPIX) {
    144152    char *p;
    145153    int sky;
     
    199207    while (stars[N].R >= 360.0) stars[N].R -= 360.0;
    200208    stars[N].found = -1;
    201     stars[N].code = thiscode[0].code;
    202 
    203     if (SKYPROBE) {
     209    stars[N].code = photcode;
     210
     211    if (SUBPIX) {
    204212      dMs = get_subpix (stars[N].X, stars[N].Y);
    205213      stars[N].M    -= dMs;
  • trunk/Ohana/src/addstar/src/replace_match.c

    r5322 r5328  
    77  /* search for entry and replace values M, dM, R, D */
    88  for (i = 0; i < average[0].Nm; i++) {
    9     if (measure[i].source != thiscode[0].code) continue;
     9    if (measure[i].source != star[0].code) continue;
    1010    measure[i].dR_PS       = 3600.0*(average[0].R_PS - star[0].R);
    1111    measure[i].dD_PS       = 3600.0*(average[0].D_PS - star[0].D);
Note: See TracChangeset for help on using the changeset viewer.