IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16810


Ignore:
Timestamp:
Mar 4, 2008, 12:39:41 PM (18 years ago)
Author:
eugene
Message:

merge changes from eam_branch_20080223 : updates to DVO output format, addstar (SDSS and 2MASS flags), relastro (FitChip)

Location:
trunk/Ohana/src
Files:
16 added
2 deleted
136 edited

Legend:

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

    r16040 r16810  
    1313
    1414# programs may add their own internal requirements here
    15 FULL_CFLAGS   = $(BASE_CFLAGS)
     15FULL_CFLAGS   = $(BASE_CFLAGS) -Wall -Werror
    1616FULL_CPPFLAGS = $(BASE_CPPFLAGS)
    1717FULL_LDFLAGS  = -lkapa -ldvo -lFITS -lohana $(BASE_LDFLAGS)
     
    5959$(SRC)/grefstars.$(ARCH).o \
    6060$(SRC)/LoadStars.$(ARCH).o \
     61$(SRC)/LoadHeaders.$(ARCH).o \
     62$(SRC)/MatchHeaders.$(ARCH).o \
     63$(SRC)/LoadData.$(ARCH).o \
     64$(SRC)/LoadDataSDSS.$(ARCH).o \
    6165$(SRC)/in_image.$(ARCH).o \
    6266$(SRC)/load_subpix.$(ARCH).o \
     
    6771$(SRC)/ReadStarsFITS.$(ARCH).o \
    6872$(SRC)/ReadStarsTEXT.$(ARCH).o \
     73$(SRC)/ReadStarsSDSS.$(ARCH).o \
    6974$(SRC)/FilterStars.$(ARCH).o \
    7075$(SRC)/ImageOptions.$(ARCH).o \
    7176$(SRC)/GetFileMode.$(ARCH).o \
    7277$(SRC)/ReadImageHeader.$(ARCH).o \
     78$(SRC)/UpdateImageIDs.$(ARCH).o \
    7379$(SRC)/update_coords.$(ARCH).o
    7480
     
    165171$(SRC)/ConfigInit.$(ARCH).o \
    166172$(SRC)/LoadStars.$(ARCH).o \
     173$(SRC)/LoadHeaders.$(ARCH).o \
     174$(SRC)/MatchHeaders.$(ARCH).o \
     175$(SRC)/LoadData.$(ARCH).o \
     176$(SRC)/LoadDataSDSS.$(ARCH).o \
    167177$(SRC)/grefstars.$(ARCH).o \
    168178$(SRC)/load_subpix.$(ARCH).o \
     
    172182$(SRC)/ReadImageHeader.$(ARCH).o \
    173183$(SRC)/ReadStarsTEXT.$(ARCH).o \
     184$(SRC)/ReadStarsSDSS.$(ARCH).o \
     185$(SRC)/UpdateImageIDs.$(ARCH).o \
    174186$(SRC)/FilterStars.$(ARCH).o \
    175187$(SRC)/Shutdown.$(ARCH).o \
     
    189201$(SRC)/load2mass_catalog.$(ARCH).o \
    190202$(SRC)/get2mass_ops.$(ARCH).o \
     203$(SRC)/get2mass_full.$(ARCH).o \
    191204$(SRC)/find_matches_refstars.$(ARCH).o \
    192205$(SRC)/args_load2mass.$(ARCH).o \
  • trunk/Ohana/src/addstar/doc/notes.txt

    r16271 r16810  
     1
     22008.02.23
     3
     4  features I need to add / finish in dvo:
     5
     6  * detID / objID / imageID
     7
     8    some questions:
     9
     10      db_id
     11      table_id (chip / warp / stack / diff)
     12      chip_id / warp_id / stack_id / diff_id
     13     
     14      detections from stand-alone analysis would require an alternate sequence?
     15      detections without an associated image get image_id = 0
     16     
     17    * imageID : we will define a new, unique running ID within dvo
     18      against which joins are performed.  in addition, I will keep the
     19      externally supplied ids as a reference (32bit id + 16bit source)
     20
     21    * detID : the detection (measure) should carry the imageID + detID as a
     22      unique value.
     23
     24    * objID : objects will get a unique ID when they are created
     25      (sequence in table + table ID? or use the same bits as Maria?)
     26
     27  * extended measurement tables
     28  * SDSS ingest
     29  * 2MASS flags
     30 
    131
    2322008.01.31
  • trunk/Ohana/src/addstar/include/2mass.h

    r8361 r16810  
    4242int       get2mass_star (Stars *star, char *line, int Nmax);
    4343int       get2mass_3star (Stars *star, char *line, int Nmax);
     44
     45int get2mass_3star_full (Stars *star, char *line, int Nmax);
     46char *next2MASSfield (char *line);
     47int set2MASS_ph_qual (Stars *star, char qual);
     48int set2MASS_rd_flag (Stars *star, char qual);
     49int set2MASS_cc_flag (Stars *star, char qual);
     50int set2MASS_bl_flag (Stars *star, char qual);
     51int set2MASS_gal_flag (Stars *star, char qual);
     52int set2MASS_mp_flag (Stars *star, char qual);
     53int set2MASS_dup_flag (Stars *star, char qual);
     54int set2MASS_use_flag (Stars *star, char qual);
  • trunk/Ohana/src/addstar/include/addstar.h

    r15210 r16810  
    5151
    5252enum {M_IMAGE, M_REFLIST, M_REFCAT, M_FAKEIMAGE, M_RESORT};
    53 enum {NONE, SIMPLE_CMP, SIMPLE_CMF, SIMPLE_MEF, MOSAIC_CMP, MOSAIC_CMF, MOSAIC_MEF, MOSAIC_PHU};
     53enum {NONE, SIMPLE_CMP, SIMPLE_CMF, SIMPLE_MEF, MOSAIC_CMP, MOSAIC_CMF, MOSAIC_MEF, MOSAIC_PHU, SDSS_OBJ};
    5454/* note: MEF implies CMF */
    5555
     
    163163Stars     *grefstars              PROTO((char *file, int photcode, int *Nstars));
    164164
    165 Stars     *LoadStars              PROTO((char *file, int *Nstars, Image **images, int *Nimages, int photcode));
     165Stars     *LoadStars              PROTO((char *file, int *Nstars, Image **images, int *Nimages, AddstarClientOptions *options));
    166166Header   **LoadHeaders            PROTO((FILE *f, int *mode, int *Nheader));
    167167HeaderSet *MatchHeaders           PROTO((int **extsize, int *nimage, int mode, Header **headers, int Nheaders));
     
    185185Stars     *ReadStarsFITS          PROTO((FILE *f, Header *header, Header *in_theader, unsigned int *nstars));
    186186Stars     *ReadStarsTEXT          PROTO((FILE *f, unsigned int *nstars));
     187Stars     *ReadStarsSDSS          PROTO((FILE *f, char *name, Header *header, Header *in_theader, Image *images, int *nimages, unsigned int *nstars));
    187188int        ReadImageHeader        PROTO((Header *header, Image *image, int photcode));
    188 Stars     *FilterStars            PROTO((Stars *instars, Image *image));
     189Stars     *FilterStars            PROTO((Stars *instars, Image *image, unsigned int imageID));
    189190Stars     *MergeStars             PROTO((Stars *stars, int *Nstars, Stars *instars, int Ninstars));
    190191void       save_pt_catalog        PROTO((Catalog *catalog));  /*** choose new name ***/
     
    245246int args_skycells (int argc, char **argv);
    246247int ConfigInit_skycells (int *argc, char **argv);
     248int UpdateImageIDs (Stars *stars, int Nstars, Image *images, int Nimages);
     249int LoadDataSDSS (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars, Header **headers, int *extsize, HeaderSet *headerSets, int Nimages);
     250int altaz (double *alt, double *az, double ha, double dec, double latitude);
    247251
    248252// this is a gnu extension?? caution!
  • trunk/Ohana/src/addstar/src/FilterStars.c

    r15514 r16810  
    11# include "addstar.h"
    22
    3 Stars *FilterStars (Stars *instars, Image *image) {
     3Stars *FilterStars (Stars *instars, Image *image, unsigned int imageID) {
    44
    55  int j, N;
     
    6565      stars[N].M += MTIME - dMs;
    6666    }
    67     if (!isnan(stars[N].Mgal)) {
    68       stars[N].Mgal += MTIME - dMs;
    69     }
    7067    if (!isnan(stars[N].Map)) {
    7168      stars[N].Map += MTIME - dMs;
    7269    }
    7370   
     71    // XXX currently, this ID is internal only;
     72    // should we use the psphot / other external ID, if available?
     73    stars[N].detID = N; // sequence number within image
     74    stars[N].imageID = imageID; // does this need to be updated?
     75
    7476    N ++;
    7577  }
  • trunk/Ohana/src/addstar/src/GetFileMode.c

    r10937 r16810  
    1616  gfits_scan (header, "EXTEND", "%t", 1, &extend);
    1717   
     18  {
     19    int tmp, haveCAMCOL, haveSTRIPE;
     20   
     21    // SDSS tsObj files have CAMCOL & STRIP keywords present in the header
     22    haveCAMCOL = gfits_scan (header, "CAMCOL",  "%d", 1, &tmp);
     23    haveSTRIPE = gfits_scan (header, "STRIPE",  "%d", 1, &tmp);
     24    if (haveCAMCOL && haveSTRIPE) return SDSS_OBJ;
     25  }
     26
    1827  if ((Naxis == 2) || TEXTMODE || !simple) {
    1928    if (!strcmp (&ctype[4], "-WRP")) {
  • trunk/Ohana/src/addstar/src/ImageOptions.c

    r15038 r16810  
    44int ImageOptions (AddstarClientOptions *options, Image *images, int Nimages) {
    55
    6   int i, equivPhotcode;
     6  int i, equivPhotcode, consistent;
    77  float maxError;
    88  PhotCode *photcode;
     
    1818
    1919  // check that all images have the same equiv photcode and save it
     20  // XXX this is only used to allow use to calculate an average mag
     21  // if we have mis-matched photcodes, leave this as 0;
     22  options[0].photcode = 0;
    2023  equivPhotcode = 0;
     24  consistent = TRUE;
    2125
    2226  for (i = 0; i < Nimages; i++) {
     
    2832    if (equivPhotcode) {
    2933      if (equivPhotcode != photcode[0].equiv) {
    30         fprintf (stderr, "ERROR: mismatch in equiv photcode values\n");
    31         exit (2);
     34        consistent = FALSE;
     35        break;
    3236      }
    3337    } else {
     
    3539    }
    3640  }
    37   options[0].photcode = equivPhotcode;
     41  if (consistent) {
     42    options[0].photcode = equivPhotcode;
     43  }
    3844
    3945  options[0].imageID = 0;
  • trunk/Ohana/src/addstar/src/LoadStars.c

    r15487 r16810  
    11# include "addstar.h"
    22
    3 Stars *LoadStars (char *filename, int *Nstars, Image **images, int *Nimages, int photcode) {
     3Stars *LoadStars (char *filename, int *Nstars, Image **images, int *Nimages, AddstarClientOptions *options) {
    44
    5   int i, Nfile, Nheaders, NheaderSets, mode, *extsize;
    6   char **file;
     5  int i, Nfile, NFILE, Nheaders, NheaderSets, mode, *extsize;
     6  char **file, line[1024];
    77  FILE *f;
    88  glob_t globList;
     
    1111  HeaderSet *headerSets;
    1212
    13   // parse the filename as a glob
    14   globList.gl_offs = 0;
    15   glob (filename, 0, NULL, &globList);
     13  if (options[0].filelist) {
     14    // read the list of input files from the supplied file
     15    f = fopen (filename, "r");
     16    if (f == NULL) {
     17      fprintf (stderr, "can't read input list %s, giving up\n", filename);
     18      exit (1);
     19    }
    1620
    17   // if the glob does not match, save the literal word:
    18   // otherwise save all glob matches
    19   if (globList.gl_pathc == 0) {
    20     Nfile = 1;
    21     ALLOCATE (file, char *, Nfile);
    22     file[0] = strcreate (filename);
     21    NFILE = 10;
     22    ALLOCATE (file, char *, NFILE);
     23    for (i = 0; (fscanf (f, "%s", line) != EOF); i++) {
     24      // filename limited to 1024 chars
     25      fprintf (stderr, "file: %s\n", line);
     26      file[i] = strcreate (line);
     27      if (i == NFILE - 1) {
     28        NFILE += 10;
     29        REALLOCATE (file, char *, NFILE);
     30      }
     31    }
     32    Nfile = i;
    2333  } else {
    24     Nfile = globList.gl_pathc;
    25     ALLOCATE (file, char *, Nfile);
    26     for (i = 0; i < Nfile; i++) {
    27       file[i] = strcreate (globList.gl_pathv[i]);
     34    // parse the filename as a glob
     35    globList.gl_offs = 0;
     36    glob (filename, 0, NULL, &globList);
     37
     38    // if the glob does not match, save the literal word:
     39    // otherwise save all glob matches
     40    if (globList.gl_pathc == 0) {
     41      Nfile = 1;
     42      ALLOCATE (file, char *, Nfile);
     43      file[0] = strcreate (filename);
     44    } else {
     45      Nfile = globList.gl_pathc;
     46      ALLOCATE (file, char *, Nfile);
     47      for (i = 0; i < Nfile; i++) {
     48        file[i] = strcreate (globList.gl_pathv[i]);
     49      }
    2850    }
    2951  }
     
    5476
    5577    /* supplied photcode is incompatible with multi-chip images */
    56     if ((NheaderSets > 1) && photcode) {
     78    if ((NheaderSets > 1) && options[0].photcode) {
    5779      fprintf (stderr, "ERROR: photcode cannot be supplied to multi-chip images -- manually adjust the headers\n");
    5880      exit (1);
    5981    }
    6082
     83    if (headerSets[0].exttype && !strcmp (headerSets[0].exttype, "SDSS_OBJ")) {
     84      LoadDataSDSS (f, file[i], images, Nimages, &stars, Nstars, headers, extsize, headerSets, NheaderSets);
     85      continue;
     86    }
     87
    6188    LoadData (f, file[i], images, Nimages, &stars, Nstars, headers, extsize, headerSets, NheaderSets);
     89
     90    // XXX add a function to (optionally) load the extended source measurements
     91    # if (0)
     92    if (extSources) {
     93      // not sure how to link the measurements here to the psf measurements above (though there is an ID in the det list)
     94      LoadDataXSRC (f, file[i], images, Nimages, &stars, Nstars, headers, extsize, headerSets, NheaderSets);
     95    }
     96    if (extFits) {
     97      LoadDataXFIT (f, file[i], images, Nimages, &stars, Nstars, headers, extsize, headerSets, NheaderSets);
     98    }
     99    # endif
     100
    62101  }
    63102
     
    73112}
    74113
    75 // load all of the headers, jump in file to skip data segments
    76 Header **LoadHeaders (FILE *f, int *mode, int *Nheaders) {
    77 
    78   int i, status, Nskip, NHEADERS;
    79   Header **headers;
    80 
    81   /* we need to examine the extensions to determine the headers and the data */
    82   NHEADERS = 10;
    83   ALLOCATE (headers, Header *, NHEADERS);
    84 
    85   // load all headers into memory
    86   for (i = 0;; i++) {
    87     ALLOCATE (headers[i], Header, 1);
    88     status = gfits_fread_header (f, headers[i]);
    89     if (!status) {
    90       *Nheaders = i;
    91       return (headers);
    92     }
    93 
    94     // check the mode for this file
    95     if (i == 0) {
    96       *mode = GetFileMode (headers[0]);
    97       if ((*mode == SIMPLE_CMP) || (*mode == MOSAIC_CMP)) {
    98         *Nheaders = i;
    99         return (headers);
    100       }
    101     }
    102 
    103     // advance to the next header
    104     Nskip = gfits_data_size (headers[i]);
    105     fseek (f, Nskip, SEEK_CUR);
    106     if (i == NHEADERS - 1) {
    107       NHEADERS += 10;
    108       REALLOCATE (headers, Header *, NHEADERS);
    109     }
    110   }
    111 }
    112 
    113 HeaderSet *MatchHeaders (int **extsize, int *nimage, int mode, Header **headers, int Nheaders) {
    114 
    115   int i, j, Nimage, NIMAGE;
    116   char extname[80], exttype[80], exthead[80];
    117   HeaderSet *headerSets;
    118 
    119   ALLOCATE (extsize[0], int, Nheaders);
    120 
    121   Nimage = 0;
    122   NIMAGE = 10;
    123   ALLOCATE (headerSets, HeaderSet, NIMAGE);
    124 
    125   // what is the mode of the first header (ie, do we have a PHU DIS image?)
    126   mode = GetFileMode (headers[0]);
    127 
    128   if (mode == MOSAIC_MEF) {
    129     headerSets[Nimage].exthead     = strcreate ("PHU");
    130     headerSets[Nimage].extdata     = strcreate ("NONE");
    131     headerSets[Nimage].extnum_data = -1;
    132     headerSets[Nimage].extnum_head =  0;
    133     Nimage ++;
    134   }
    135 
    136   // now examine the headers, count the table entries, find corresponding headers
    137   for (i = 0; i < Nheaders; i++) {
    138     if (mode == SIMPLE_CMP) {
    139       extsize[0][i] = headers[i][0].size;
    140     } else {
    141       extsize[0][i] = headers[i][0].size + gfits_data_size (headers[i]);
    142     }
    143     gfits_scan (headers[i], "EXTTYPE", "%s", 1, exttype);
    144 
    145     if (!strcmp (exttype, "SMPDATA")) goto keep;
    146     if (!strcmp (exttype, "PS1_DEV_0")) goto keep;
    147     if (!strcmp (exttype, "PS1_DEV_1")) goto keep;
    148     continue;
    149 
    150   keep:
    151     headerSets[Nimage].exttype = strcreate (exttype);
    152 
    153     gfits_scan (headers[i], ExtnameKeyword, "%s", 1, extname);
    154     gfits_scan (headers[i], "EXTHEAD", "%s", 1, exthead);
    155 
    156     headerSets[Nimage].extdata     = strcreate (extname);
    157     headerSets[Nimage].exthead     = strcreate (exthead);
    158     headerSets[Nimage].extnum_data = i;
    159     headerSets[Nimage].extnum_head = -1;
    160 
    161     // find the matching exthead entry
    162     for (j = 0; j < Nheaders; j++) {
    163       if (!gfits_scan (headers[j], ExtnameKeyword, "%s", 1, extname)) continue;
    164       if (strcmp (extname, headerSets[Nimage].exthead)) continue;
    165       headerSets[Nimage].extnum_head = j;
    166       break;
    167     }
    168 
    169     // skip or crash on table with missing matching header?
    170     if (headerSets[Nimage].extnum_head == -1) {
    171       return NULL;
    172     }
    173     Nimage ++;
    174     if (Nimage == NIMAGE) {
    175       NIMAGE += 10;
    176       REALLOCATE (headerSets, HeaderSet, NIMAGE);
    177     }
    178   }
    179 
    180   // some old format files did not write EXTTYPE.  they have a single table in the first
    181   // extension matched to the header in the PHU
    182   if (Nimage == 0) {
    183     extsize[0][0] = headers[0][0].size + gfits_data_size (headers[0]);
    184     extsize[0][1] = headers[1][0].size + gfits_data_size (headers[1]);
    185     gfits_scan (headers[1], ExtnameKeyword, "%s", 1, extname);
    186     if (!strcmp (extname, "SMPFILE")) {
    187       headerSets[Nimage].extdata     = strcreate (extname);
    188       headerSets[Nimage].exttype     = strcreate ("SMPDATA");
    189       headerSets[Nimage].exthead     = strcreate ("PHU");
    190       headerSets[Nimage].extnum_head = 0;
    191       headerSets[Nimage].extnum_data = 1;
    192       Nimage = 1;
    193     }
    194   }
    195  
    196   *nimage = Nimage;
    197   return (headerSets);
    198 }
    199 
    200 // examine the header sets and set the Image entries for the the valid images
    201 int LoadData (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars, Header **headers, int *extsize, HeaderSet *headerSets, int Nimages) {
    202 
    203   char *name;
    204   int i, j, Nvalid, Nhead, Ndata, Nskip;
    205   Stars *inStars;
    206 
    207   if (images[0] == NULL) {
    208     Nvalid = 0;
    209     NVALID = 10;
    210     ALLOCATE (images[0], Image, NVALID);
    211   } else {
    212     Nvalid = *nvalid;
    213     NVALID = Nvalid + 10;
    214     REALLOCATE (images[0], Image, NVALID);
    215   }   
    216 
    217   // find image rootname
    218   name = filebasename (file);
    219 
    220   // now run through the images, interpret the headers and read the stars
    221   for (i = 0; i < Nimages; i++) {
    222     Nhead = headerSets[i].extnum_head;
    223 
    224     if (VERBOSE) fprintf (stderr, "reading header for %s (%s)\n", headerSets[i].exthead, headerSets[i].extdata);
    225     if (!ReadImageHeader (headers[Nhead], &images[0][Nvalid], 0)) {
    226       fprintf (stderr, "skipping %s\n", headerSets[i].exthead);
    227       continue;
    228     }
    229 
    230     // XXX use something to set the chip name? EXTNAME?
    231     if (!strcmp(headerSets[i].exthead, "PHU") && (Nimages == 1)) {
    232       snprintf (images[0][Nvalid].name, 64, "%s", name);
    233     } else {
    234       snprintf (images[0][Nvalid].name, 64, "%s[%s]", name, headerSets[i].exthead);
    235     }
    236 
    237     // skip the table if there is no data segment (eg, mosaic WRP image)
    238     if (!strcmp(headerSets[i].extdata, "NONE")) {
    239       Nvalid++;
    240       if (Nvalid == NVALID) {
    241         NVALID += 10;
    242         REALLOCATE (images[0], Image, NVALID);
    243       }
    244       continue;
    245     }
    246 
    247     // advance the pointer to the start of the corresponding table block
    248     Ndata = headerSets[i].extnum_data;
    249     Nskip = 0;
    250     for (j = 0; j < Ndata; j++) {
    251       Nskip += extsize[j];
    252     }
    253     fseek (f, Nskip, SEEK_SET);
    254          
    255     inStars = ReadStarsFITS (f, headers[Nhead], headers[Ndata], &images[0][Nvalid].nstar);
    256     inStars = FilterStars (inStars, &images[0][Nvalid]);
    257     *stars = MergeStars (*stars, Nstars, inStars, images[0][Nvalid].nstar);
    258     Nvalid++;
    259   }
    260   free (name);
    261   *nvalid = Nvalid;
    262   return (TRUE);
    263 }
    264 
  • trunk/Ohana/src/addstar/src/ReadImageHeader.c

    r15514 r16810  
    88  double tmp, sec, Cerror, ZeroPt;
    99  char *c, photname[64], line[80];
     10
     11  // zero out the entire image structure
     12  memset (image, 0, sizeof(Image));
    1013
    1114  /* get astrometry information */
     
    132135
    133136  tmp = 0;
    134   gfits_scan (header, "TRATE",   "%lf", 1, &tmp);
    135   image[0].trate = 10000 * tmp;
     137  if (gfits_scan (header, "TRATE",   "%lf", 1, &tmp)) {
     138    image[0].trate = 10000 * tmp;
     139  } else {
     140    image[0].trate = 0.0;
     141  }
    136142
    137143  image[0].secz = NAN;
     
    156162  image[0].Xm   = NAN_S_SHORT;
    157163  image[0].code = 0;
    158   memset (image[0].dummy, 0, sizeof(image[0].dummy));
    159164
    160165  /* find expected number of stars */
  • trunk/Ohana/src/addstar/src/ReadStarsFITS.c

    r15514 r16810  
    7272    if ((smpdata[i].M >= ZeroPt) || isnan(smpdata[i].M)) {
    7373      stars[i].M    = NAN;
    74       stars[i].Mgal = NAN;
    7574      stars[i].Map  = NAN;
    7675    } else {
    7776      stars[i].M    = smpdata[i].M;
    78       stars[i].Mgal = smpdata[i].M;
    7977      stars[i].Map  = smpdata[i].M;
    8078    }
     
    122120    stars[i].df      = ps1data[i].df;
    123121
    124     stars[i].psfProb = ps1data[i].psfProb;
    125     stars[i].psfQual = ps1data[i].psfQual;
     122    stars[i].psfChisq = ps1data[i].psfChisq;
     123    stars[i].psfQual  = ps1data[i].psfQual;
    126124
    127125    stars[i].detID   = ps1data[i].detID;
     
    150148    /* these are not used */
    151149    stars[i].Map     = NAN;
    152     stars[i].Mgal    = NAN;
    153150    stars[i].dophot  = 0;
    154151  }   
     
    190187    stars[i].df      = ps1data[i].df;
    191188
    192     stars[i].psfProb   = ps1data[i].psfProb;
     189    stars[i].psfChisq  = ps1data[i].psfChisq;
    193190    stars[i].psfQual   = ps1data[i].psfQual;
    194191    stars[i].crNsigma  = ps1data[i].crNsigma;
     
    225222    /* these are not used */
    226223    stars[i].Map     = NAN;
    227     stars[i].Mgal    = NAN;
    228224    stars[i].dophot  = 0;
    229225  }   
  • trunk/Ohana/src/addstar/src/ReadStarsTEXT.c

    r15509 r16810  
    8080      stars[N].dophot = tmp;
    8181
    82       dparse (&stars[N].Mgal, 7, &buffer[j*BYTES_STAR]);
     82      // XXX I've removed the Mgal field from the measure.d table, and am using Map
     83      // instead.  DVO has not to date been used to track and study objects which are
     84      // extended, but it is about to.  Related to this, I have created the concept of two
     85      // extended source attribute tables, to carry the information being measured by the
     86      // IPP.
     87
     88      // dparse (&stars[N].Mgal, 7, &buffer[j*BYTES_STAR]);
    8389      dparse (&stars[N].Map,  8, &buffer[j*BYTES_STAR]);
    8490      dparse (&stars[N].fx,   9, &buffer[j*BYTES_STAR]);
  • trunk/Ohana/src/addstar/src/SEDfit.c

    r15743 r16810  
    7777
    7878    // load the measurements for this source
    79     m = incat[0].average[i].offset;
     79    m = incat[0].average[i].measureOffset;
    8080    Nphot = 0;
    81     for (j = 0; j < incat[0].average[i].Nm; j++) {
     81    for (j = 0; j < incat[0].average[i].Nmeasure; j++) {
    8282      idx = table[0].hashcode[incat[0].measure[m+j].photcode];
    8383      if (idx == -1) continue;
     
    159159
    160160    // XXX for now, set the average mag data to NULL
    161     outcat[0].average[Nave].Nm        = 0;
    162     outcat[0].average[Nave].Nn        = 0;
    163     outcat[0].average[Nave].Xp        = NAN_S_SHORT;
    164     outcat[0].average[Nave].offset    = Nmeas;
    165     outcat[0].average[Nave].missing  = -1;
    166     outcat[0].average[Nave].code      = 0;
     161    outcat[0].average[Nave].Nmeasure      = 0;
     162    outcat[0].average[Nave].Nmissing      = 0;
     163    outcat[0].average[Nave].Xp            = NAN_S_SHORT;
     164    outcat[0].average[Nave].measureOffset = Nmeas;
     165    outcat[0].average[Nave].missingOffset = -1;
     166    outcat[0].average[Nave].code          = 0;
    167167
    168168    for (j = 0; j < Nsec; j++) {
     
    193193      outcat[0].measure[Nmeas].dt       = 0xffff;
    194194
    195       outcat[0].measure[Nmeas].Mgal     = NAN;
    196195      outcat[0].measure[Nmeas].airmass  = 0;
    197196      outcat[0].measure[Nmeas].FWx      = NAN_S_SHORT;
     
    199198      outcat[0].measure[Nmeas].theta    = NAN_S_SHORT;
    200199
    201       outcat[0].average[Nave].Nm++;
     200      outcat[0].average[Nave].Nmeasure++;
    202201      Nmeas ++;
    203202    }
  • trunk/Ohana/src/addstar/src/addstar.c

    r15743 r16810  
    3737  switch (options.mode) {
    3838    case M_IMAGE:
    39       stars = LoadStars (argv[1], &Nstars, &images, &Nimages, options.photcode);
     39      stars = LoadStars (argv[1], &Nstars, &images, &Nimages, &options);
     40
     41      // set and update the imageID sequence
     42      UpdateImageIDs (stars, Nstars, images, Nimages);
     43
    4044      if ((DUMP != NULL) && !strcmp (DUMP, "rawstars")) dump_rawstars (stars, Nstars);
    4145      for (i = 0; i < Nimages; i++) {
  • trunk/Ohana/src/addstar/src/addstarc.c

    r15036 r16810  
    2121    case M_IMAGE:
    2222      /* load data */
    23       stars = LoadStars (argv[1], &Nstars, &images, &Nimages, options.photcode);
     23      stars = LoadStars (argv[1], &Nstars, &images, &Nimages, &options);
     24
     25      // set and update the imageID sequence
     26      UpdateImageIDs (stars, Nstars, images, Nimages);
    2427
    2528      /* send data to server */
  • trunk/Ohana/src/addstar/src/args.c

    r14590 r16810  
    3737  if ((N = get_argument (argc, argv, "-resort"))) {
    3838    options.mode = M_RESORT;
     39    remove_argument (N, &argc, argv);
     40  }
     41
     42  options.filelist = FALSE;
     43  if ((N = get_argument (argc, argv, "-list"))) {
     44    options.filelist = TRUE;
    3945    remove_argument (N, &argc, argv);
    4046  }
  • trunk/Ohana/src/addstar/src/build_links.c

    r5239 r16810  
    22
    33/* build the initial links assuming the table is sorted,
    4    not partial, and has a correct set of average[].offset,Nm values */
     4   not partial, and has a correct set of average[].measureOffset,Nm values */
    55int *init_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure) {
    66
     
    1212  ALLOCATE (next, int, Nmeasure);
    1313  for (i = 0; i < Naverage; i++, N++) {
    14     for (j = 0; j < average[i].Nm - 1; j++, N++) {
     14    for (j = 0; j < average[i].Nmeasure - 1; j++, N++) {
    1515      next[N] = N + 1;
    1616      if (N >= Nmeasure) {
     
    4141  ALLOCATE (next, int, Nmissing);
    4242  for (i = 0; i < Naverage; i++) {
    43     for (j = 0; j < average[i].Nn - 1; j++, N++) {
     43    for (j = 0; j < average[i].Nmissing - 1; j++, N++) {
    4444      next[N] = N + 1;
    4545    }
    46     if (average[i].Nn > 0) {
     46    if (average[i].Nmissing > 0) {
    4747      next[N] = -1;
    4848      if (N >= Nmissing) {
     
    5757}
    5858
    59 /* average[].offset, average[].Nm are valid within an addstar run */
     59/* average[].measureOffset, average[].Nmeasure are valid within an addstar run */
    6060int add_meas_link (Average *average, int *next, int Nmeasure, int NMEASURE) {
    6161
     
    6363
    6464  /* if we have trouble, check validity of next[m] : m < Nmeasure */
    65   m = average[0].offset; 
    66 
    67   for (k = 0; k < average[0].Nm - 1; k++)  {
     65  m = average[0].measureOffset; 
     66
     67  for (k = 0; k < average[0].Nmeasure - 1; k++)  {
    6868    m = next[m];
    6969    if (m >= NMEASURE) {
     
    7979
    8080  if (m == -1) {
    81     average[0].offset = Nmeasure;
     81    average[0].measureOffset = Nmeasure;
    8282  } else {
    8383    next[m] = Nmeasure;
     
    9595
    9696  /* there may be 0 Nmiss; this is not true for Nmeas */
    97   if (average[0].Nn < 1) {
    98     average[0].missing = Nmissing;
     97  if (average[0].Nmissing < 1) {
     98    average[0].missingOffset = Nmissing;
    9999    next[Nmissing] = -1;
    100100    return (TRUE);
    101101  }
    102102
    103   m = average[0].missing
    104   for (k = 0; k < average[0].Nn - 1; k++) m = next[m];
     103  m = average[0].missingOffset
     104  for (k = 0; k < average[0].Nmissing - 1; k++) m = next[m];
    105105  /* set up references */
    106106  next[Nmissing] = -1;
     
    125125  /* reset the Nm, offset values for average */
    126126  for (i = 0; i < Naverage; i++) {
    127     average[i].offset = -1;
    128     average[i].Nm     =  0;
     127    average[i].measureOffset = -1;
     128    average[i].Nmeasure     =  0;
    129129  }
    130130
    131131  for (Nm = 0; Nm < Nmeasure; Nm++) {
    132132    averef = measure[Nm].averef;
    133     m = average[averef].offset; 
     133    m = average[averef].measureOffset; 
    134134    next[Nm] = -1;
    135135
    136136    if (m == -1) { /* no links yet for source */
    137       average[averef].offset = Nm;
    138       average[averef].Nm     = 1;
     137      average[averef].measureOffset = Nm;
     138      average[averef].Nmeasure     = 1;
    139139      continue;
    140140    }
     
    147147    }
    148148
    149     average[averef].Nm = k + 2;
     149    average[averef].Nmeasure = k + 2;
    150150    next[m] = Nm;
    151151    if (m >= Nmeasure) {
     
    168168  ALLOCATE (tmpmeasure, Measure, Nmeasure);
    169169  for (i = 0; i < Naverage; i++) {
    170     n = average[i].offset;
    171     average[i].offset = N;
    172     for (k = 0; k < average[i].Nm; k++, N++) {
     170    n = average[i].measureOffset;
     171    average[i].measureOffset = N;
     172    for (k = 0; k < average[i].Nmeasure; k++, N++) {
    173173      tmpmeasure[N] = measure[n];
    174174      tmpmeasure[N].averef = i;
     
    189189  ALLOCATE (tmpmissing, Missing, Nmissing);
    190190  for (i = 0; i < Naverage; i++) {
    191     n = average[i].missing;
    192     average[i].missing = N;
    193     for (k = 0; k < average[i].Nn; k++, N++) {
     191    n = average[i].missingOffset;
     192    average[i].missingOffset = N;
     193    for (k = 0; k < average[i].Nmissing; k++, N++) {
    194194      tmpmissing[N] = missing[n];
    195195      n = next[n];
  • trunk/Ohana/src/addstar/src/calibrate.c

    r16040 r16810  
    9797  }
    9898
    99   m = average[0].offset;
    100   for (i = 0; i < average[0].Nm; i++) {
     99  m = average[0].measureOffset;
     100  for (i = 0; i < average[0].Nmeasure; i++) {
    101101    if (measure[m].photcode == CalC0) {
    102102      found0 = TRUE;
  • trunk/Ohana/src/addstar/src/fakeimage.c

    r15509 r16810  
    130130    image[i+1].Xm   = NAN_S_SHORT;
    131131    image[i+1].code = 0;
    132     memset (image[i+1].dummy, 0, sizeof(image[i+1].dummy));
    133132
    134133    image[i+1].nstar = 0;
     
    189188  image[0].Xm   = NAN_S_SHORT;
    190189  image[0].code = 0;
    191   memset (image[0].dummy, 0, sizeof(image[0].dummy));
    192190  image[0].nstar = 0;
    193191  image[0].Myyyy = 0;
     192
     193  // XXX need to set the imageID here
    194194
    195195  *Nimage = Nchips + 1;
  • trunk/Ohana/src/addstar/src/find_matches.c

    r16040 r16810  
    1010  int Nave, NAVE, Nmeas, NMEAS, Nmatch;
    1111  int Nsecfilt, Nsec;
     12  unsigned int objID, catID;
    1213  Coords tcoords;
    1314
     
    3738  NMEAS = Nmeas = catalog[0].Nmeasure;
    3839 
     40  // current max obj ID for this catalog
     41  objID = catalog[0].objID;
     42  catID = catalog[0].catID;
     43
    3944  /* project onto rectilinear grid with 1 arcsec pixels. the choice of ZEA projection has the
    4045   * advantage that every point in R,D has a mapping to a unique X,Y.  However, note that not all
     
    179184      catalog[0].measure[Nmeas].photFlags = stars[N].flags;
    180185      catalog[0].measure[Nmeas].qPSF      = stars[N].psfQual;
    181       catalog[0].measure[Nmeas].psfProb   = stars[N].psfProb;
     186      catalog[0].measure[Nmeas].psfChisq  = stars[N].psfChisq;
    182187      catalog[0].measure[Nmeas].crNsigma  = stars[N].crNsigma;
    183188      catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma;
     
    193198      catalog[0].measure[Nmeas].dYccd     = stars[N].dY;
    194199
    195       catalog[0].measure[Nmeas].Mgal     = stars[N].Mgal;
     200      catalog[0].measure[Nmeas].Map      = stars[N].Map;
    196201      catalog[0].measure[Nmeas].FWx      = 100*stars[N].fx;
    197202      catalog[0].measure[Nmeas].FWy      = 100*stars[N].fy;
     
    233238      /* Nm is updated, but not written out in -update mode (for existing entries)
    234239         Nm is recalculated in build_meas_links if loaded table is not sorted */
    235       catalog[0].average[n].Nm ++;
     240      catalog[0].average[n].Nmeasure ++;
    236241      Nmeas ++;
    237242
     
    263268    if (!IN_REGION (stars[N].R, stars[N].D)) continue;
    264269
    265     catalog[0].average[Nave].R         = stars[N].R;
    266     catalog[0].average[Nave].D         = stars[N].D;
    267     catalog[0].average[Nave].Xp        = 0;
    268     catalog[0].average[Nave].Nm        = 1;
    269     catalog[0].average[Nave].N      = 0;
    270     catalog[0].average[Nave].offset    = Nmeas;
    271     catalog[0].average[Nave].missing  = -1;
    272     catalog[0].average[Nave].code      = 0;
     270    catalog[0].average[Nave].R             = stars[N].R;
     271    catalog[0].average[Nave].D             = stars[N].D;
     272    catalog[0].average[Nave].Xp            = 0;
     273    catalog[0].average[Nave].Nmeasure      = 1;
     274    catalog[0].average[Nave].Nmissing      = 0;
     275    catalog[0].average[Nave].measureOffset = Nmeas;
     276    catalog[0].average[Nave].missingOffset = -1;
     277    catalog[0].average[Nave].code          = 0;
    273278
    274279    catalog[0].average[Nave].dR        = 0;
     
    280285    catalog[0].average[Nave].P         = 0;
    281286    catalog[0].average[Nave].dP        = 0;
     287
     288    catalog[0].average[Nave].objID     = objID;
     289    catalog[0].average[Nave].catID     = catID;
     290    objID ++;
    282291
    283292    for (j = 0; j < Nsecfilt; j++) {
     
    305314    catalog[0].measure[Nmeas].photFlags = stars[N].flags;
    306315    catalog[0].measure[Nmeas].qPSF      = stars[N].psfQual;
    307     catalog[0].measure[Nmeas].psfProb   = stars[N].psfProb;
     316    catalog[0].measure[Nmeas].psfChisq  = stars[N].psfChisq;
    308317    catalog[0].measure[Nmeas].crNsigma  = stars[N].crNsigma;
    309318    catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma;
     
    314323
    315324    catalog[0].measure[Nmeas].detID     = stars[N].detID;
    316     catalog[0].measure[Nmeas].imageID   = options.imageID;
     325    catalog[0].measure[Nmeas].imageID   = stars[N].imageID;
    317326
    318327    catalog[0].measure[Nmeas].dXccd     = stars[N].dX;
    319328    catalog[0].measure[Nmeas].dYccd     = stars[N].dY;
    320329
    321     catalog[0].measure[Nmeas].Mgal      = stars[N].Mgal;
     330    catalog[0].measure[Nmeas].Map       = stars[N].Map;
    322331    catalog[0].measure[Nmeas].FWx       = 100*stars[N].fx;
    323332    catalog[0].measure[Nmeas].FWy       = 100*stars[N].fy;
     
    359368
    360369  /* check if the catalog has changed?  if no change, no need to write */
     370  catalog[0].objID    = objID; // new max value, save on catalog close
    361371  catalog[0].Naverage = Nave;
    362372  catalog[0].Nmeasure = Nmeas;
  • trunk/Ohana/src/addstar/src/find_matches_closest.c

    r16040 r16810  
    99  int *N1, *N2,  *next_meas, *next_miss;
    1010  int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch;
     11  int Nsecfilt, Nsec;
     12  unsigned int objID, catID;
    1113  Coords tcoords;
    12   int Nsecfilt, Nsec;
    1314
    1415  /* photcode data - must by of type DEP; options.photcode is equiv photcode for all input
     
    3738  NMEAS = Nmeas = catalog[0].Nmeasure;
    3839  NMISS = Nmiss = catalog[0].Nmissing;
     40
     41  // current max obj ID for this catalog
     42  objID = catalog[0].objID;
     43  catID = catalog[0].catID;
    3944
    4045  /* project onto rectilinear grid with 1 arcsec pixels. the choice of ZEA projection has the
     
    199204    catalog[0].measure[Nmeas].photFlags = stars[N].flags;
    200205    catalog[0].measure[Nmeas].qPSF      = stars[N].psfQual;
    201     catalog[0].measure[Nmeas].psfProb   = stars[N].psfProb;
     206    catalog[0].measure[Nmeas].psfChisq  = stars[N].psfChisq;
    202207    catalog[0].measure[Nmeas].crNsigma  = stars[N].crNsigma;
    203208    catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma;
     
    213218    catalog[0].measure[Nmeas].dYccd     = stars[N].dY;
    214219
    215     catalog[0].measure[Nmeas].Mgal     = stars[N].Mgal;
     220    catalog[0].measure[Nmeas].Map       = stars[N].Map;
    216221
    217222    // XXX saturate range for FWx, FWy, theta
     
    241246    stars[N].found = Nmeas;
    242247    catalog[0].found[n] = Nmeas;
    243     catalog[0].average[n].Nm ++;
     248    catalog[0].average[n].Nmeasure ++;
    244249    Nmeas ++;
    245250    i++;
     
    265270    if (!IN_REGION (stars[N].R, stars[N].D)) continue;
    266271
    267     catalog[0].average[Nave].R         = stars[N].R;
    268     catalog[0].average[Nave].D         = stars[N].D;
    269     catalog[0].average[Nave].Xp        = 0;
    270     catalog[0].average[Nave].Nm        = 1;
    271     catalog[0].average[Nave].Nn        = 0;
    272     catalog[0].average[Nave].offset    = Nmeas;
    273     catalog[0].average[Nave].missing  = -1;
    274     catalog[0].average[Nave].code      = 0;
     272    catalog[0].average[Nave].R             = stars[N].R;
     273    catalog[0].average[Nave].D             = stars[N].D;
     274    catalog[0].average[Nave].Xp            = 0;
     275    catalog[0].average[Nave].Nmeasure      = 1;
     276    catalog[0].average[Nave].Nmissing      = 0;
     277    catalog[0].average[Nave].measureOffset = Nmeas;
     278    catalog[0].average[Nave].missingOffset = -1;
     279    catalog[0].average[Nave].code          = 0;
    275280
    276281    catalog[0].average[Nave].dR        = 0;
     
    282287    catalog[0].average[Nave].P         = 0;
    283288    catalog[0].average[Nave].dP        = 0;
     289
     290    catalog[0].average[Nave].objID     = objID;
     291    catalog[0].average[Nave].catID     = catID;
     292    objID ++;
    284293
    285294    for (j = 0; j < Nsecfilt; j++) {
     
    307316    catalog[0].measure[Nmeas].photFlags = stars[N].flags;
    308317    catalog[0].measure[Nmeas].qPSF      = stars[N].psfQual;
    309     catalog[0].measure[Nmeas].psfProb   = stars[N].psfProb;
     318    catalog[0].measure[Nmeas].psfChisq  = stars[N].psfChisq;
    310319    catalog[0].measure[Nmeas].crNsigma  = stars[N].crNsigma;
    311320    catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma;
     
    321330    catalog[0].measure[Nmeas].dYccd     = stars[N].dY;
    322331
    323     catalog[0].measure[Nmeas].Mgal     = stars[N].Mgal;
     332    catalog[0].measure[Nmeas].Map      = stars[N].Map;
    324333    catalog[0].measure[Nmeas].FWx      = 100*stars[N].fx;
    325334    catalog[0].measure[Nmeas].FWy      = 100*stars[N].fy;
     
    360369
    361370  /* check if the catalog has changed?  if no change, no need to write */
     371  catalog[0].objID    = objID; // new max value, save on catalog close
    362372  catalog[0].Naverage = Nave;
    363373  catalog[0].Nmeasure = Nmeas;
  • trunk/Ohana/src/addstar/src/find_matches_refstars.c

    r16040 r16810  
    99  int *N1, *N2,  *next, *next_miss, last, last_miss;
    1010  int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch;
     11  unsigned int objID, catID;
    1112  Measure *tmpmeasure;
    1213  Missing *tmpmissing;
     
    4748  REALLOCATE (catalog[0].missing, Missing, NMISS);
    4849 
     50  // current max obj ID for this catalog
     51  objID = catalog[0].objID;
     52  catID = catalog[0].catID;
     53
    4954  /* project onto rectilinear grid with 1 arcsec pixels, sort by X */
    5055  /* reference for coords is catalog center */
     
    115120      n = N2[J];
    116121      N = N1[i];
    117       m = catalog[0].average[n].offset; 
     122      m = catalog[0].average[n].measureOffset; 
    118123
    119124      /** in replace mode, search for entry and replace values M, dM, R, D */
     
    122127      /** insert star in measurement list */
    123128      /* find last measurement of this star */
    124       for (k = 0; k < catalog[0].average[n].Nm - 1; k++) m = next[m];
     129      for (k = 0; k < catalog[0].average[n].Nmeasure - 1; k++) m = next[m];
    125130      /* set up references */
    126131      next[Nmeas] = next[m];
     
    143148      catalog[0].measure[Nmeas].dt       = 0xffff;
    144149
    145       catalog[0].measure[Nmeas].Mgal     = NAN;
     150      catalog[0].measure[Nmeas].Map      = NAN;
    146151      catalog[0].measure[Nmeas].airmass  = 0;
    147152      catalog[0].measure[Nmeas].FWx      = NAN_S_SHORT;
     
    151156      catalog[0].measure[Nmeas].photFlags = 0;
    152157      catalog[0].measure[Nmeas].qPSF      = 0;
    153       catalog[0].measure[Nmeas].psfProb   = 0;
     158      catalog[0].measure[Nmeas].psfChisq  = 0;
    154159      catalog[0].measure[Nmeas].crNsigma  = 0;
    155160      catalog[0].measure[Nmeas].extNsigma = 0;
     
    199204      }
    200205
    201       catalog[0].average[n].Nm ++;
     206      catalog[0].average[n].Nmeasure ++;
    202207      Nmeas ++;
    203208      if (Nmeas == NMEAS) {
     
    224229    if (stars[N][0].found >= 0) continue;
    225230
    226     catalog[0].average[Nave].R         = stars[N][0].R;
    227     catalog[0].average[Nave].D         = stars[N][0].D;
    228     catalog[0].average[Nave].Xp        = 0;
    229     catalog[0].average[Nave].Nm        = 1;
    230     catalog[0].average[Nave].N      = 0;
    231     catalog[0].average[Nave].offset    = Nmeas;
    232     catalog[0].average[Nave].missing  = -1;
    233     catalog[0].average[Nave].code      = 0;
     231    catalog[0].average[Nave].R             = stars[N][0].R;
     232    catalog[0].average[Nave].D             = stars[N][0].D;
     233    catalog[0].average[Nave].Xp            = 0;
     234    catalog[0].average[Nave].Nmeasure      = 1;
     235    catalog[0].average[Nave].Nmissing      = 0;
     236    catalog[0].average[Nave].measureOffset = Nmeas;
     237    catalog[0].average[Nave].missingOffset = -1;
     238    catalog[0].average[Nave].code          = 0;
    234239
    235240    if (ACCEPT_MOTION) {
     
    253258    }
    254259
     260    catalog[0].average[Nave].objID     = objID;
     261    catalog[0].average[Nave].catID     = catID;
     262    objID ++;
     263
    255264    for (j = 0; j < Nsecfilt; j++) {
    256265      catalog[0].secfilt[Nave*Nsecfilt+j].M  = NAN;
     
    273282    catalog[0].measure[Nmeas].photFlags = 0;
    274283    catalog[0].measure[Nmeas].qPSF      = 0;
    275     catalog[0].measure[Nmeas].psfProb   = 0;
     284    catalog[0].measure[Nmeas].psfChisq  = 0;
    276285    catalog[0].measure[Nmeas].crNsigma  = 0;
    277286    catalog[0].measure[Nmeas].extNsigma = 0;
     
    291300
    292301    catalog[0].measure[Nmeas].airmass  = 0;
    293     catalog[0].measure[Nmeas].Mgal     = NAN;
     302    catalog[0].measure[Nmeas].Map      = NAN;
    294303    catalog[0].measure[Nmeas].FWx      = NAN_S_SHORT;
    295304    catalog[0].measure[Nmeas].FWy      = NAN_S_SHORT;
     
    324333  ALLOCATE (tmpmeasure, Measure, Nmeas);
    325334  for (i = 0; i < Nave; i++) {
    326     n = catalog[0].average[i].offset;
    327     catalog[0].average[i].offset = N;
    328     for (k = 0; k < catalog[0].average[i].Nm; k++, N++) {
     335    n = catalog[0].average[i].measureOffset;
     336    catalog[0].average[i].measureOffset = N;
     337    for (k = 0; k < catalog[0].average[i].Nmeasure; k++, N++) {
    329338      tmpmeasure[N] = catalog[0].measure[n];
    330339      tmpmeasure[N].averef = i;
     
    339348  ALLOCATE (tmpmissing, Missing, Nmiss);
    340349  for (i = 0; i < Nave; i++) {
    341     if (catalog[0].average[i].Nn > 0) {
    342       n = catalog[0].average[i].missing;
    343       catalog[0].average[i].missing = N;
    344       for (k = 0; k < catalog[0].average[i].Nn; k++, N++) {
     350    if (catalog[0].average[i].Nmissing > 0) {
     351      n = catalog[0].average[i].missingOffset;
     352      catalog[0].average[i].missingOffset = N;
     353      for (k = 0; k < catalog[0].average[i].Nmissing; k++, N++) {
    345354        tmpmissing[N] = catalog[0].missing[n];
    346355        n = next_miss[n];
     
    369378  free (next_miss);
    370379
     380  catalog[0].objID    = objID; // new max value, save on catalog close
    371381  catalog[0].Naverage = Nave;
    372382  catalog[0].Nmeasure = Nmeas;
  • trunk/Ohana/src/addstar/src/get2mass_dr2.c

    r7394 r16810  
    6262      stars[Nstars].t     = short_date_to_sec (&buffer[NBYTE*i + 164]);
    6363      stars[Nstars].found = -1;
     64      stars[Nstars].detID   = 0;
     65      stars[Nstars].imageID = 0;
    6466
    6567      if (photcode == TM_J) {
  • trunk/Ohana/src/addstar/src/get2mass_ops.c

    r14590 r16810  
    5757  }
    5858
    59   star[0].M     = M;
    60   star[0].dM    = dM;
    61   star[0].code  = Photcode;
    62   star[0].t     = time;
    63   star[0].found = -1;
     59  star[0].M       = M;
     60  star[0].dM      = dM;
     61  star[0].code    = Photcode;
     62  star[0].t       = time;
     63  star[0].found   = -1;
     64  star[0].detID   = 0;
     65  star[0].imageID = 0;
    6466
    6567  return TRUE;
     
    103105  }
    104106
     107  // how many bits are being used for the 2mass flags; can we just set photFlags based on them?
     108
    105109  star[0].M     = J;
    106110  star[0].dM    = dJ;
     
    108112  star[0].t     = time;
    109113  star[0].found = -1;
     114  star[0].detID   = 0;
     115  star[0].imageID = 0;
    110116
    111117  star[1].M     = H;
     
    114120  star[1].t     = time;
    115121  star[1].found = -1;
     122  star[1].detID   = 0;
     123  star[1].imageID = 0;
    116124
    117125  star[2].M     = K;
     
    120128  star[2].t     = time;
    121129  star[2].found = -1;
     130  star[2].detID   = 0;
     131  star[2].imageID = 0;
    122132
    123133  return TRUE;
  • trunk/Ohana/src/addstar/src/getgsc.c

    r15514 r16810  
    7575      stars[Nstars].code  = GSC_M;
    7676      stars[Nstars].found = -1;
     77
     78      stars[Nstars].detID   = 0;
     79      stars[Nstars].imageID = 0;
     80
    7781      Nstars ++;
    7882      CHECK_REALLOCATE (stars, Stars, NSTARS, Nstars, 1000);
  • trunk/Ohana/src/addstar/src/gettycho.c

    r14590 r16810  
    9696        stars[Ntycho].dP  = 0;
    9797
     98        stars[Ntycho].detID   = 0;
     99        stars[Ntycho].imageID = 0;
     100
    98101        /* Tycho uses J2000 equinox and 1991.25 epoch for coordinates */
    99102        /* the magnitudes have no temporal information */
  • trunk/Ohana/src/addstar/src/getusno.c

    r15514 r16810  
    117117      stars[Nusno].found = -1;
    118118
     119      stars[Nusno].detID   = 0;
     120      stars[Nusno].imageID = 0;
     121
    119122      /* one pass of addstar does either r or b */
    120123      if (photcode == USNO_RED) {
  • trunk/Ohana/src/addstar/src/getusnob.c

    r15036 r16810  
    141141      stars[Nusno].found = -1;
    142142     
     143      stars[Nusno].detID   = 0;
     144      stars[Nusno].imageID = 0;
     145
    143146      /* USNO-B uses J2000 equinox and 2000.0 epoch for coordinates */
    144147      /* the magnitudes have no temporal information */
  • trunk/Ohana/src/addstar/src/grefstars.c

    r8361 r16810  
    3030    stars[N].code = photcode;
    3131    stars[N].found = FALSE;
     32    stars[N].detID   = 0;
     33    stars[N].imageID = 0;
    3234    CHECK_REALLOCATE (stars, Stars, NSTARS, N+1, 100);
    3335  }
  • trunk/Ohana/src/addstar/src/load2mass_as_rawdata.c

    r14401 r16810  
    135135        stars[Nstars+2].R = tstars[j].R;
    136136        stars[Nstars+2].D = tstars[j].D;
    137         get2mass_3star (&stars[Nstars], &buffer[offset], Nbyte - offset);
     137        get2mass_3star_full (&stars[Nstars], &buffer[offset], Nbyte - offset);
    138138        // get2mass_star (&stars[Nstars], &buffer[offset], Nbyte - offset);
    139139
     
    165165
    166166        // an error exit status here is a significant error
    167         if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) {
     167        if (!dvo_catalog_open (&catalog, skylist[0].regions[0], VERBOSE, "w")) {
    168168          fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", catalog.filename);
    169169          exit (2);
  • trunk/Ohana/src/addstar/src/load2mass_catalog.c

    r15743 r16810  
    3232
    3333    // XXX for now, set the average mag data to NULL
    34     catalog[0].average[Nave].Nm        = 0;
    35     catalog[0].average[Nave].Nn        = 0;
    36     catalog[0].average[Nave].Xp        = NAN_S_SHORT;
    37     catalog[0].average[Nave].offset    = Nmeas;
    38     catalog[0].average[Nave].missing  = -1;
    39     catalog[0].average[Nave].code      = 0;
     34    catalog[0].average[Nave].Nmeasure      = 0;
     35    catalog[0].average[Nave].Nmissing      = 0;
     36    catalog[0].average[Nave].Xp            = NAN_S_SHORT;
     37    catalog[0].average[Nave].measureOffset = Nmeas;
     38    catalog[0].average[Nave].missingOffset = -1;
     39    catalog[0].average[Nave].code          = 0;
    4040
    4141    for (j = 0; j < Nsec; j++) {
     
    4747    // we now have the min chisq row. use this to supply the other filter values....
    4848    for (j = 0; j < 3; j++) {
    49       catalog[0].measure[Nmeas].dR       = 0.0;
    50       catalog[0].measure[Nmeas].dD       = 0.0;
    51       catalog[0].measure[Nmeas].M        = stars[i+j].M;
    52       catalog[0].measure[Nmeas].dM       = stars[i+j].dM;
    53       catalog[0].measure[Nmeas].Mcal     = 0;
    54       catalog[0].measure[Nmeas].t        = stars[i+j].t;
    55       catalog[0].measure[Nmeas].averef   = Nave;
    56       catalog[0].measure[Nmeas].photcode = stars[i+j].code;
    57       catalog[0].measure[Nmeas].dophot   = 0;
    58       catalog[0].measure[Nmeas].dbFlags  = 0;
    59       catalog[0].measure[Nmeas].dt       = 0xffff;
     49      catalog[0].measure[Nmeas].dR        = 0.0;
     50      catalog[0].measure[Nmeas].dD        = 0.0;
     51      catalog[0].measure[Nmeas].Xccd      = stars[i+j].X;
     52      catalog[0].measure[Nmeas].Yccd      = stars[i+j].Y;
     53      catalog[0].measure[Nmeas].dXccd     = 0.0;
     54      catalog[0].measure[Nmeas].dYccd     = 0.0;
     55      catalog[0].measure[Nmeas].M         = stars[i+j].M;
     56      catalog[0].measure[Nmeas].dM        = stars[i+j].dM;
     57      catalog[0].measure[Nmeas].Mcal      = 0;
     58      catalog[0].measure[Nmeas].dMcal     = stars[i+j].dMcal;
     59      catalog[0].measure[Nmeas].t         = stars[i+j].t;
     60      catalog[0].measure[Nmeas].averef    = Nave;
     61      catalog[0].measure[Nmeas].photcode  = stars[i+j].code;
     62      catalog[0].measure[Nmeas].dophot    = 0;
     63      catalog[0].measure[Nmeas].photFlags = stars[i+j].flags;
     64      catalog[0].measure[Nmeas].dbFlags   = 0;
     65      catalog[0].measure[Nmeas].dt        = 0xffff;
     66                                         
     67      catalog[0].measure[Nmeas].airmass   = 0;
     68      catalog[0].measure[Nmeas].FWx       = stars[i+j].fx;
     69      catalog[0].measure[Nmeas].FWy       = stars[i+j].fy;
     70      catalog[0].measure[Nmeas].theta     = stars[i+j].df;
    6071
    61       catalog[0].measure[Nmeas].Mgal     = NAN;
    62       catalog[0].measure[Nmeas].airmass  = 0;
    63       catalog[0].measure[Nmeas].FWx      = NAN_S_SHORT;
    64       catalog[0].measure[Nmeas].FWy      = NAN_S_SHORT;
    65       catalog[0].measure[Nmeas].theta    = NAN_S_SHORT;
    66 
    67       catalog[0].average[Nave].Nm++;
     72      catalog[0].average[Nave].Nmeasure++;
    6873      Nmeas ++;
    6974      CHECK_REALLOCATE (catalog[0].measure, Measure, NMEAS, Nmeas, 100);
  • trunk/Ohana/src/addstar/src/replace_match.c

    r15509 r16810  
    66
    77  /* search for entry and replace values M, dM, R, D */
    8   for (i = 0; i < average[0].Nm; i++) {
     8  for (i = 0; i < average[0].Nmeasure; i++) {
    99    if (measure[i].photcode != star[0].code) continue;
    1010    measure[i].dR = 3600.0*(average[0].R - star[0].R);
     
    1212    measure[i].M  = star[0].M;
    1313    measure[i].dM = star[0].dM;
    14     star[0].found = average[0].offset + i;
     14    star[0].found = average[0].measureOffset + i;
    1515    return (TRUE);
    1616  }
  • trunk/Ohana/src/addstar/src/update_coords.c

    r12332 r16810  
    1010  Npt = r = d = r2 = d2 = 0;
    1111
    12   if (average[0].Nm < 2) return;
     12  if (average[0].Nmeasure < 2) return;
    1313
    1414  /* find the average & sum-square (does not use reference coordinates) */
    15   m = average[0].offset;  /* first measurement of this star */
    16   for (i = 0; i < average[0].Nm; i++) {
     15  m = average[0].measureOffset;  /* first measurement of this star */
     16  for (i = 0; i < average[0].Nmeasure; i++) {
    1717    if (measure[m].t == 0) {
    1818      m = next[m];
     
    3535  average[0].R -= r / 3600.0;
    3636  average[0].D -= d / 3600.0;
    37   m = average[0].offset;  /* first measurement of this star */
    38   for (i = 0; i < average[0].Nm; i++) {
     37  m = average[0].measureOffset;  /* first measurement of this star */
     38  for (i = 0; i < average[0].Nmeasure; i++) {
    3939    measure[m].dR -= r;
    4040    measure[m].dD -= d;
  • trunk/Ohana/src/delstar/src/find_image_db.c

    r12332 r16810  
    4444  image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped);
    4545
    46   start = timage[0].tzero - MAX(0.05*timage[0].trate*timage[0].NY, 1);
    47   stop  = timage[0].tzero + MAX(1.05*timage[0].trate*timage[0].NY, 1);
     46  start = timage[0].tzero - MAX(0.01*timage[0].trate*timage[0].NY, 1);
     47  stop  = timage[0].tzero + MAX(1.01*timage[0].trate*timage[0].NY, 1);
    4848  code  = timage[0].photcode;
    4949
  • trunk/Ohana/src/delstar/src/find_matches.c

    r15743 r16810  
    3737  /* set up references for missing to average */
    3838  for (i = 0; i < Nave; i++) {
    39     for (j = 0; j < catalog[0].average[i].Nn; j++) {
    40       ave_miss[catalog[0].average[i].missing + j] = i;
     39    for (j = 0; j < catalog[0].average[i].Nmissing; j++) {
     40      ave_miss[catalog[0].average[i].missingOffset + j] = i;
    4141    }
    4242  }
     
    8888    /*** fix the corresponding average entry ***/
    8989    n = catalog[0].measure[i].averef;
    90     if (catalog[0].average[n].Nm == 0) { /* this should never happen */
     90    if (catalog[0].average[n].Nmeasure == 0) { /* this should never happen */
    9191      fprintf (stderr, "error? we deleted one too many objects?\n");
    9292      exit (1);
    9393    }
    94     catalog[0].average[n].Nm --;
     94    catalog[0].average[n].Nmeasure --;
    9595    /* this was only entry in list: will be deleted below.  meanwhile, delete all missing entries*/
    96     if ((catalog[0].average[n].Nm < 1) && (catalog[0].average[n].Nn > 0)) {
    97       m = catalog[0].average[n].missing;
    98       for (j = 0; j < catalog[0].average[n].Nn; j++) {
     96    if ((catalog[0].average[n].Nmeasure < 1) && (catalog[0].average[n].Nmissing > 0)) {
     97      m = catalog[0].average[n].missingOffset;
     98      for (j = 0; j < catalog[0].average[n].Nmissing; j++) {
    9999        M = next_miss[m];
    100100        next_miss[m] = -2;
    101101        m = M;
    102102      }
    103       m = catalog[0].average[n].missing;
     103      m = catalog[0].average[n].missingOffset;
    104104      /* fix the list links: connect the previous valid link to the next valid link */
    105105      for (j = m; (j >= 0) && (next_miss[j] == -2); j--); /* find previous entry to fix link */
     
    119119    }
    120120    /* this was first entry in list */
    121     if ((catalog[0].average[n].offset == i) && (catalog[0].average[n].Nm > 0)) {
    122       m = catalog[0].average[n].offset;
     121    if ((catalog[0].average[n].measureOffset == i) && (catalog[0].average[n].Nmeasure > 0)) {
     122      m = catalog[0].average[n].measureOffset;
    123123      /* find next valid entry -- notice lack of error checking... */
    124124      for (j = 0; (j < Nmeas) && (next[m+j] == -2); j++);
    125       catalog[0].average[n].offset = m + j;
     125      catalog[0].average[n].measureOffset = m + j;
    126126    }
    127127  }
     
    154154    /*** fix the corresponding average entry ***/
    155155    n = ave_miss[i];
    156     if (catalog[0].average[n].Nn == 0) { /* this should never happen */
     156    if (catalog[0].average[n].Nmissing == 0) { /* this should never happen */
    157157      fprintf (stderr, "error? we deleted one too many missing?\n");
    158158      exit (1);
    159159    }
    160     catalog[0].average[n].Nn --;
     160    catalog[0].average[n].Nmissing --;
    161161    /* this was first entry in list */
    162     if ((catalog[0].average[n].missing == i) && (catalog[0].average[n].Nn > 0)) {
    163       m = catalog[0].average[n].missing;
     162    if ((catalog[0].average[n].missingOffset == i) && (catalog[0].average[n].Nmissing > 0)) {
     163      m = catalog[0].average[n].missingOffset;
    164164      for (j = 0; (j < Nmiss) && (next_miss[m+j] == -2); j++);
    165       catalog[0].average[n].missing = m + j;
     165      catalog[0].average[n].missingOffset = m + j;
    166166    }
    167167  }
     
    172172  /* fix Average list: delete entries with Nm == 0 */
    173173  for (i = j = 0; (i < Nave) && (j < Nave); i++, j++) {
    174     for (; (j < Nave) && (catalog[0].average[j].Nm == 0); j++);
     174    for (; (j < Nave) && (catalog[0].average[j].Nmeasure == 0); j++);
    175175    if ((i != j) && (j < Nave)) {
    176176      catalog[0].average[i] = catalog[0].average[j];
     
    189189  ALLOCATE (tmpmeasure, Measure, Nmeas);
    190190  for (i = 0; i < Nave; i++) {
    191     n = catalog[0].average[i].offset;
    192     catalog[0].average[i].offset = N;
    193     for (k = 0; k < catalog[0].average[i].Nm; k++, N++) {
     191    n = catalog[0].average[i].measureOffset;
     192    catalog[0].average[i].measureOffset = N;
     193    for (k = 0; k < catalog[0].average[i].Nmeasure; k++, N++) {
    194194      if ((n == -1) || (n == -2)) {
    195195        fprintf (stderr, "error: linked list is confused\n");
     
    211211  ALLOCATE (tmpmissing, Missing, Nmiss);
    212212  for (i = 0; i < Nave; i++) {
    213     if (catalog[0].average[i].Nn > 0) {
    214       n = catalog[0].average[i].missing;
    215       catalog[0].average[i].missing = N;
    216       for (k = 0; k < catalog[0].average[i].Nn; k++, N++) {
     213    if (catalog[0].average[i].Nmissing > 0) {
     214      n = catalog[0].average[i].missingOffset;
     215      catalog[0].average[i].missingOffset = N;
     216      for (k = 0; k < catalog[0].average[i].Nmissing; k++, N++) {
    217217        if ((n == -1) || (n == -2)) {
    218218          fprintf (stderr, "error: linked list is confused\n");
  • trunk/Ohana/src/delstar/src/match_images.c

    r4680 r16810  
    1616  ALLOCATE (stop,  unsigned int, Nimage);
    1717  for (j = 0; j < Nimage; j++) {
    18     start[j] = image[j].tzero - MAX(0.05*image[j].trate*image[j].NY, 1);
    19     stop[j]  = image[j].tzero + MAX(1.05*image[j].trate*image[j].NY, 1);
     18    start[j] = image[j].tzero - MAX(0.01*image[j].trate*image[j].NY, 1);
     19    stop[j]  = image[j].tzero + MAX(1.01*image[j].trate*image[j].NY, 1);
    2020  }
    2121
  • trunk/Ohana/src/fixcat/src/match_images.c

    r2490 r16810  
    2020  ALLOCATE (stop,  unsigned int, Nimage);
    2121  for (j = 0; j < Nimage; j++) {
    22     start[j] = image[j].tzero - MAX(0.05*image[j].trate*image[j].NY, 1);
    23     stop[j]  = image[j].tzero + MAX(1.05*image[j].trate*image[j].NY, 1);
     22    start[j] = image[j].tzero - MAX(0.01*image[j].trate*image[j].NY, 1);
     23    stop[j]  = image[j].tzero + MAX(1.01*image[j].trate*image[j].NY, 1);
    2424  }
    2525
  • trunk/Ohana/src/gastro/src/getptolemy.c

    r15743 r16810  
    5050      stars[k].X = catalog.average[j].R;
    5151      stars[k].Y = catalog.average[j].D;
    52       stars[k].mag = catalog.measure[catalog.average[j].offset].M;
     52      stars[k].mag = catalog.measure[catalog.average[j].measureOffset].M;
    5353    }     
    5454    dvo_catalog_free (&catalog);
  • trunk/Ohana/src/gastro2/src/getptolemy.c

    r15743 r16810  
    6161      Ref[0].stars[k].R = catalog.average[j].R;
    6262      Ref[0].stars[k].D = catalog.average[j].D;
    63       Ref[0].stars[k].M = catalog.measure[catalog.average[j].offset].M;
     63      Ref[0].stars[k].M = catalog.measure[catalog.average[j].measureOffset].M;
    6464    }     
    6565    dvo_catalog_free (&catalog);
  • trunk/Ohana/src/getstar/src/ReadImageHeader.c

    r15509 r16810  
    9898  image[0].Xm   = NAN_S_SHORT;
    9999  image[0].code = 0;
    100   bzero (image[0].dummy, sizeof(image[0].dummy));
    101100
    102101  return (TRUE);
  • trunk/Ohana/src/getstar/src/select_by_region.c

    r15743 r16810  
    5454        mag = catalog[0].secfilt[i*Nsecfilt + Nsec].M;
    5555      } else {
    56         offset = catalog[0].average[i].offset;
    57         for (m = 0; m < catalog[0].average[i].Nm; m++) {
     56        offset = catalog[0].average[i].measureOffset;
     57        for (m = 0; m < catalog[0].average[i].Nmeasure; m++) {
    5858          if (catalog[0].measure[offset + m].photcode == code) {
    5959            mag = PhotRel (&catalog[0].measure[offset + m], &catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt]);
     
    6666
    6767    output[0].average[Nave] = catalog[0].average[i];
    68     output[0].average[Nave].offset = Nmeas;
     68    output[0].average[Nave].measureOffset = Nmeas;
    6969    for (j = 0; j < Nsecfilt; j++) {
    7070      output[0].secfilt[Nsecfilt*Nave + j] = catalog[0].secfilt[Nsecfilt*i + j];
     
    7272
    7373    Nm = 0;
    74     offset = catalog[0].average[i].offset;
     74    offset = catalog[0].average[i].measureOffset;
    7575
    76     for (j = 0; j < catalog[0].average[i].Nm; j++) {
     76    for (j = 0; j < catalog[0].average[i].Nmeasure; j++) {
    7777      output[0].measure[Nmeas] = catalog[0].measure[offset + j];
    7878      output[0].measure[Nmeas].averef = Nave;
  • trunk/Ohana/src/getstar/src/write_getstar_ps1_dev_0.c

    r15543 r16810  
    5858    } else {
    5959      output[i].mag = NAN;
    60       offset = average[i].offset;
    61       for (m = 0; m < average[i].Nm; m++) {
     60      offset = average[i].measureOffset;
     61      for (m = 0; m < average[i].Nmeasure; m++) {
    6262        if (measure[offset + m].photcode == code_c0) {
    6363          output[i].mag = PhotRel (&measure[offset + m], &average[i], &secfilt[i*Nsecfilt]);
     
    7272    } else {
    7373      output[i].c1 = NAN;
    74       offset = average[i].offset;
    75       for (m = 0; m < average[i].Nm; m++) {
     74      offset = average[i].measureOffset;
     75      for (m = 0; m < average[i].Nmeasure; m++) {
    7676        if (measure[offset + m].photcode == code_c1) {
    7777          output[i].c1 = PhotRel (&measure[offset + m], &average[i], &secfilt[i*Nsecfilt]);
     
    8686    } else {
    8787      output[i].c2 = NAN;
    88       offset = average[i].offset;
    89       for (m = 0; m < average[i].Nm; m++) {
     88      offset = average[i].measureOffset;
     89      for (m = 0; m < average[i].Nmeasure; m++) {
    9090        if (measure[offset + m].photcode == code_c2) {
    9191          output[i].c2 = PhotRel (&measure[offset + m], &average[i], &secfilt[i*Nsecfilt]);
  • trunk/Ohana/src/getstar/src/write_getstar_ps1_dev_1.c

    r15543 r16810  
    6161    } else {
    6262      output[i].mag = NAN;
    63       offset = average[i].offset;
    64       for (m = 0; m < average[i].Nm; m++) {
     63      offset = average[i].measureOffset;
     64      for (m = 0; m < average[i].Nmeasure; m++) {
    6565        if (measure[offset + m].photcode == code_c0) {
    6666          output[i].mag = PhotRel (&measure[offset + m], &average[i], &secfilt[i*Nsecfilt]);
     
    7575    } else {
    7676      output[i].c1 = NAN;
    77       offset = average[i].offset;
    78       for (m = 0; m < average[i].Nm; m++) {
     77      offset = average[i].measureOffset;
     78      for (m = 0; m < average[i].Nmeasure; m++) {
    7979        if (measure[offset + m].photcode == code_c1) {
    8080          output[i].c1 = PhotRel (&measure[offset + m], &average[i], &secfilt[i*Nsecfilt]);
     
    8989    } else {
    9090      output[i].c2 = NAN;
    91       offset = average[i].offset;
    92       for (m = 0; m < average[i].Nm; m++) {
     91      offset = average[i].measureOffset;
     92      for (m = 0; m < average[i].Nmeasure; m++) {
    9393        if (measure[offset + m].photcode == code_c2) {
    9494          output[i].c2 = PhotRel (&measure[offset + m], &average[i], &secfilt[i*Nsecfilt]);
  • trunk/Ohana/src/getstar/src/write_getstar_ps1_dev_2.c

    r15543 r16810  
    6767    } else {
    6868      output[i].mag = NAN;
    69       offset = average[i].offset;
    70       for (m = 0; m < average[i].Nm; m++) {
     69      offset = average[i].measureOffset;
     70      for (m = 0; m < average[i].Nmeasure; m++) {
    7171        if (measure[offset + m].photcode == code_c0) {
    7272          output[i].mag = PhotRel (&measure[offset + m], &average[i], &secfilt[i*Nsecfilt]);
     
    8181    } else {
    8282      output[i].c1 = NAN;
    83       offset = average[i].offset;
    84       for (m = 0; m < average[i].Nm; m++) {
     83      offset = average[i].measureOffset;
     84      for (m = 0; m < average[i].Nmeasure; m++) {
    8585        if (measure[offset + m].photcode == code_c1) {
    8686          output[i].c1 = PhotRel (&measure[offset + m], &average[i], &secfilt[i*Nsecfilt]);
     
    9595    } else {
    9696      output[i].c2 = NAN;
    97       offset = average[i].offset;
    98       for (m = 0; m < average[i].Nm; m++) {
     97      offset = average[i].measureOffset;
     98      for (m = 0; m < average[i].Nmeasure; m++) {
    9999        if (measure[offset + m].photcode == code_c2) {
    100100          output[i].c2 = PhotRel (&measure[offset + m], &average[i], &secfilt[i*Nsecfilt]);
  • trunk/Ohana/src/kapa2/include/buttons.h

    r16011 r16810  
    119119   0x42, 0x84, 0x84, 0x00, 0x42, 0x84, 0x84, 0x00, 0x62, 0xc4, 0xc4, 0x00,
    120120   0x5c, 0xb9, 0xb8, 0x00};
     121#define flipx_width 25
     122#define flipx_height 25
     123static unsigned char flipx_bits[] = {
     124   0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
     125   0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x01, 0x00, 0x80, 0x10, 0x02, 0x00,
     126   0x40, 0x00, 0x04, 0x00, 0x20, 0x10, 0x08, 0x00, 0x10, 0x10, 0x10, 0x00,
     127   0x08, 0x00, 0x20, 0x00, 0x04, 0x10, 0x40, 0x00, 0x02, 0x10, 0x80, 0x00,
     128   0x01, 0x00, 0x00, 0x01, 0x02, 0x10, 0x80, 0x00, 0x04, 0x10, 0x40, 0x00,
     129   0x08, 0x00, 0x20, 0x00, 0x10, 0x10, 0x10, 0x00, 0x20, 0x10, 0x08, 0x00,
     130   0x40, 0x00, 0x04, 0x00, 0x80, 0x10, 0x02, 0x00, 0x00, 0x11, 0x01, 0x00,
     131   0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
     132   0x00, 0x10, 0x00, 0x00 };
     133#define flipy_width 25
     134#define flipy_height 25
     135static unsigned char flipy_bits[] = {
     136   0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00,
     137   0x00, 0x82, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x80, 0x00, 0x02, 0x00,
     138   0x40, 0x00, 0x04, 0x00, 0x20, 0x00, 0x08, 0x00, 0x10, 0x00, 0x10, 0x00,
     139   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     140   0xb7, 0x6d, 0xdb, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     141   0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00, 0x08, 0x00,
     142   0x40, 0x00, 0x04, 0x00, 0x80, 0x00, 0x02, 0x00, 0x00, 0x01, 0x01, 0x00,
     143   0x00, 0x82, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00,
     144   0x00, 0x10, 0x00, 0x00 };
  • trunk/Ohana/src/kapa2/include/prototypes.h

    r16270 r16810  
    195195int           RecenterRescale     PROTO((Graphic *graphic, KapaImageWidget *image));
    196196int           ToggleDEG           PROTO((Graphic *graphic, KapaImageWidget *image));
     197int           FlipImageX          PROTO((Graphic *graphic, KapaImageWidget *image));
     198int           FlipImageY          PROTO((Graphic *graphic, KapaImageWidget *image));
    197199int           Overlay0            PROTO((Graphic *graphic, KapaImageWidget *image));
    198200int           Overlay1            PROTO((Graphic *graphic, KapaImageWidget *image));
  • trunk/Ohana/src/kapa2/include/structures.h

    r16270 r16810  
    180180  Button   heat_button;
    181181  Button   overlay_button[NOVERLAYS];
     182  Button   flipx_button;
     183  Button   flipy_button;
    182184
    183185  // location of the status box
  • trunk/Ohana/src/kapa2/src/ButtonFunctions.c

    r16270 r16810  
    1717  CreateWide (graphic, image);
    1818  Refresh ();
    19   XFlush (graphic[0].display);
    2019  return (TRUE);
    2120}
     
    2928  CreateWide (graphic, image);
    3029  Refresh ();
    31   XFlush (graphic[0].display);
    3230  return (TRUE);
    3331}
     
    4139  CreateWide (graphic, image);
    4240  Refresh ();
    43   XFlush (graphic[0].display);
    4441  return (TRUE);
    4542}
     
    5249  Remap (graphic, image);
    5350  Refresh ();
    54   FlushDisplay (graphic[0].display);
    5551  return (TRUE);
    5652
     
    6258  Remap (graphic, image);
    6359  Refresh ();
    64   FlushDisplay (graphic[0].display);
    6560  return (TRUE);
    6661
     
    7570  Remap (graphic, image);
    7671  Refresh ();
    77   FlushDisplay (graphic[0].display);
    7872  return (TRUE);
    7973
    8074}
    8175
     76int FlipImageX (Graphic *graphic, KapaImageWidget *image) {
     77
     78  image[0].picture.flipx = !image[0].picture.flipx;
     79  image[0].zoom.flipx    = !image[0].zoom.flipx;
     80  image[0].wide.flipx    = !image[0].wide.flipx;
     81 
     82  Remap (graphic, image);
     83  CreateWide (graphic, image);
     84  Refresh ();
     85  return (TRUE);
     86}
     87
     88int FlipImageY (Graphic *graphic, KapaImageWidget *image) {
     89
     90  image[0].picture.flipy = !image[0].picture.flipy;
     91  image[0].zoom.flipy    = !image[0].zoom.flipy;
     92  image[0].wide.flipy    = !image[0].wide.flipy;
     93 
     94  Remap (graphic, image);
     95  CreateWide (graphic, image);
     96  Refresh ();
     97  return (TRUE);
     98}
     99
    82100int ToggleDEG (Graphic *graphic, KapaImageWidget *image) {
    83101
    84   image[0].picture.flipy = !image[0].picture.flipy;
    85   image[0].zoom.flipy = !image[0].zoom.flipy;
    86   image[0].wide.flipy = !image[0].wide.flipy;
    87102  image[0].DecimalDegrees = image[0].DecimalDegrees ^ TRUE;
    88103  StatusBox (graphic, image);
     
    97112  image[0].overlay[0].active = image[0].overlay[0].active ^ TRUE;
    98113  Refresh ();
    99   FlushDisplay (graphic[0].display);
    100114  return (TRUE);
    101115
     
    106120  image[0].overlay[1].active = image[0].overlay[1].active ^ TRUE;
    107121  Refresh ();
    108   FlushDisplay (graphic[0].display);
    109122  return (TRUE);
    110123
     
    115128  image[0].overlay[2].active = image[0].overlay[2].active ^ TRUE;
    116129  Refresh ();
    117   FlushDisplay (graphic[0].display);
    118130  return (TRUE);
    119131
     
    124136  image[0].overlay[3].active = image[0].overlay[3].active ^ TRUE;
    125137  Refresh ();
    126   FlushDisplay (graphic[0].display);
    127138  return (TRUE);
    128139
  • trunk/Ohana/src/kapa2/src/CheckButtons.c

    r16011 r16810  
    2626    button = &image[0].hms_button;
    2727
     28  if (InButton (event, &image[0].flipx_button))
     29    button = &image[0].flipx_button;
     30
     31  if (InButton (event, &image[0].flipy_button))
     32    button = &image[0].flipy_button;
     33
    2834  for (i = 0; i < NOVERLAYS; i++) {
    2935    if (InButton (event, &image[0].overlay_button[i]))
  • trunk/Ohana/src/kapa2/src/CheckVisual.c

    r16011 r16810  
    1414  unsigned long planes[3];
    1515  XPixmapFormatValues *pixmaps;
    16   int Npixmaps;
     16  int Npixmaps, Npixels;
    1717
    1818  if (DEBUG) {
     
    127127
    128128  if (isDynamic) {
     129    Npixels = NPIXELS_DYNAMIC;
     130    if ((N = get_argument (*argc, argv, "-ncolors"))) {
     131      remove_argument(N, argc, argv);
     132      Npixels = atoi (argv[N]);
     133      remove_argument(N, argc, argv);
     134    }
     135
    129136    /* allocate color cells */
    130     ALLOCATE (graphic[0].pixels, unsigned long, NPIXELS_DYNAMIC);
    131     ALLOCATE (graphic[0].cmap,   XColor,        NPIXELS_DYNAMIC);
    132     for (graphic[0].Npixels = NPIXELS_DYNAMIC; graphic[0].Npixels >= 16; graphic[0].Npixels -= 4) {
     137    ALLOCATE (graphic[0].pixels, unsigned long, Npixels);
     138    ALLOCATE (graphic[0].cmap,   XColor,        Npixels);
     139    for (graphic[0].Npixels = Npixels; graphic[0].Npixels >= 16; graphic[0].Npixels -= 4) {
    133140      if (DEBUG) fprintf (stderr, "trying %d colors\n", (int) graphic[0].Npixels);
    134141      if (XAllocColorCells (graphic[0].display, graphic[0].colormap, FALSE, planes, 1, graphic[0].pixels, graphic[0].Npixels)) {
     
    163170    }
    164171  } else {
     172    Npixels = NPIXELS_STATIC;
     173    if ((N = get_argument (*argc, argv, "-ncolors"))) {
     174      remove_argument(N, argc, argv);
     175      Npixels = atoi (argv[N]);
     176      remove_argument(N, argc, argv);
     177    }
     178
    165179    // XXX allocate the unsigned long *pixels here and above
    166     ALLOCATE (graphic[0].pixels, unsigned long, NPIXELS_STATIC);
    167     ALLOCATE (graphic[0].cmap,   XColor,        NPIXELS_STATIC);
    168     graphic[0].Npixels = NPIXELS_STATIC;
     180    ALLOCATE (graphic[0].pixels, unsigned long, Npixels);
     181    ALLOCATE (graphic[0].cmap,   XColor,        Npixels);
     182    graphic[0].Npixels = Npixels;
    169183  }
    170184
  • trunk/Ohana/src/kapa2/src/Image.c

    r16270 r16810  
    106106  InitButtonSize (&image[0].hms_button, hms_width, hms_height, hms_bits);
    107107  InitButtonFunc (&image[0].hms_button, ToggleDEG);
     108
     109  InitButtonSize (&image[0].flipx_button, flipx_width, flipx_height, flipx_bits);
     110  InitButtonFunc (&image[0].flipx_button, FlipImageX);
     111
     112  InitButtonSize (&image[0].flipy_button, flipy_width, flipy_height, flipy_bits);
     113  InitButtonFunc (&image[0].flipy_button, FlipImageY);
    108114
    109115  return (image);
     
    175181    DrawButton (graphic, &image[0].hms_button);
    176182
     183    DrawButton (graphic, &image[0].flipx_button);
     184    DrawButton (graphic, &image[0].flipy_button);
     185
    177186    for (i = 0; i < NOVERLAYS; i++) {
    178187      DrawButton (graphic, &image[0].overlay_button[i]);
  • trunk/Ohana/src/kapa2/src/SetImageSize.c

    r16270 r16810  
    2626  dY = graphic[0].dy * section[0].dy;
    2727
     28  textpad = USE_XWINDOW ? graphic[0].font[0].ascent : 10;
     29  textdY = 6*textpad + 7*PAD1;
     30  WdY = MAX (ZOOM_Y, textdY + 2*BUTTON_HEIGHT + PAD1);
     31
    2832  switch (image[0].location) {
    29     case 0:
     33
     34    case 0: // no zoom / status / wide
    3035      if (section->graph) {
    3136          image[0].picture.x  = graph[0].axis[0].fx;
     
    4348      return;
    4449
    45     case 1:
    46       textpad = USE_XWINDOW ? graphic[0].font[0].ascent : 10;
    47       textdY = 6*textpad + 7*PAD1;
    48       WdY = MAX (ZOOM_Y, textdY + 2*BUTTON_HEIGHT + PAD1);
     50    case 1: // zoom / status / wide on bottom
    4951
    5052      if (section->graph) {
     
    110112      image[0].recenter_button.y = image[0].PS_button.y;
    111113
     114      // add just below
     115      image[0].flipx_button.x = image[0].recenter_button.x + image[0].recenter_button.dx + PAD1;
     116      image[0].flipx_button.y = image[0].recenter_button.y;
     117
     118      image[0].flipy_button.x = image[0].hms_button.x + image[0].hms_button.dx + PAD1;
     119      image[0].flipy_button.y = image[0].hms_button.y;
     120
    112121      // XXX zoom should scale somewhat with the image? (with a min and a max)
    113122      // XXX actually, it is limited by the buttons and status region
    114123      image[0].wide.dx = ZOOM_X;
    115124      image[0].wide.dy = ZOOM_Y;
    116       image[0].wide.x = image[0].recenter_button.x + image[0].recenter_button.dx + PAD1;
    117       image[0].wide.y = image[0].PS_button.y;
    118       break;
    119 
    120     case 3:
    121       textpad = USE_XWINDOW ? graphic[0].font[0].ascent : 10;
    122       textdY = 6*textpad + 7*PAD1;
    123       WdY = MAX (ZOOM_Y, textdY + 2*BUTTON_HEIGHT + PAD1);
     125      image[0].wide.x = image[0].flipx_button.x + image[0].flipx_button.dx + PAD1;
     126      image[0].wide.y = image[0].zoom.y;
     127      break;
     128
     129    case 3: // zoom / status / wide on top
    124130
    125131      if (section->graph) {
     
    185191      image[0].recenter_button.y = image[0].PS_button.y;
    186192
     193      // add just below
     194      image[0].flipx_button.x = image[0].recenter_button.x + image[0].recenter_button.dx + PAD1;
     195      image[0].flipx_button.y = image[0].recenter_button.y;
     196
     197      image[0].flipy_button.x = image[0].hms_button.x + image[0].hms_button.dx + PAD1;
     198      image[0].flipy_button.y = image[0].hms_button.y;
     199
    187200      // XXX zoom should scale somewhat with the image? (with a min and a max)
    188201      // XXX actually, it is limited by the buttons and status region
    189202      image[0].wide.dx = ZOOM_X;
    190203      image[0].wide.dy = ZOOM_Y;
    191       image[0].wide.x = image[0].PS_button.x;
    192       image[0].wide.y = image[0].PS_button.y + BUTTON_HEIGHT + PAD1;
    193       break;
    194 
    195     case 2:
     204      image[0].wide.x = image[0].flipx_button.x + image[0].flipx_button.dx + PAD1;
     205      image[0].wide.y = image[0].zoom.y;
     206      break;
     207
     208    case 2: // zoom / status / wide on left
    196209
    197210      if (section->graph) {
     
    220233
    221234      /** everything below is tied in x-dir to the zoom box **/
    222       textpad = USE_XWINDOW ? graphic[0].font[0].ascent : 10;
    223235      image[0].text_x = image[0].zoom.x;
    224236      image[0].text_y = image[0].zoom.y + image[0].zoom.dy + PAD1;
     
    258270      image[0].recenter_button.y = image[0].PS_button.y;
    259271
     272      // add just below
     273      image[0].flipx_button.x = image[0].PS_button.x;
     274      image[0].flipx_button.y = image[0].PS_button.y + BUTTON_HEIGHT + PAD1;
     275
     276      image[0].flipy_button.x = image[0].flipx_button.x + image[0].flipx_button.dx + PAD1;
     277      image[0].flipy_button.y = image[0].flipx_button.y;
     278
    260279      // XXX zoom should scale somewhat with the image? (with a min and a max)
    261280      // XXX actually, it is limited by the buttons and status region
    262281      image[0].wide.dx = ZOOM_X;
    263282      image[0].wide.dy = ZOOM_Y;
    264       image[0].wide.x = image[0].recenter_button.x + image[0].recenter_button.dx + PAD1;
    265       image[0].wide.y = image[0].PS_button.y;
    266       break;
    267 
    268     case 4:
     283      image[0].wide.x = image[0].flipx_button.x;
     284      image[0].wide.y = image[0].flipx_button.y + BUTTON_HEIGHT + PAD1;
     285      break;
     286
     287    case 4:  // zoom / status / wide on right
    269288
    270289      if (section->graph) {
     
    293312
    294313      /** everything below is tied in x-dir to the zoom box **/
    295       textpad = USE_XWINDOW ? graphic[0].font[0].ascent : 10;
    296314      image[0].text_x = image[0].zoom.x;
    297315      image[0].text_y = image[0].zoom.y + image[0].zoom.dy + PAD1;
     
    331349      image[0].recenter_button.y = image[0].PS_button.y;
    332350
     351      // add just below
     352      image[0].flipx_button.x = image[0].zoom.x;
     353      image[0].flipx_button.y = image[0].PS_button.y + BUTTON_HEIGHT + PAD1;
     354
     355      image[0].flipy_button.x = image[0].flipx_button.x + image[0].flipx_button.dx + PAD1;
     356      image[0].flipy_button.y = image[0].flipx_button.y;
     357
    333358      // XXX zoom should scale somewhat with the image? (with a min and a max)
    334359      // XXX actually, it is limited by the buttons and status region
    335360      image[0].wide.dx = ZOOM_X;
    336361      image[0].wide.dy = ZOOM_Y;
    337       image[0].wide.x = image[0].PS_button.x;
    338       image[0].wide.y = image[0].PS_button.y + BUTTON_HEIGHT + PAD1;
     362      image[0].wide.x = image[0].flipx_button.x;
     363      image[0].wide.y = image[0].flipx_button.y + BUTTON_HEIGHT + PAD1;
    339364      break;
    340365
  • trunk/Ohana/src/libautocode/Makefile.Targets

    r15694 r16810  
    88$(ASRC)/average-panstarrs-dev-1.$(ARCH).o \
    99$(ASRC)/average-ps1-dev-1.$(ARCH).o \
     10$(ASRC)/average-ps1-dev-2.$(ARCH).o \
    1011$(ASRC)/secfilt.$(ARCH).o \
    1112$(ASRC)/secfilt-loneos.$(ARCH).o \
     
    1415$(ASRC)/secfilt-panstarrs-dev-1.$(ARCH).o \
    1516$(ASRC)/secfilt-ps1-dev-1.$(ARCH).o \
     17$(ASRC)/secfilt-ps1-dev-2.$(ARCH).o \
    1618$(ASRC)/measure.$(ARCH).o \
    1719$(ASRC)/measure-loneos.$(ARCH).o \
     
    2022$(ASRC)/measure-panstarrs-dev-1.$(ARCH).o \
    2123$(ASRC)/measure-ps1-dev-1.$(ARCH).o \
     24$(ASRC)/measure-ps1-dev-2.$(ARCH).o \
    2225$(ASRC)/missing.$(ARCH).o \
    2326$(ASRC)/photcode.$(ARCH).o \
    2427$(ASRC)/photcode-elixir.$(ARCH).o \
    2528$(ASRC)/photcode-ps1-dev-1.$(ARCH).o \
     29$(ASRC)/photcode-ps1-dev-2.$(ARCH).o \
    2630$(ASRC)/image.$(ARCH).o \
    2731$(ASRC)/image-loneos.$(ARCH).o \
     
    3034$(ASRC)/image-panstarrs-dev-1.$(ARCH).o \
    3135$(ASRC)/image-ps1-dev-1.$(ARCH).o \
     36$(ASRC)/image-ps1-dev-2.$(ARCH).o \
    3237$(ASRC)/regimage.$(ARCH).o \
    3338$(ASRC)/detreg.$(ARCH).o \
     
    5560$(AINC)/average-panstarrs-dev-1.h \
    5661$(AINC)/average-ps1-dev-1.h \
     62$(AINC)/average-ps1-dev-2.h \
    5763$(AINC)/secfilt.h \
    5864$(AINC)/secfilt-loneos.h \
     
    6167$(AINC)/secfilt-panstarrs-dev-1.h \
    6268$(AINC)/secfilt-ps1-dev-1.h \
     69$(AINC)/secfilt-ps1-dev-2.h \
    6370$(AINC)/measure.h \
    6471$(AINC)/measure-loneos.h \
     
    6774$(AINC)/measure-panstarrs-dev-1.h \
    6875$(AINC)/measure-ps1-dev-1.h \
     76$(AINC)/measure-ps1-dev-2.h \
    6977$(AINC)/missing.h \
    7078$(AINC)/photcode.h \
    7179$(AINC)/photcode-elixir.h \
    7280$(AINC)/photcode-ps1-dev-1.h \
     81$(AINC)/photcode-ps1-dev-2.h \
    7382$(AINC)/image.h \
    7483$(AINC)/image-loneos.h \
     
    7786$(AINC)/image-panstarrs-dev-1.h \
    7887$(AINC)/image-ps1-dev-1.h \
     88$(AINC)/image-ps1-dev-2.h \
    7989$(AINC)/regimage.h \
    8090$(AINC)/detreg.h \
  • trunk/Ohana/src/libautocode/def/AddstarClientOptions.d

    r15038 r16810  
    22EXTNAME OPTIONS
    33TYPE    BINTABLE
    4 SIZE    76
     4SIZE    80
    55
    66FIELD     Nsigma,           NSIGMA,               double,         match radius in terms of astrometric error
    77FIELD     radius,           RADIUS,               double,         match radius in arcsec (default)
    88FIELD     mode,             MODE,                 int,            data source mode
     9FIELD     filelist,         FILELIST,             int,            if true file is a list of input files
    910FIELD     existing_regions, EXISTING_REGIONS,     int,            use only existing regions
    1011FIELD     only_match,       ONLY_MATCH,           int,            only update matched stars
  • trunk/Ohana/src/libautocode/def/Stars.d

    r15038 r16810  
    22EXTNAME STARS
    33TYPE    BINTABLE
    4 SIZE    244
     4SIZE    248
    55
    66FIELD     X,                X,          double,    x coordinate on image,            pixels
     
    2020FIELD     M,                M,          double,    instrumental mag
    2121FIELD     dM,               DM,         double,    error on mag
     22FIELD     dMcal,            DMCAL,      double,    systematic error on mag
    2223FIELD     sky,              SKY,        double,    local sky counts
    2324FIELD     dsky,             dSKY,       double,    local sky error counts
     
    2526FIELD     fy,               FY,         double,    object FWHM y-dir,                pixels?
    2627FIELD     df,               DF,         double,    object position angle,            degrees
    27 FIELD     Mgal,             MGAL,       double,    alternative (galaxy) magnitude
     28# FIELD     Mgal,             MGAL,       double,    alternative (galaxy) magnitude
    2829FIELD     Map,              MAP,        double,    alternative (aperture) magnitude
    2930FIELD     Mpeak,            MPEAK,      double,    alternative (peak) magnitude
    3031FIELD     detID,            ID,         int,       detection identifier
     32FIELD     imageID,          IMAGE_ID,   int,       image identifier
    3133FIELD     found,            FOUND,      int,       found in database catalog?
    3234FIELD     t,                T,          e_time,    date/time of exposure (UNIX)
    3335FIELD     dt,               EXPTIME,    float,     exposure time,                    2.5*log(exptime)
    34 FIELD     psfProb,          PSF_PROB,   float
     36FIELD     psfChisq,         PSF_CHISQ,  float
    3537FIELD     crNsigma,         CR_NSIGMA,  float
    3638FIELD     extNsigma,        EXT_NSIGMA, float
  • trunk/Ohana/src/libautocode/def/average-panstarrs-dev-0.d

    r15511 r16810  
    2727
    2828# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
    29 FIELD objID_hi,       OBJ_ID_HI,    unsigned int,   ID upper bytes
    30 FIELD objID_lo,       OBJ_ID_LO,    unsigned int,   ID lower bytes
     29FIELD objID,          OBJ_ID,     unsigned int,   ID upper bytes
     30FIELD catID,          CAT_ID,     unsigned int,   ID lower bytes
    3131
    3232# this structure should only be used for internal representations
  • trunk/Ohana/src/libautocode/def/average-panstarrs-dev-1.d

    r15511 r16810  
    2727
    2828# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
    29 FIELD objID_hi,       OBJ_ID_HI,    unsigned int,   ID upper bytes
    30 FIELD objID_lo,       OBJ_ID_LO,    unsigned int,   ID lower bytes
     29FIELD objID,          OBJ_ID,     unsigned int,   ID upper bytes
     30FIELD catID,          CAT_ID,     unsigned int,   ID lower bytes
    3131
    3232# this structure should only be used for internal representations
  • trunk/Ohana/src/libautocode/def/average-ps1-dev-1.d

    r15511 r16810  
    2727
    2828# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
    29 FIELD objID_hi,       OBJ_ID_HI,    unsigned int,   ID upper bytes
    30 FIELD objID_lo,       OBJ_ID_LO,    unsigned int,   ID lower bytes
     29FIELD objID,          OBJ_ID,     unsigned int,   ID upper bytes
     30FIELD catID,          CAT_ID,     unsigned int,   ID lower bytes
    3131
    3232# this structure should only be used for internal representations
  • trunk/Ohana/src/libautocode/def/average-ps1-dev-2.d

    r16266 r16810  
    22EXTNAME      DVO_AVERAGE_PS1_DEV_2
    33TYPE         BINTABLE
    4 SIZE         72
     4SIZE         80
    55DESCRIPTION  DVO Average Object Table
    66
     
    1919FIELD dP,             PAR_ERR,    float,            parallax error,               arcsec
    2020
    21 FIELD Xp,             SIGMA_POS,  short,            position scatter,             1/100 arcsec
    22 FIELD Npsf,           NPSF,       unsigned short,   number of psf measurements
    23 FIELD Next,           NEXT,       unsigned short,   number of extended measurements
    24 FIELD Nmiss,          NMISS,      unsigned short,   number of missings
    25 FIELD psfOffset,      OFF_PSF,    int,              offset to first measurement
    26 FIELD extOffset,      OFF_EXT,    int,              offset to first measurement
    27 FIELD missOffset,     OFF_MISS,   int,              offset to first missing obs
     21FIELD Xp,             SIGMA_POS,   short,           position scatter,             1/100 arcsec
     22FIELD Nmeasure,       NMEASURE,    unsigned short,  number of psf measurements
     23FIELD Nmissing,       NMISSING,    unsigned short,  number of missings
     24FIELD Nextend,        NEXTEND,     unsigned short,  number of extended measurements
     25FIELD measureOffset,  OFF_MEASURE, int,             offset to first psf measurement
     26FIELD missingOffset,  OFF_MISSING, int,             offset to first missing obs
     27FIELD extendOffset,   OFF_EXTEND,  int,             offset to first extended measurement
    2828
    2929FIELD code,           code,       unsigned short,   ID code (star; ghost; etc)
     30FIELD dummy,          DUMMY,      char[2],          padding
    3031
    31 # Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
    32 FIELD objID_hi,       OBJ_ID_HI,  unsigned int,     ID upper bytes
    33 FIELD objID_lo,       OBJ_ID_LO,  unsigned int,     ID lower bytes
     32# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints
     33# for C89 compatibility.  The objID is constructed based on the
     34# position of first instatiation.  this is actually quite expensive
     35# because we need to include the uniqueness test to construct this,
     36# which requires a select for each new object.  Therefore, I will use
     37# a table based ID (table ID + object ID), and we will have to
     38# re-number the object IDs if we change the table density, OR treat
     39# all subdivisions as entries which are from a foreign table.
     40
     41FIELD objID,          OBJ_ID,    unsigned int,   unique ID for object in table
     42FIELD catID,          CAT_ID,    unsigned int,   unique ID for table in which object was first realized
    3443
    3544# this structure should only be used for internal representations
  • trunk/Ohana/src/libautocode/def/average.d

    r15511 r16810  
    22EXTNAME      DVO_AVERAGE
    33TYPE         BINTABLE
    4 SIZE         72
     4SIZE         80
    55DESCRIPTION  DVO Average Object Table
    66
     
    1919FIELD dP,             PAR_ERR,    float,            parallax error,               arcsec
    2020
    21 FIELD Xp,             SIGMA_POS,  short,            position scatter,             1/100 arcsec
    22 FIELD Nm,             NMEAS,      unsigned short,   number of measures
    23 FIELD Nn,             NMISS,      unsigned short,   number of missings
     21FIELD Xp,             SIGMA_POS,   short,           position scatter,             1/100 arcsec
     22FIELD Nmeasure,       NMEASURE,    unsigned short,  number of psf measurements
     23FIELD Nmissing,       NMISSING,    unsigned short,  number of missings
     24FIELD Nextend,        NEXTEND,     unsigned short,  number of extended measurements
     25FIELD measureOffset,  OFF_MEASURE, int,             offset to first psf measurement
     26FIELD missingOffset,  OFF_MISSING, int,             offset to first missing obs
     27FIELD extendOffset,   OFF_EXTEND,  int,             offset to first extended measurement
     28
    2429FIELD code,           code,       unsigned short,   ID code (star; ghost; etc)
    25 FIELD offset,         offset,     int,              offset to first measurement
    26 FIELD missing,        missing,    int,              offset to first missing obs
     30FIELD dummy,          DUMMY,      char[2],          padding
    2731
    28 # Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
    29 FIELD objID_hi,       OBJ_ID_HI,    unsigned int,   ID upper bytes
    30 FIELD objID_lo,       OBJ_ID_LO,    unsigned int,   ID lower bytes
     32# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints
     33# for C89 compatibility.  The objID is constructed based on the
     34# position of first instatiation.  this is actually quite expensive
     35# because we need to include the uniqueness test to construct this,
     36# which requires a select for each new object.  Therefore, I will use
     37# a table based ID (table ID + object ID), and we will have to
     38# re-number the object IDs if we change the table density, OR treat
     39# all subdivisions as entries which are from a foreign table.
     40
     41FIELD objID,          OBJ_ID,    unsigned int,   unique ID for object in table
     42FIELD catID,          CAT_ID,    unsigned int,   unique ID for table in which object was first realized
    3143
    3244# this structure should only be used for internal representations
  • trunk/Ohana/src/libautocode/def/extend-ps1-dev-2.d

    r16266 r16810  
    1 STRUCT       Extend_PS1_DEV_1
    2 EXTNAME      DVO_EXTEND_PS1_DEV_1
     1STRUCT       Extend_PS1_DEV_2
     2EXTNAME      DVO_EXTEND_PS1_DEV_2
    33TYPE         BINTABLE
    4 SIZE         104
     4SIZE         160
    55DESCRIPTION  DVO Detection Extended Source Parameters Table
    66
     
    1515FIELD imageID,        IMAGE_ID,           unsigned int,   reference to image
    1616FIELD photcode,       PHOTCODE,           unsigned short, photcode
     17FIELD padding,        PADDING,            unsigned short, padding
    1718
    1819FIELD FWx,            EXT_MAJOR,          float,          object fwhm major axis
  • trunk/Ohana/src/libautocode/def/image-ps1-dev-2.d

    r16266 r16810  
    1 STRUCT       Image_PS1_DEV_1
    2 EXTNAME      DVO_IMAGE_PS1_DEV_1
     1STRUCT       Image_PS1_DEV_2
     2EXTNAME      DVO_IMAGE_PS1_DEV_2
    33TYPE         BINTABLE
    4 SIZE         288
     4SIZE         280
    55DESCRIPTION  DVO Image Table
    66
     
    2626FIELD     nstar,            NSTAR,                unsigned int,   number of stars on image
    2727FIELD     secz,             SECZ,                 float,          airmass,                   mag
    28 FIELD     NX,               NX,                   short,          image width
    29 FIELD     NY,               NY,                   short,          image height
     28FIELD     NX,               NX,                   unsigned short, image width
     29FIELD     NY,               NY,                   unsigned short, image height
    3030FIELD     apmifit,          APMIFIT,              float,          aperture correction,       mag
    3131FIELD     dapmifit,         DAPMIFIT,             float,          apmifit error,             mag
     
    4848FIELD     code,             CODE,                 char,           image quality flag
    4949FIELD     ccdnum,           CCDNUM,               unsigned char,  CCD ID number
    50 FIELD     imageID,          IMAGE_ID,             unsigned int,   image ID
    51 # 44 bytes
     50FIELD     imageID,          IMAGE_ID,             unsigned int,   internal image ID
     51FIELD     externID,         EXTERN_ID,            unsigned int,   external image ID
     52FIELD     sourceID,         SOURCE_ID,            unsigned short, analysis source ID
     53# 48 bytes
    5254
    53 FIELD     dummy,            DUMMY,                char[14],       unused
    5455FIELD     order,            ORDER,                short,          Mrel 2D polynomical order
    5556FIELD     Mx,               MX,                   short,          Mrel polyterm
  • trunk/Ohana/src/libautocode/def/image.d

    r15038 r16810  
    22EXTNAME      DVO_IMAGE
    33TYPE         BINTABLE
    4 SIZE         288
     4SIZE         280
    55DESCRIPTION  DVO Image Table
    66
     
    4848FIELD     code,             CODE,                 char,           image quality flag
    4949FIELD     ccdnum,           CCDNUM,               unsigned char,  CCD ID number
    50 FIELD     imageID,          IMAGE_ID,             unsigned int,   image ID
     50FIELD     imageID,          IMAGE_ID,             unsigned int,   internal image ID
     51FIELD     externID,         EXTERN_ID,            unsigned int,   external image ID
     52FIELD     sourceID,         SOURCE_ID,            unsigned short, analysis source ID
    5153# 48 bytes
    5254
    53 FIELD     dummy,            DUMMY,                char[14],       unused
    5455FIELD     order,            ORDER,                short,          Mrel 2D polynomical order
    5556FIELD     Mx,               MX,                   short,          Mrel polyterm
  • trunk/Ohana/src/libautocode/def/measure-ps1-dev-1.d

    r15511 r16810  
    3434# do we need more resolution than a short? should this be a log?
    3535FIELD qPSF,           PSF_QF,       float,          psf coverage/quality factor
    36 FIELD psfProb,        PSF_PROB,     float,          psf coverage/quality factor
     36FIELD psfChisq,       PSF_CHISQ,    float,          psf coverage/quality factor
    3737FIELD crNsigma,       CR_NSIGMA,    float,          psf coverage/quality factor
    3838FIELD extNsigma,      EXT_NSIGMA,   float,          psf coverage/quality factor
  • trunk/Ohana/src/libautocode/def/measure-ps1-dev-2.d

    r16266 r16810  
    1 STRUCT       Measure_PS1_DEV_1
    2 EXTNAME      DVO_MEASURE_PS1_DEV_1
     1STRUCT       Measure_PS1_DEV_2
     2EXTNAME      DVO_MEASURE_PS1_DEV_2
    33TYPE         BINTABLE
    4 SIZE         104
     4SIZE         112
    55DESCRIPTION  DVO Detection Measurement Table
    66
     
    99FIELD M,              MAG,          float,          catalog mag,                  mag
    1010FIELD Mcal,           M_CAL,        float,          image cal mag,                mag
    11 FIELD Mgal,           M_GAL,        float,          galaxy mag,                   mag
     11FIELD Map,            M_APER,       float,          aperture mag,                 mag
    1212FIELD dM,             MAG_ERR,      float,          mag error,                    mag
     13FIELD dMcal,          MAG_CAL_ERR,  float,          systematic calibration error, mag
    1314FIELD dt,             M_TIME,       float,          exposure time,                2.5*log(exptime)
    1415
     
    3031# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
    3132FIELD detID,          DET_ID,       unsigned int,   detection ID
    32 FIELD imageID,        IMAGE_ID,     unsigned int,   reference to image
     33FIELD imageID,        IMAGE_ID,     unsigned int,   reference to DVO image ID
    3334
    3435# do we need more resolution than a short? should this be a log?
    3536FIELD qPSF,           PSF_QF,       float,          psf coverage/quality factor
    36 FIELD psfProb,        PSF_PROB,     float,          psf coverage/quality factor
    37 FIELD crNsigma,       CR_NSIGMA,    float,          psf coverage/quality factor
    38 FIELD extNsigma,      EXT_NSIGMA,   float,          psf coverage/quality factor
     37FIELD psfChisq,       PSF_CHISQ,    float,          psf fit chisq
     38FIELD crNsigma,       CR_NSIGMA,    float,          Nsigma deviation towards CR
     39FIELD extNsigma,      EXT_NSIGMA,   float,          Nsigma deviation towards EXT
    3940
    4041FIELD FWx,            FWHM_MAJOR,   short,          object fwhm major axis,       1/100 of arcsec
     
    5455FIELD dophot,         DOPHOT,       char,           dophot type
    5556
    56 FIELD dummy,          DUMMY,        char[2],        padding
     57FIELD dummy,          DUMMY,        char[6],        padding
  • trunk/Ohana/src/libautocode/def/measure.d

    r15511 r16810  
    22EXTNAME      DVO_MEASURE
    33TYPE         BINTABLE
    4 SIZE         104
     4SIZE         112
    55DESCRIPTION  DVO Detection Measurement Table
    66
     
    99FIELD M,              MAG,          float,          catalog mag,                  mag
    1010FIELD Mcal,           M_CAL,        float,          image cal mag,                mag
    11 FIELD Mgal,           M_GAL,        float,          galaxy mag,                   mag
     11FIELD Map,            M_APER,       float,          aperture mag,                 mag
    1212FIELD dM,             MAG_ERR,      float,          mag error,                    mag
     13FIELD dMcal,          MAG_CAL_ERR,  float,          systematic calibration error, mag
    1314FIELD dt,             M_TIME,       float,          exposure time,                2.5*log(exptime)
    1415
     
    3031# Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
    3132FIELD detID,          DET_ID,       unsigned int,   detection ID
    32 FIELD imageID,        IMAGE_ID,     unsigned int,   reference to image
     33FIELD imageID,        IMAGE_ID,     unsigned int,   reference to DVO image ID
    3334
    3435# do we need more resolution than a short? should this be a log?
    3536FIELD qPSF,           PSF_QF,       float,          psf coverage/quality factor
    36 FIELD psfProb,        PSF_PROB,     float,          psf coverage/quality factor
    37 FIELD crNsigma,       CR_NSIGMA,    float,          psf coverage/quality factor
    38 FIELD extNsigma,      EXT_NSIGMA,   float,          psf coverage/quality factor
     37FIELD psfChisq,       PSF_CHISQ,    float,          psf fit chisq
     38FIELD crNsigma,       CR_NSIGMA,    float,          Nsigma deviation towards CR
     39FIELD extNsigma,      EXT_NSIGMA,   float,          Nsigma deviation towards EXT
    3940
    4041FIELD FWx,            FWHM_MAJOR,   short,          object fwhm major axis,       1/100 of arcsec
     
    4344FIELD photcode,       PHOTCODE,     unsigned short, photcode
    4445
     46# convert this to error in arcsec on load?
    4547FIELD dXccd,          X_CCD_ERR,    short,          X coord error on chip,         pixels
    4648FIELD dYccd,          Y_CCD_ERR,    short,          Y coord error on chip,         pixels
     
    5456FIELD dophot,         DOPHOT,       char,           dophot type
    5557
    56 FIELD dummy,          DUMMY,        char[2],        padding
     58FIELD dummy,          DUMMY,        char[6],        padding
  • trunk/Ohana/src/libautocode/def/photcode-ps1-dev-1.d

    r15694 r16810  
    66
    77# elements of data structure / FITS table
    8 FIELD  code,         CODE,          unsigned short, code number (stored in Measure.source)
    9 FIELD  name,         NAME,          char[32],       name for filter combination
    10 FIELD  type,         TYPE,          char,           PRI/SEC/DEP/REF
    11 FIELD  dummy,        DUMMY,        char[3],        padding
    12 FIELD  C,            C_LAM,        short,          primary phot calibration terms (millimags)
    13 FIELD  dC,           C_LAM_ERR,    short,          primary phot calibration terms (millimags)
    14 FIELD  dX,           X_ERR,        short,          primary phot calibration terms (millimags)
    15 FIELD  K,            K,            float,          secondary phot calibration terms (millimags)
    16 FIELD  c1,           C1,            int,            color is average.M[c1] - average.M[c2]
    17 FIELD  c2,           C2,            int,            color is average.M[c1] - average.M[c2]
    18 FIELD  equiv,        EQUIV,        int,            this dependent filter is equivalent to equiv PRI/SEC
    19 FIELD  Nc,           NC,            int,            number of color terms
    20 FIELD  X,            X,            float[4],       color terms $X[0]*mc + X[1]*mc^2 + X[2]*mc^3$, etc
    21 FIELD  astromScale,  ASTROM_SCALE,  float,          astrom error = mag error * astromScale
    22 FIELD  photSysErr,   PHOT_SYS_ERR, float,          systematic photometric error
    23 FIELD  padding,      PADDING,       float[4],       placeholder
     8FIELD  code,              CODE,                  unsigned short, code number (stored in Measure.source)
     9FIELD  name,              NAME,                  char[32],       name for filter combination
     10FIELD  type,              TYPE,                  char,           PRI/SEC/DEP/REF
     11FIELD  dummy,             DUMMY,                char[3],        padding
     12FIELD  C,                 C_LAM,                short,          primary phot calibration terms (millimags)
     13FIELD  dC,                C_LAM_ERR,            short,          primary phot calibration terms (millimags)
     14FIELD  dX,                X_ERR,                short,          primary phot calibration terms (millimags)
     15FIELD  K,                 K,                    float,          secondary phot calibration terms (millimags)
     16FIELD  c1,                C1,                    int,            color is average.M[c1] - average.M[c2]
     17FIELD  c2,                C2,                    int,            color is average.M[c1] - average.M[c2]
     18FIELD  equiv,             EQUIV,                int,            this dependent filter is equivalent to equiv PRI/SEC
     19FIELD  Nc,                NC,                    int,            number of color terms
     20FIELD  X,                 X,                    float[4],       color terms $X[0]*mc + X[1]*mc^2 + X[2]*mc^3$, etc
     21FIELD  astromErrMagScale, ASTROM_ERR_MAG_SCALE,  float,          astrometric error / mag error scale
     22FIELD  photomErrSys,      PHOTOM_ERR_SYS,        float,          systematic photometric error
     23FIELD  padding,           PADDING,               float[4],       placeholder
  • trunk/Ohana/src/libautocode/def/photcode-ps1-dev-2.d

    r16266 r16810  
    1 STRUCT       PhotCode_PS1_DEV_1
    2 EXTNAME      DVO_PHOTCODE_PS1_DEV_1
     1STRUCT       PhotCode_PS1_DEV_2
     2EXTNAME      DVO_PHOTCODE_PS1_DEV_2
    33TYPE         BINTABLE
    4 SIZE         104
     4SIZE         96
    55DESCRIPTION  DVO Photcode Description Table
    66
    77# elements of data structure / FITS table
    8 FIELD  code,         CODE,          unsigned short, code number (stored in Measure.source)
    9 FIELD  name,         NAME,          char[32],       name for filter combination
    10 FIELD  type,         TYPE,          char,           PRI/SEC/DEP/REF
    11 FIELD  dummy,        DUMMY,         char[3],        padding
    12 FIELD  C,            C_LAM,         short,          primary phot calibration terms (millimags)
    13 FIELD  dC,           C_LAM_ERR,     short,          primary phot calibration terms (millimags)
    14 FIELD  dX,           X_ERR,         short,          primary phot calibration terms (millimags)
    15 FIELD  K,            K,             float,          secondary phot calibration terms (millimags)
    16 FIELD  c1,           C1,            int,            color is average.M[c1] - average.M[c2]
    17 FIELD  c2,           C2,            int,            color is average.M[c1] - average.M[c2]
    18 FIELD  equiv,        EQUIV,         int,            this dependent filter is equivalent to equiv PRI/SEC
    19 FIELD  Nc,           NC,            int,            number of color terms
    20 FIELD  X,            X,             float[4],       color terms $X[0]*mc + X[1]*mc^2 + X[2]*mc^3$, etc
    21 FIELD  astromScale,  ASTROM_SCALE,  float,          astrom error = mag error * astromScale
    22 FIELD  photSysErr,   PHOT_SYS_ERR,  float,          systematic photometric error
    23 FIELD  padding,      PADDING,       float[4],       placeholder
     8FIELD  code,              CODE,                  unsigned short, code number (stored in Measure.source)
     9FIELD  name,              NAME,                  char[32],       name for filter combination
     10FIELD  type,              TYPE,                  char,           PRI/SEC/DEP/REF
     11FIELD  dummy,             DUMMY,                 char[3],        padding
     12FIELD  C,                 C_LAM,                 short,          primary phot calibration terms (millimags)
     13FIELD  dC,                C_LAM_ERR,             short,          primary phot calibration terms (millimags)
     14FIELD  dX,                X_ERR,                 short,          primary phot calibration terms (millimags)
     15FIELD  K,                 K,                     float,          secondary phot calibration terms (millimags)
     16FIELD  c1,                C1,                    int,            color is average.M[c1] - average.M[c2]
     17FIELD  c2,                C2,                    int,            color is average.M[c1] - average.M[c2]
     18FIELD  equiv,             EQUIV,                 int,            this dependent filter is equivalent to equiv PRI/SEC
     19FIELD  Nc,                NC,                    int,            number of color terms
     20FIELD  X,                 X,                     float[4],       color terms $X[0]*mc + X[1]*mc^2 + X[2]*mc^3$, etc
     21FIELD  astromErrSys,      ASTROM_ERR_SYS,        float,          systematic astrometry error (arcsec)
     22FIELD  astromErrScale,    ASTROM_ERR_SCALE,      float,          astrometric error scale
     23FIELD  astromErrMagScale, ASTROM_ERR_MAG_SCALE,  float,          astrometric error / mag error scale
     24FIELD  photomErrSys,      PHOTOM_ERR_SYS,        float,          systematic photometric error
     25
     26#   dR_total^2 =  dR_sys^2 + AS * dR_obs^2 + MS * dM_obs^2
     27#   dR_sys : systematicAstrometryError
     28#   AS     : astrometryErrorScale
     29#   MS     : astrometryErrorMagScale
  • trunk/Ohana/src/libautocode/def/photcode.d

    r15694 r16810  
    22EXTNAME      DVO_PHOTCODE_RAW
    33TYPE         BINTABLE
    4 SIZE         104
     4SIZE         96
    55DESCRIPTION  DVO Photcode Description Table
    66
    77# elements of data structure / FITS table
    8 FIELD  code,         CODE,          unsigned short, code number (stored in Measure.source)
    9 FIELD  name,         NAME,          char[32],       name for filter combination
    10 FIELD  type,         TYPE,          char,           PRI/SEC/DEP/REF
    11 FIELD  dummy,        DUMMY,         char[3],        padding
    12 FIELD  C,            C_LAM,         short,          primary phot calibration terms (millimags)
    13 FIELD  dC,           C_LAM_ERR,     short,          primary phot calibration terms (millimags)
    14 FIELD  dX,           X_ERR,         short,          primary phot calibration terms (millimags)
    15 FIELD  K,            K,             float,          secondary phot calibration terms (millimags)
    16 FIELD  c1,           C1,            int,            color is average.M[c1] - average.M[c2]
    17 FIELD  c2,           C2,            int,            color is average.M[c1] - average.M[c2]
    18 FIELD  equiv,        EQUIV,         int,            this dependent filter is equivalent to equiv PRI/SEC
    19 FIELD  Nc,           NC,            int,            number of color terms
    20 FIELD  X,            X,             float[4],       color terms $X[0]*mc + X[1]*mc^2 + X[2]*mc^3$, etc
    21 FIELD  astromScale,  ASTROM_SCALE,  float,          astrom error = mag error * astromScale
    22 FIELD  photSysErr,   PHOT_SYS_ERR,  float,          systematic photometric error
    23 FIELD  padding,      PADDING,       float[4],       placeholder
     8FIELD  code,              CODE,                  unsigned short, code number (stored in Measure.source)
     9FIELD  name,              NAME,                  char[32],       name for filter combination
     10FIELD  type,              TYPE,                  char,           PRI/SEC/DEP/REF
     11FIELD  dummy,             DUMMY,                 char[3],        padding
     12FIELD  C,                 C_LAM,                 short,          primary phot calibration terms (millimags)
     13FIELD  dC,                C_LAM_ERR,             short,          primary phot calibration terms (millimags)
     14FIELD  dX,                X_ERR,                 short,          primary phot calibration terms (millimags)
     15FIELD  K,                 K,                     float,          secondary phot calibration terms (millimags)
     16FIELD  c1,                C1,                    int,            color is average.M[c1] - average.M[c2]
     17FIELD  c2,                C2,                    int,            color is average.M[c1] - average.M[c2]
     18FIELD  equiv,             EQUIV,                 int,            this dependent filter is equivalent to equiv PRI/SEC
     19FIELD  Nc,                NC,                    int,            number of color terms
     20FIELD  X,                 X,                     float[4],       color terms $X[0]*mc + X[1]*mc^2 + X[2]*mc^3$, etc
     21FIELD  astromErrSys,      ASTROM_ERR_SYS,        float,          systematic astrometry error (arcsec)
     22FIELD  astromErrScale,    ASTROM_ERR_SCALE,      float,          astrometric error scale
     23FIELD  astromErrMagScale, ASTROM_ERR_MAG_SCALE,  float,          astrometric error / mag error scale
     24FIELD  photomErrSys,      PHOTOM_ERR_SYS,        float,          systematic photometric error
     25
     26#   dR_total^2 =  dR_sys^2 + AS * dR_obs^2 + MS * dM_obs^2
     27#   dR_sys : systematicAstrometryError
     28#   AS     : astrometryErrorScale
     29#   MS     : astrometryErrorMagScale
  • trunk/Ohana/src/libautocode/def/ps1_dev_0.d

    r12461 r16810  
    1616FIELD sky,      SKY,              float,    sky flux,             cnts/sec
    1717FIELD dSky,     SKY_SIG,          float,    sky flux errorf       cnts/sec
    18 FIELD psfProb,  PSF_PROBABILITY,  float,    psf probability
     18FIELD psfChisq, PSF_CHISQ,        float,    psf fit chisq
    1919FIELD fx,       PSF_WIDTH_X,      float,    semi-major,           pixels
    2020FIELD fy,       PSF_WIDTH_Y,      float,    semi-minor,           pixels
  • trunk/Ohana/src/libautocode/def/ps1_dev_1.d

    r15038 r16810  
    1616FIELD sky,       SKY,              float,    sky flux,             cnts/sec
    1717FIELD dSky,      SKY_SIG,          float,    sky flux errorf       cnts/sec
    18 FIELD psfProb,   PSF_PROBABILITY,  float,    psf probability
     18FIELD psfChisq,  PSF_CHISQ,        float,    psf fit chisq
    1919FIELD crNsigma,  CR_NSIGMA,        float,    Nsigma deviations from PSF to CF
    2020FIELD extNsigma, EXT_NSIGMA,       float,    Nsigma deviations from PSF to EXT
  • trunk/Ohana/src/libautocode/def/secfilt-ps1-dev-2.d

    r16266 r16810  
    1 STRUCT       SecFilt_PS1_DEV_1
    2 EXTNAME      DVO_SECFILT_PS1_DEV_1
     1STRUCT       SecFilt_PS1_DEV_2
     2EXTNAME      DVO_SECFILT_PS1_DEV_2
    33TYPE         BINTABLE
    44SIZE         16
  • trunk/Ohana/src/libdvo/Makefile

    r16139 r16810  
    2929$(DESTINC)/panstarrs_dev_0_defs.h \
    3030$(DESTINC)/panstarrs_dev_1_defs.h \
    31 $(DESTINC)/ps1_dev_1_defs.h
     31$(DESTINC)/ps1_dev_1_defs.h \
     32$(DESTINC)/ps1_dev_2_defs.h
    3233
    3334INCS = $(DEFS) $(DESTINC)/dvo.h $(DESTINC)/autocode.h
     
    3738$(SRC)/coordops.$(ARCH).o        \
    3839$(SRC)/dvosorts.$(ARCH).o        \
    39 $(SRC)/dvo_photcode_ops.$(ARCH).o \
    40 $(SRC)/dvo_photcode_convert_elixir.$(ARCH).o \
    41 $(SRC)/dvo_photcode_convert_ps1_dev_1.$(ARCH).o \
    4240$(SRC)/dvo_photcode_ops.$(ARCH).o \
    4341$(SRC)/LoadPhotcodes.$(ARCH).o   \
     
    6462$(SRC)/dvo_convert_panstarrs_DEV_1.$(ARCH).o \
    6563$(SRC)/dvo_convert_PS1_DEV_1.$(ARCH).o \
     64$(SRC)/dvo_convert_PS1_DEV_2.$(ARCH).o \
    6665$(SRC)/skyregion_io.$(ARCH).o    \
    6766$(SRC)/skyregion_gsc.$(ARCH).o    \
  • trunk/Ohana/src/libdvo/include/dvo.h

    r16057 r16810  
    1616              DVO_FORMAT_PANSTARRS_DEV_0,
    1717              DVO_FORMAT_PANSTARRS_DEV_1,
    18               DVO_FORMAT_PS1_DEV_1
     18              DVO_FORMAT_PS1_DEV_1,
     19              DVO_FORMAT_PS1_DEV_2
    1920} DVOTableFormat;
    2021
     
    215216  struct Catalog *secfilt_catalog;              /* secfilt catalog data (split) */
    216217
     218  unsigned int objID;
     219  unsigned int catID;
     220
    217221  /* extra catalog information */
    218222  int lockmode;
     
    383387# include "panstarrs_dev_1_defs.h"
    384388# include "ps1_dev_1_defs.h"
     389# include "ps1_dev_2_defs.h"
    385390
    386391/*** DVO image db I/O Functions ***/
  • trunk/Ohana/src/libdvo/src/LoadPhotcodesFITS.c

    r15694 r16810  
    5050    photcode = PhotCode_PS1_DEV_1_To_Internal (photcode_ps1_dev_1, Ncode);
    5151    free (photcode_ps1_dev_1);
     52  }
     53
     54  if (!strcmp (extname, "DVO_PHOTCODE_PS1_DEV_2")) {
     55    PhotCode_PS1_DEV_2 *photcode_ps1_dev_2 = gfits_table_get_PhotCode_PS1_DEV_2 (&db.ftable, &Ncode, &db.swapped);
     56    photcode = PhotCode_PS1_DEV_2_To_Internal (photcode_ps1_dev_2, Ncode);
     57    free (photcode_ps1_dev_2);
    5258  }
    5359
  • trunk/Ohana/src/libdvo/src/LoadPhotcodesText.c

    r15694 r16810  
    2727  char *c;
    2828  char line[256], **c1_names, **c2_names, **eq_names;
    29   char name[32], type[32], Zero[32], Airmass[32], Offset[32],
    30     C1[32], C2[32], Slope[32], Color[32], Primary[32];
     29  char name[32], type[32], Zero[32], Airmass[32], Offset[32];
     30  char C1[32], C2[32], Slope[32], Color[32], Primary[32];
     31  char astromErrSys[32], astromErrScale[32], astromErrMagScale[32], photomErrSys[32];
    3132
    3233  table = GetPhotcodeTable ();
     
    6061    for (c = line; isspace (*c); c++);
    6162    if (*c == '#') continue;
    62     Nfield = sscanf (c, "%d %s %s %s %s %s %s %s %s %s %s",
    63                      &code, name, type, Zero, Airmass, Offset, C1, C2, Slope, Color, Primary);
    64 
    65     // XXX to add the AstromError (and PhotError) terms, we need to add them to the photcode structure, and
    66     // define methods to read (at least) the old and the new photcode versions.
    67 
    68     if (Nfield != 11) { continue; }
    69    
     63    Nfield = sscanf (c, "%d %s %s %s %s %s %s %s %s %s %s %s %s %s %s",
     64                     &code, name, type, Zero, Airmass, Offset, C1, C2, Slope, Color, Primary, astromErrSys, astromErrScale, astromErrMagScale, photomErrSys);
     65
     66    switch (Nfield) {
     67      case 11:
     68        // minimum number of fields : original elixir layout
     69        strcpy (astromErrSys,      "0.0");
     70        strcpy (astromErrScale,    "0.0");
     71        strcpy (astromErrMagScale, "0.0");
     72        strcpy (photomErrSys,      "0.0");
     73        break;
     74      case 14:
     75        // allow only astrom elements
     76        strcpy (photomErrSys,      "0.0");
     77        break;
     78      case 15:
     79        // all fields defined
     80        break;
     81      default:
     82        // skip unknown layouts
     83        continue;
     84    }
     85
    7086    if (!code) {
    7187        fprintf (stderr, "photcode values may not be 0: fix %s\n", name);
     
    95111      photcode[Ncode].type  = PHOT_ALT;
    96112    }
     113
     114    photcode[Ncode].astromErrSys      = atof (astromErrSys);
     115    photcode[Ncode].astromErrScale    = atof (astromErrScale);
     116    photcode[Ncode].astromErrMagScale = atof (astromErrMagScale);
     117    photcode[Ncode].photomErrSys      = atof (photomErrSys);
    97118
    98119    switch (photcode[Ncode].type) {
  • trunk/Ohana/src/libdvo/src/SavePhotcodesFITS.c

    r15694 r16810  
    2929  // for the moment, we simply support the latest photcode format for output
    3030  // XXX update this as needed as new formats are defined
    31   PhotCode_PS1_DEV_1 *photcode_output = PhotCode_Internal_To_PS1_DEV_1 (table[0].code, table[0].Ncode);
     31  PhotCode_PS1_DEV_2 *photcode_output = PhotCode_Internal_To_PS1_DEV_2 (table[0].code, table[0].Ncode);
    3232
    3333  /* convert FITS format data to internal format (byteswaps & EXTNAME) */
    3434  gfits_db_create (&db);
    35   gfits_table_set_PhotCode_PS1_DEV_1 (&db.ftable, photcode_output, table[0].Ncode);
     35  gfits_table_set_PhotCode_PS1_DEV_2 (&db.ftable, photcode_output, table[0].Ncode);
    3636  gfits_db_save (&db);
    3737  gfits_db_close (&db);
  • trunk/Ohana/src/libdvo/src/dvo_catalog.c

    r16057 r16810  
    5151  if (!strcasecmp (catformat, "PANSTARRS_DEV_1")) return (DVO_FORMAT_PANSTARRS_DEV_1);
    5252  if (!strcasecmp (catformat, "PS1_DEV_1"))       return (DVO_FORMAT_PS1_DEV_1);
     53  if (!strcasecmp (catformat, "PS1_DEV_2"))       return (DVO_FORMAT_PS1_DEV_2);
    5354  return (DVO_FORMAT_UNDEF);
    5455}
  • trunk/Ohana/src/libdvo/src/dvo_catalog_chipcoords.c

    r12332 r16810  
    5454 
    5555  for (i = 0; i < catalog[0].Naverage; i++) {
    56     m = average[i].offset;
    57     for (j = 0; j < average[i].Nm; j++, m++) {
     56    m = average[i].measureOffset;
     57    for (j = 0; j < average[i].Nmeasure; j++, m++) {
    5858      ra  = average[i].R - measure[m].dR / 3600.0;
    5959      dec = average[i].D - measure[m].dD / 3600.0;
  • trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c

    r15743 r16810  
    7373      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    7474      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
     75      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
    7576
    7677    default:
     
    188189  if (catalog[0].catflags & LOAD_AVES) {
    189190    for (i = Nmeas = Nmiss = 0; i < catalog[0].Naverage; i++) {
    190       Nmeas += catalog[0].average[i].Nm;
    191       Nmiss += catalog[0].average[i].Nn;
     191      Nmeas += catalog[0].average[i].Nmeasure;
     192      Nmiss += catalog[0].average[i].Nmissing;
    192193    }
    193194    if ((Nmeas != catalog[0].Nmeasure) || (Nmiss != catalog[0].Nmissing)) {
     
    256257  if (catalog[0].catformat == DVO_FORMAT_PANSTARRS_DEV_1) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PANSTARRS_DEV_1");
    257258  if (catalog[0].catformat == DVO_FORMAT_PS1_DEV_1)       gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_DEV_1");
     259  if (catalog[0].catformat == DVO_FORMAT_PS1_DEV_2)       gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_DEV_2");
    258260
    259261  /* rewind file pointers and truncate file */
     
    350352      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    351353      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
     354      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
    352355
    353356    default:
     
    395398      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    396399      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
     400      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
    397401
    398402    default:
     
    444448      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    445449      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
     450      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
    446451
    447452    default:
     
    489494      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    490495      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
     496      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
    491497
    492498    default:
     
    538544      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    539545      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
     546      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
    540547
    541548    default:
     
    583590      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    584591      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
     592      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
    585593
    586594    default:
  • trunk/Ohana/src/libdvo/src/dvo_convert.c

    r15487 r16810  
    4848  CONVERT_FORMAT ("DVO_AVERAGE_PANSTARRS_DEV_1", PANSTARRS_DEV_1, Panstarrs_DEV_1);
    4949  CONVERT_FORMAT ("DVO_AVERAGE_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
     50  CONVERT_FORMAT ("DVO_AVERAGE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
    5051# undef CONVERT_FORMAT
    5152
     
    7778      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    7879      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
     80      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
    7981# undef FORMAT_CASE
    8082
     
    119121  CONVERT_FORMAT ("DVO_MEASURE_PANSTARRS_DEV_1", PANSTARRS_DEV_1, Panstarrs_DEV_1);
    120122  CONVERT_FORMAT ("DVO_MEASURE_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
     123  CONVERT_FORMAT ("DVO_MEASURE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
    121124# undef CONVERT_FORMAT
    122125
     
    148151      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    149152      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
     153      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
    150154# undef FORMAT_CASE
    151155
     
    190194  CONVERT_FORMAT ("DVO_SECFILT_PANSTARRS_DEV_1", PANSTARRS_DEV_1, Panstarrs_DEV_1);
    191195  CONVERT_FORMAT ("DVO_SECFILT_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
     196  CONVERT_FORMAT ("DVO_SECFILT_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
    192197# undef CONVERT_FORMAT
    193198
     
    219224      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    220225      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
     226      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
    221227# undef FORMAT_CASE
    222228
     
    281287  CONVERT_FORMAT ("DVO_IMAGE_PANSTARRS_DEV_1", PANSTARRS_DEV_1, Panstarrs_DEV_1);
    282288  CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
     289  CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
    283290# undef CONVERT_FORMAT
    284291
     
    313320      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    314321      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
     322      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
    315323# undef FORMAT_CASE
    316324
     
    361369      FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
    362370      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
     371      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
    363372# undef FORMAT_CASE
    364373
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c

    r15038 r16810  
    11# include <dvo.h>
    22
    3 // XXX these functions ahve to be adjusted to agree with the new definition of PS1_DEV_1
    4 
    5 /* convert panstarrs-format measures to internal measures */
     3/* convert PS1_DEV_1 formats to internal formats */
     4
    65Measure *Measure_PS1_DEV_1_ToInternal (Measure_PS1_DEV_1 *in, int Nvalues) {
    76
     
    1615    out[i].M          = in[i].M;
    1716    out[i].Mcal       = in[i].Mcal;
    18     out[i].Mgal       = in[i].Mgal;
     17    out[i].Map        = in[i].Mgal;
    1918    out[i].dM         = in[i].dM;
    2019    out[i].dt         = in[i].dt;
     
    3029    out[i].imageID    = in[i].imageID;
    3130    out[i].qPSF       = in[i].qPSF;
    32     out[i].psfProb    = in[i].psfProb;
     31    out[i].psfChisq   = in[i].psfChisq;
    3332    out[i].crNsigma   = in[i].crNsigma;
    3433    out[i].extNsigma  = in[i].extNsigma;
     
    4746}
    4847
    49 /* convert internal measures to panstarrs-format measures */
    5048Measure_PS1_DEV_1 *MeasureInternalTo_PS1_DEV_1 (Measure *in, int Nvalues) {
    5149
     
    6058    out[i].M          = in[i].M;
    6159    out[i].Mcal       = in[i].Mcal;
    62     out[i].Mgal       = in[i].Mgal;
     60    out[i].Mgal       = in[i].Map;
    6361    out[i].dM         = in[i].dM;
    6462    out[i].dt         = in[i].dt;
     
    7472    out[i].imageID    = in[i].imageID;
    7573    out[i].qPSF       = in[i].qPSF;
    76     out[i].psfProb    = in[i].psfProb;
     74    out[i].psfChisq   = in[i].psfChisq;
    7775    out[i].crNsigma   = in[i].crNsigma;
    7876    out[i].extNsigma  = in[i].extNsigma;
     
    9189}
    9290
    93 /* convert panstarrs-format averages to internal averages */
    94 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used
     91// 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
    9592Average *Average_PS1_DEV_1_ToInternal (Average_PS1_DEV_1 *in, int Nvalues, SecFilt **primary) {
    9693
     
    9996
    10097  ALLOCATE (out, Average, Nvalues);
     98
     99  for (i = 0; i < Nvalues; i++) {
     100    out[i].R             = in[i].R;     
     101    out[i].D             = in[i].D;     
     102    out[i].Xp            = in[i].Xp;     
     103    out[i].Nmeasure      = in[i].Nm;     
     104    out[i].Nmissing      = in[i].Nn;     
     105    out[i].code          = in[i].code;   
     106    out[i].measureOffset = in[i].offset;
     107    out[i].missingOffset = in[i].missing;
     108    out[i].dR            = in[i].dR;
     109    out[i].dD            = in[i].dD;
     110    out[i].uR            = in[i].uR;
     111    out[i].uD            = in[i].uD;
     112    out[i].duR           = in[i].duR;
     113    out[i].duD           = in[i].duD;
     114    out[i].P             = in[i].P;
     115    out[i].dP            = in[i].dP;
     116    out[i].objID         = in[i].objID;
     117    out[i].catID         = in[i].catID;
     118  }
     119  return (out);
     120}
     121
     122// 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
     123Average_PS1_DEV_1 *AverageInternalTo_PS1_DEV_1 (Average *in, int Nvalues, SecFilt *primary) {
     124
     125  int i;
     126  Average_PS1_DEV_1 *out;
     127
     128  ALLOCATE (out, Average_PS1_DEV_1, Nvalues);
    101129
    102130  for (i = 0; i < Nvalues; i++) {
     
    104132    out[i].D        = in[i].D;     
    105133    out[i].Xp       = in[i].Xp;     
    106     out[i].Nm       = in[i].Nm;     
    107     out[i].Nn       = in[i].Nn;     
     134    out[i].Nm       = in[i].Nmeasure;     
     135    out[i].Nn       = in[i].Nmissing;     
    108136    out[i].code     = in[i].code;   
    109     out[i].offset   = in[i].offset;
    110     out[i].missing  = in[i].missing;
     137    out[i].offset   = in[i].measureOffset;
     138    out[i].missing  = in[i].missingOffset;
    111139    out[i].dR       = in[i].dR;
    112140    out[i].dD       = in[i].dD;
     
    117145    out[i].P        = in[i].P;
    118146    out[i].dP       = in[i].dP;
    119     out[i].objID_hi = in[i].objID_hi;
    120     out[i].objID_lo = in[i].objID_lo;
    121   }
    122   return (out);
    123 }
    124 
    125 /* convert internal averages to panstarrs-format averages */
    126 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used
    127 Average_PS1_DEV_1 *AverageInternalTo_PS1_DEV_1 (Average *in, int Nvalues, SecFilt *primary) {
    128 
    129   int i;
    130   Average_PS1_DEV_1 *out;
    131 
    132   ALLOCATE (out, Average_PS1_DEV_1, Nvalues);
    133 
    134   for (i = 0; i < Nvalues; i++) {
    135     out[i].R        = in[i].R;     
    136     out[i].D        = in[i].D;     
    137     out[i].Xp       = in[i].Xp;     
    138     out[i].Nm       = in[i].Nm;     
    139     out[i].Nn       = in[i].Nn;     
    140     out[i].code     = in[i].code;   
    141     out[i].offset   = in[i].offset;
    142     out[i].missing  = in[i].missing;
    143     out[i].dR       = in[i].dR;
    144     out[i].dD       = in[i].dD;
    145     out[i].uR       = in[i].uR;
    146     out[i].uD       = in[i].uD;
    147     out[i].duR      = in[i].duR;
    148     out[i].duD      = in[i].duD;
    149     out[i].P        = in[i].P;
    150     out[i].dP       = in[i].dP;
    151     out[i].objID_hi = in[i].objID_hi;
    152     out[i].objID_lo = in[i].objID_lo;
    153   }
    154   return (out);
    155 }
    156 
    157 /* convert panstarrs-format secfilts to internal secfilts */
     147    out[i].objID    = in[i].objID;
     148    out[i].catID    = in[i].catID;
     149  }
     150  return (out);
     151}
     152
    158153SecFilt *SecFilt_PS1_DEV_1_ToInternal (SecFilt_PS1_DEV_1 *in, int Nvalues) {
    159154
     
    173168}
    174169
    175 /* convert internal secfilts to panstarrs-format secfilts */
    176170SecFilt_PS1_DEV_1 *SecFiltInternalTo_PS1_DEV_1 (SecFilt *in, int Nvalues) {
    177171
     
    191185}
    192186
    193 /* convert panstarrs-format images to internal images */
    194187Image *Image_PS1_DEV_1_ToInternal (Image_PS1_DEV_1 *in, int Nvalues) {
    195188
     
    300293  return (out);
    301294}
     295
     296PhotCode_PS1_DEV_1 *PhotCode_Internal_To_PS1_DEV_1 (PhotCode *in, int Nvalues) {
     297
     298  int i;
     299  PhotCode_PS1_DEV_1 *out;
     300
     301  ALLOCATE (out, PhotCode_PS1_DEV_1, Nvalues);
     302
     303  for (i = 0; i < Nvalues; i++) {
     304    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
     305    out[i].name[31] = 0; // force termination
     306
     307    out[i].code = in[i].code;         
     308    out[i].type = in[i].type;         
     309    out[i].C    = in[i].C;           
     310    out[i].dC   = in[i].dC;           
     311    out[i].dX   = in[i].dX;           
     312    out[i].K    = in[i].K;           
     313    out[i].c1   = in[i].c1;           
     314    out[i].c2   = in[i].c2;           
     315    out[i].equiv = in[i].equiv;       
     316    out[i].Nc = in[i].Nc;           
     317    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
     318
     319    out[i].astromErrMagScale = out[i].astromErrMagScale;
     320    out[i].photomErrSys      = out[i].photomErrSys;
     321
     322  }
     323  return (out);
     324}
     325
     326PhotCode *PhotCode_PS1_DEV_1_To_Internal (PhotCode_PS1_DEV_1 *in, int Nvalues) {
     327
     328  int i;
     329  PhotCode *out;
     330
     331  ALLOCATE (out, PhotCode, Nvalues);
     332
     333  for (i = 0; i < Nvalues; i++) {
     334    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
     335    out[i].name[31] = 0; // force termination
     336
     337    out[i].code  = in[i].code;         
     338    out[i].type  = in[i].type;         
     339    out[i].C     = in[i].C;           
     340    out[i].dC    = in[i].dC;           
     341    out[i].dX    = in[i].dX;           
     342    out[i].K     = in[i].K;           
     343    out[i].c1    = in[i].c1;           
     344    out[i].c2    = in[i].c2;           
     345    out[i].equiv = in[i].equiv;       
     346    out[i].Nc    = in[i].Nc;           
     347
     348    // not defined in PS1_DEV_1
     349    out[i].astromErrSys      = 0.0;
     350    out[i].astromErrScale    = 0.0;
     351    out[i].astromErrMagScale = in[i].astromErrMagScale;
     352    out[i].photomErrSys      = in[i].photomErrSys;
     353
     354    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
     355
     356  }
     357  return (out);
     358}
  • trunk/Ohana/src/libdvo/src/dvo_convert_elixir.c

    r15511 r16810  
    1616    out[i].dt       = (in[i].dt      == NAN_S_SHORT) ? NAN : in[i].dt     * 0.001;
    1717    out[i].Mcal     = (in[i].Mcal    == NAN_S_SHORT) ? NAN : in[i].Mcal   * 0.001;
    18     out[i].Mgal     = (in[i].Mgal    == NAN_S_SHORT) ? NAN : in[i].Mgal   * 0.001;
     18
     19    // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture
     20    // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
     21    out[i].Map      = (in[i].Mgal    == NAN_S_SHORT) ? NAN : in[i].Mgal   * 0.001;
    1922    out[i].airmass  = (in[i].airmass == NAN_S_SHORT) ? NAN : in[i].airmass* 0.001;
    2023    out[i].FWx      = in[i].FWx;
     
    3942    out[i].dSky      = 0;
    4043    out[i].qPSF      = 0;
    41     out[i].psfProb   = 0;
     44    out[i].psfChisq  = 0;
    4245    out[i].crNsigma  = 0;
    4346    out[i].extNsigma = 0;
     
    6669    out[i].dt       = isnan(in[i].dt     ) ? NAN_S_SHORT : in[i].dt      * 1000.0;
    6770    out[i].Mcal     = isnan(in[i].Mcal   ) ? NAN_S_SHORT : in[i].Mcal    * 1000.0;
    68     out[i].Mgal     = isnan(in[i].Mgal   ) ? NAN_S_SHORT : in[i].Mgal    * 1000.0;
     71    out[i].Mgal     = isnan(in[i].Map    ) ? NAN_S_SHORT : in[i].Map     * 1000.0;
    6972    out[i].airmass  = isnan(in[i].airmass) ? NAN_S_SHORT : in[i].airmass * 1000.0;
    7073
     
    9598
    9699  for (i = 0; i < Nvalues; i++) {
    97     out[i].R       = in[i].R;     
    98     out[i].D       = in[i].D;     
    99     out[i].Xp      = in[i].Xp;     
    100     out[i].Nm      = in[i].Nm;     
    101     out[i].Nn      = in[i].Nn;     
    102     out[i].code    = in[i].code;   
    103     out[i].offset = in[i].offset;
    104     out[i].missing = in[i].missing;
     100    out[i].R             = in[i].R;     
     101    out[i].D             = in[i].D;     
     102    out[i].Xp            = in[i].Xp;     
     103    out[i].Nmeasure      = in[i].Nm;     
     104    out[i].Nmissing      = in[i].Nn;     
     105    out[i].code          = in[i].code;   
     106    out[i].measureOffset = in[i].offset;
     107    out[i].missingOffset = in[i].missing;
    105108
    106109    /* these don't exist in Elixir */
     
    115118
    116119    /* XXX add these later */
    117     out[i].objID_hi = 0;
    118     out[i].objID_lo = 0;
     120    out[i].objID  = 0;
     121    out[i].catID  = 0;
    119122
    120123    primary[0][i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
     
    139142    out[i].D       = in[i].D;     
    140143    out[i].Xp      = in[i].Xp;     
    141     out[i].Nm      = in[i].Nm;     
    142     out[i].Nn      = in[i].Nn;     
     144    out[i].Nm      = in[i].Nmeasure;     
     145    out[i].Nn      = in[i].Nmissing;     
    143146    out[i].code    = in[i].code;   
    144     out[i].offset  = in[i].offset;
    145     out[i].missing = in[i].missing;
     147    out[i].offset  = in[i].measureOffset;
     148    out[i].missing = in[i].missingOffset;
    146149
    147150    out[i].M       = isnan(primary[i].M)  ? NAN_S_SHORT : primary[i].M   * 1000.0;
     
    297300  return (out);
    298301}
     302
     303PhotCode_Elixir *PhotCode_Internal_To_Elixir (PhotCode *in, int Nvalues) {
     304
     305  int i;
     306  PhotCode_Elixir *out;
     307
     308  ALLOCATE (out, PhotCode_Elixir, Nvalues);
     309
     310  for (i = 0; i < Nvalues; i++) {
     311    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
     312    out[i].name[31] = 0; // force termination
     313
     314    out[i].code  = in[i].code;         
     315    out[i].type  = in[i].type;         
     316    out[i].C     = in[i].C;           
     317    out[i].dC    = in[i].dC;           
     318    out[i].dX    = in[i].dX;           
     319    out[i].K     = in[i].K;           
     320    out[i].c1    = in[i].c1;           
     321    out[i].c2    = in[i].c2;           
     322    out[i].equiv = in[i].equiv;       
     323    out[i].Nc    = in[i].Nc;           
     324    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
     325  }
     326  return (out);
     327}
     328
     329PhotCode *PhotCode_Elixir_To_Internal (PhotCode_Elixir *in, int Nvalues) {
     330
     331  int i;
     332  PhotCode *out;
     333
     334  ALLOCATE (out, PhotCode, Nvalues);
     335
     336  for (i = 0; i < Nvalues; i++) {
     337    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
     338    out[i].name[31] = 0; // force termination
     339
     340    out[i].code  = in[i].code;         
     341    out[i].type  = in[i].type;         
     342    out[i].C     = in[i].C;           
     343    out[i].dC    = in[i].dC;           
     344    out[i].dX    = in[i].dX;           
     345    out[i].K     = in[i].K;           
     346    out[i].c1    = in[i].c1;           
     347    out[i].c2    = in[i].c2;           
     348    out[i].equiv = in[i].equiv;       
     349    out[i].Nc    = in[i].Nc;           
     350    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
     351
     352    // not defined in Elixir:
     353    out[i].astromErrSys      = 0.0;
     354    out[i].astromErrScale    = 0.0;
     355    out[i].astromErrMagScale = 0.0;
     356    out[i].photomErrSys      = 0.0;
     357  }
     358  return (out);
     359}
  • trunk/Ohana/src/libdvo/src/dvo_convert_loneos.c

    r15511 r16810  
    2424
    2525    /* these values don't exist in the Loneos format */
    26     out[i].Mgal     = out[i].M;
    27     out[i].dt       = 0;
    28     out[i].airmass  = 0;
    29     out[i].az       = 0;
    30     out[i].FWx      = 0;
    31     out[i].FWy      = 0;
    32     out[i].theta    = 0;
    33     out[i].stargal  = 0;
    34     out[i].Sky      = 0;
    35     out[i].dSky     = 0;
    36     out[i].qPSF     = 0;
    37     out[i].psfProb   = 0;
     26
     27    // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture
     28    // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
     29    out[i].Map       = out[i].M;
     30    out[i].dt        = 0;
     31    out[i].airmass   = 0;
     32    out[i].az        = 0;
     33    out[i].FWx       = 0;
     34    out[i].FWy       = 0;
     35    out[i].theta     = 0;
     36    out[i].stargal   = 0;
     37    out[i].Sky       = 0;
     38    out[i].dSky      = 0;
     39    out[i].qPSF      = 0;
     40    out[i].psfChisq  = 0;
    3841    out[i].crNsigma  = 0;
    3942    out[i].extNsigma = 0;
     
    8790
    8891  for (i = 0; i < Nvalues; i++) {
    89     out[i].R       = in[i].R;     
    90     out[i].D       = in[i].D;     
    91     out[i].Xp      = in[i].Xp;     
    92     out[i].Nm      = in[i].Nm;     
    93     out[i].Nn      = in[i].Nn;     
    94     out[i].code    = in[i].code;   
    95     out[i].offset = in[i].offset;
    96     out[i].missing = in[i].missing;
     92    out[i].R             = in[i].R;     
     93    out[i].D             = in[i].D;     
     94    out[i].Xp            = in[i].Xp;     
     95    out[i].Nmeasure      = in[i].Nm;     
     96    out[i].Nmissing      = in[i].Nn;     
     97    out[i].code          = in[i].code;   
     98    out[i].measureOffset = in[i].offset;
     99    out[i].missingOffset = in[i].missing;
    97100
    98101    /* these don't exist in Loneos */
     
    107110
    108111    /* XXX add these later */
    109     out[i].objID_hi = 0;
    110     out[i].objID_lo = 0;
     112    out[i].objID  = 0;
     113    out[i].catID  = 0;
    111114
    112115    primary[0][i].M  = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
     
    131134    out[i].D       = in[i].D;     
    132135    out[i].Xp      = in[i].Xp;     
    133     out[i].Nm      = in[i].Nm;     
    134     out[i].Nn      = in[i].Nn;     
     136    out[i].Nm      = in[i].Nmeasure;     
     137    out[i].Nn      = in[i].Nmissing;     
    135138    out[i].code    = in[i].code;   
    136     out[i].offset  = in[i].offset;
    137     out[i].missing = in[i].missing;
     139    out[i].offset  = in[i].measureOffset;
     140    out[i].missing = in[i].missingOffset;
    138141
    139142    out[i].M       = isnan(primary[i].M)  ? NAN_S_SHORT : primary[i].M   * 1000.0;
  • trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c

    r15511 r16810  
    1515    out[i].dM         = in[i].dM;
    1616    out[i].Mcal       = in[i].Mcal;
    17     out[i].Mgal       = in[i].Mgal;
     17
     18    // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture
     19    // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
     20    out[i].Map        = in[i].Mgal;
    1821    out[i].airmass    = in[i].airmass;
    1922    out[i].az         = in[i].az;
     
    3942
    4043    // these don't have a correspondence
    41     out[i].psfProb   = 0;
     44    out[i].psfChisq  = 0;
    4245    out[i].crNsigma  = 0;
    4346    out[i].extNsigma = 0;
     
    6164    out[i].dM         = in[i].dM;
    6265    out[i].Mcal       = in[i].Mcal;
    63     out[i].Mgal       = in[i].Mgal;
     66    out[i].Mgal       = in[i].Map;
    6467    out[i].airmass    = in[i].airmass;
    6568    out[i].az         = in[i].az;
     
    99102
    100103  for (i = 0; i < Nvalues; i++) {
     104    out[i].R             = in[i].R;     
     105    out[i].D             = in[i].D;     
     106    out[i].Xp            = in[i].Xp;     
     107    out[i].Nmeasure      = in[i].Nm;     
     108    out[i].Nmissing      = in[i].Nn;     
     109    out[i].code          = in[i].code;   
     110    out[i].measureOffset = in[i].offset;
     111    out[i].missingOffset = in[i].missing;
     112    out[i].dR            = in[i].dR;
     113    out[i].dD            = in[i].dD;
     114    out[i].uR            = in[i].uR;
     115    out[i].uD            = in[i].uD;
     116    out[i].duR           = in[i].duR;
     117    out[i].duD           = in[i].duD;
     118    out[i].P             = in[i].P;
     119    out[i].dP            = in[i].dP;
     120    out[i].objID         = in[i].objID;
     121    out[i].catID         = in[i].catID;
     122  }
     123  return (out);
     124}
     125
     126/* convert internal averages to panstarrs-format averages */
     127// 'primary is needed to conform with the API for Loneos and Elixir, but is not used
     128Average_Panstarrs_DEV_0 *AverageInternalTo_Panstarrs_DEV_0 (Average *in, int Nvalues, SecFilt *primary) {
     129
     130  int i;
     131  Average_Panstarrs_DEV_0 *out;
     132
     133  ALLOCATE (out, Average_Panstarrs_DEV_0, Nvalues);
     134
     135  for (i = 0; i < Nvalues; i++) {
    101136    out[i].R        = in[i].R;     
    102137    out[i].D        = in[i].D;     
    103138    out[i].Xp       = in[i].Xp;     
    104     out[i].Nm       = in[i].Nm;     
    105     out[i].Nn       = in[i].Nn;     
     139    out[i].Nm       = in[i].Nmeasure;     
     140    out[i].Nn       = in[i].Nmissing;     
    106141    out[i].code     = in[i].code;   
    107     out[i].offset   = in[i].offset;
    108     out[i].missing  = in[i].missing;
     142    out[i].offset   = in[i].measureOffset;
     143    out[i].missing  = in[i].missingOffset;
    109144    out[i].dR       = in[i].dR;
    110145    out[i].dD       = in[i].dD;
     
    115150    out[i].P        = in[i].P;
    116151    out[i].dP       = in[i].dP;
    117     out[i].objID_hi = in[i].objID_hi;
    118     out[i].objID_lo = in[i].objID_lo;
    119   }
    120   return (out);
    121 }
    122 
    123 /* convert internal averages to panstarrs-format averages */
    124 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used
    125 Average_Panstarrs_DEV_0 *AverageInternalTo_Panstarrs_DEV_0 (Average *in, int Nvalues, SecFilt *primary) {
    126 
    127   int i;
    128   Average_Panstarrs_DEV_0 *out;
    129 
    130   ALLOCATE (out, Average_Panstarrs_DEV_0, Nvalues);
    131 
    132   for (i = 0; i < Nvalues; i++) {
    133     out[i].R        = in[i].R;     
    134     out[i].D        = in[i].D;     
    135     out[i].Xp       = in[i].Xp;     
    136     out[i].Nm       = in[i].Nm;     
    137     out[i].Nn       = in[i].Nn;     
    138     out[i].code     = in[i].code;   
    139     out[i].offset   = in[i].offset;
    140     out[i].missing  = in[i].missing;
    141     out[i].dR       = in[i].dR;
    142     out[i].dD       = in[i].dD;
    143     out[i].uR       = in[i].uR;
    144     out[i].uD       = in[i].uD;
    145     out[i].duR      = in[i].duR;
    146     out[i].duD      = in[i].duD;
    147     out[i].P        = in[i].P;
    148     out[i].dP       = in[i].dP;
    149     out[i].objID_hi = in[i].objID_hi;
    150     out[i].objID_lo = in[i].objID_lo;
     152    out[i].objID    = in[i].objID;
     153    out[i].catID    = in[i].catID;
    151154  }
    152155  return (out);
  • trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c

    r15511 r16810  
    1515    out[i].dM         = in[i].dM;
    1616    out[i].Mcal       = in[i].Mcal;
    17     out[i].Mgal       = in[i].Mgal;
     17
     18    // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture
     19    // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
     20    out[i].Map        = in[i].Mgal;
    1821    out[i].airmass    = in[i].airmass;
    1922    out[i].az         = in[i].az;
     
    3942
    4043    // these don't have a correspondence
    41     out[i].psfProb   = 0;
     44    out[i].psfChisq  = 0;
    4245    out[i].crNsigma  = 0;
    4346    out[i].extNsigma = 0;
     
    6164    out[i].dM         = in[i].dM;
    6265    out[i].Mcal       = in[i].Mcal;
    63     out[i].Mgal       = in[i].Mgal;
     66    out[i].Mgal       = in[i].Map;
    6467    out[i].airmass    = in[i].airmass;
    6568    out[i].az         = in[i].az;
     
    99102
    100103  for (i = 0; i < Nvalues; i++) {
     104    out[i].R             = in[i].R;     
     105    out[i].D             = in[i].D;     
     106    out[i].Xp            = in[i].Xp;     
     107    out[i].Nmeasure      = in[i].Nm;     
     108    out[i].Nmissing      = in[i].Nn;     
     109    out[i].code          = in[i].code;   
     110    out[i].measureOffset = in[i].offset;
     111    out[i].missingOffset = in[i].missing;
     112    out[i].dR            = in[i].dR;
     113    out[i].dD            = in[i].dD;
     114    out[i].uR            = in[i].uR;
     115    out[i].uD            = in[i].uD;
     116    out[i].duR           = in[i].duR;
     117    out[i].duD           = in[i].duD;
     118    out[i].P             = in[i].P;
     119    out[i].dP            = in[i].dP;
     120    out[i].objID         = in[i].objID;
     121    out[i].catID         = in[i].catID;
     122  }
     123  return (out);
     124}
     125
     126/* convert internal averages to panstarrs-format averages */
     127// 'primary is needed to conform with the API for Loneos and Elixir, but is not used
     128Average_Panstarrs_DEV_1 *AverageInternalTo_Panstarrs_DEV_1 (Average *in, int Nvalues, SecFilt *primary) {
     129
     130  int i;
     131  Average_Panstarrs_DEV_1 *out;
     132
     133  ALLOCATE (out, Average_Panstarrs_DEV_1, Nvalues);
     134
     135  for (i = 0; i < Nvalues; i++) {
    101136    out[i].R        = in[i].R;     
    102137    out[i].D        = in[i].D;     
    103138    out[i].Xp       = in[i].Xp;     
    104     out[i].Nm       = in[i].Nm;     
    105     out[i].Nn       = in[i].Nn;     
     139    out[i].Nm       = in[i].Nmeasure;     
     140    out[i].Nn       = in[i].Nmissing;     
    106141    out[i].code     = in[i].code;   
    107     out[i].offset   = in[i].offset;
    108     out[i].missing  = in[i].missing;
     142    out[i].offset   = in[i].measureOffset;
     143    out[i].missing  = in[i].missingOffset;
    109144    out[i].dR       = in[i].dR;
    110145    out[i].dD       = in[i].dD;
     
    115150    out[i].P        = in[i].P;
    116151    out[i].dP       = in[i].dP;
    117     out[i].objID_hi = in[i].objID_hi;
    118     out[i].objID_lo = in[i].objID_lo;
    119   }
    120   return (out);
    121 }
    122 
    123 /* convert internal averages to panstarrs-format averages */
    124 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used
    125 Average_Panstarrs_DEV_1 *AverageInternalTo_Panstarrs_DEV_1 (Average *in, int Nvalues, SecFilt *primary) {
    126 
    127   int i;
    128   Average_Panstarrs_DEV_1 *out;
    129 
    130   ALLOCATE (out, Average_Panstarrs_DEV_1, Nvalues);
    131 
    132   for (i = 0; i < Nvalues; i++) {
    133     out[i].R        = in[i].R;     
    134     out[i].D        = in[i].D;     
    135     out[i].Xp       = in[i].Xp;     
    136     out[i].Nm       = in[i].Nm;     
    137     out[i].Nn       = in[i].Nn;     
    138     out[i].code     = in[i].code;   
    139     out[i].offset   = in[i].offset;
    140     out[i].missing  = in[i].missing;
    141     out[i].dR       = in[i].dR;
    142     out[i].dD       = in[i].dD;
    143     out[i].uR       = in[i].uR;
    144     out[i].uD       = in[i].uD;
    145     out[i].duR      = in[i].duR;
    146     out[i].duD      = in[i].duD;
    147     out[i].P        = in[i].P;
    148     out[i].dP       = in[i].dP;
    149     out[i].objID_hi = in[i].objID_hi;
    150     out[i].objID_lo = in[i].objID_lo;
     152    out[i].objID    = in[i].objID;
     153    out[i].catID    = in[i].catID;
    151154  }
    152155  return (out);
  • trunk/Ohana/src/libdvo/src/dvo_image.c

    r15749 r16810  
    194194  if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_1) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PANSTARRS_DEV_1");
    195195  if (db[0].format == DVO_FORMAT_PS1_DEV_1)       gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_DEV_1");
     196  if (db[0].format == DVO_FORMAT_PS1_DEV_2)       gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_DEV_2");
    196197 
    197198  return;
  • trunk/Ohana/src/libdvo/src/dvo_image_raw.c

    r15487 r16810  
    5353  if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_1) ImageSize = sizeof(Image_Panstarrs_DEV_1);
    5454  if (db[0].format == DVO_FORMAT_PS1_DEV_1)       ImageSize = sizeof(Image_PS1_DEV_1);
     55  if (db[0].format == DVO_FORMAT_PS1_DEV_2)       ImageSize = sizeof(Image_PS1_DEV_2);
    5556
    5657  /* check that filesize makes sense */
     
    7677  if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_1) gfits_table_mkheader_Image_Panstarrs_DEV_1 (&db[0].theader);
    7778  if (db[0].format == DVO_FORMAT_PS1_DEV_1)       gfits_table_mkheader_Image_PS1_DEV_1 (&db[0].theader);
     79  if (db[0].format == DVO_FORMAT_PS1_DEV_2)       gfits_table_mkheader_Image_PS1_DEV_2 (&db[0].theader);
    7880   
    7981  /* read data from file */
  • trunk/Ohana/src/libdvo/src/dvo_photcode_ops.c

    r15514 r16810  
    370370  if (color == NULL) return (NAN);
    371371  if (color[0].type == PHOT_REF) {
    372     for (i = 0; (i < average[0].Nm) && (isnan(m1)); i++) {
     372    for (i = 0; (i < average[0].Nmeasure) && (isnan(m1)); i++) {
    373373      if (measure[i].photcode == color[0].code) {
    374374        m1 = measure[i].M;
     
    384384  if (color == NULL) return (NAN);
    385385  if (color[0].type == PHOT_REF) {
    386     for (i = 0; (i < average[0].Nm) && (isnan(m2)); i++) {
     386    for (i = 0; (i < average[0].Nmeasure) && (isnan(m2)); i++) {
    387387      if (measure[i].photcode == color[0].code) {
    388388        m2 = measure[i].M;
     
    466466  if (code == NULL) return (FALSE);
    467467  if (code[0].type == PHOT_REF) {
    468     for (i = 0; i < average[0].Nm; i++) {
     468    for (i = 0; i < average[0].Nmeasure; i++) {
    469469      if (measure[i].photcode == c1) {
    470470        M1 = measure[i].M;
     
    482482  if (code == NULL) return (FALSE);
    483483  if (code[0].type == PHOT_REF) {
    484     for (i = 0; i < average[0].Nm; i++) {
     484    for (i = 0; i < average[0].Nmeasure; i++) {
    485485      if (measure[i].photcode == c2) {
    486486        M2 = measure[i].M;
  • trunk/Ohana/src/libfits/include/gfitsio.h

    r15751 r16810  
    184184int     gfits_get_bintable_column      PROTO((Header *header, FTable *table, char *label, void **data));
    185185int     gfits_get_bintable_column_type PROTO((Header *header, char *label, char *type, int *Nval));
     186void   *gfits_get_bintable_column_data PROTO((Header *header, FTable *table, char *label, char *type, int *Nrow, int *Ncol));
    186187int     gfits_get_table_column         PROTO((Header *header, FTable *table, char *label, void **data));
    187188int     gfits_get_table_column_type    PROTO((Header *header, char *label, char *type));
  • trunk/Ohana/src/libfits/table/F_get_column.c

    r16139 r16810  
    1414  tmp = Pin[2]; Pin[2] = Pin[5]; Pin[5] = tmp; \
    1515  tmp = Pin[3]; Pin[3] = Pin[4]; Pin[4] = tmp; }
     16
     17void *gfits_get_bintable_column_data (Header *header, FTable *table, char *label, char *type, int *Nrow, int *Ncol) {
     18
     19  int i, N, Nfields, Nval, Nbytes, Nx, Ny, Nstart, Nv, Nb;
     20  char tlabel[80], field[80], format[80], tmpline[16];
     21  char *Pin, *Pout, *array;
     22  double Bscale, Bzero;
     23
     24  if (label == (char *) NULL) return (NULL);
     25  if (label[0] == 0) return (NULL);
     26
     27  /* find label in header */
     28  tlabel[0] = 0;
     29  if (!gfits_scan (header, "TFIELDS", "%d", 1, &Nfields)) return (NULL);
     30  for (i = 1; strcmp (label, tlabel) && (i < Nfields + 1); i++) {
     31    sprintf (field, "TTYPE%d", i);
     32    gfits_scan (header, field, "%s", 1, tlabel);
     33  }
     34  if (strcmp (label, tlabel)) return (NULL);
     35  N = i - 1;
     36
     37  Bscale = 1;
     38  Bzero  = 0;
     39
     40  /* interpret format */
     41  sprintf (field, "TSCAL%d", N);
     42  gfits_scan (header, field, "%lf", 1, &Bscale);
     43  sprintf (field, "TZERO%d", N);
     44  gfits_scan (header, field, "%lf", 1, &Bzero);
     45  sprintf (field, "TFORM%d", N);
     46  gfits_scan (header, field, "%s", 1, format);
     47
     48  if (!gfits_bintable_format (format, type, &Nval, &Nbytes)) return (NULL);
     49 
     50  /* check existing table dimensions */
     51  gfits_scan (header, "NAXIS1",  "%d", 1, &Nx);
     52  gfits_scan (header, "NAXIS2",  "%d", 1, &Ny);
     53
     54  /* scan columns to find insert point */
     55  Nstart = 0;
     56  for (i = 1; i < N; i++) {
     57    sprintf (field, "TFORM%d", i);
     58    gfits_scan (header, field, "%s", 1, format);
     59    gfits_bintable_format (format, tmpline, &Nv, &Nb);
     60    Nstart += Nv*Nb;
     61  }
     62
     63  /* extract bytes from table into array */
     64  ALLOCATE (array, char, Nbytes*Nval*Ny);
     65  Pin  = table[0].buffer + Nstart;
     66  Pout = array;
     67  for (i = 0; i < Ny; i++, Pin += Nx, Pout += Nval*Nbytes) {
     68    memcpy (Pout, Pin, Nval*Nbytes);
     69  }
     70
     71  /* convert data in-situ with correct type, byte swap and Bzero/Bscale */
     72  Pin  = array;
     73  Pout = array;
     74  if (!strcmp (type, "char")) {
     75    for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
     76      *(char *)Pout = *(char *)Pin*Bscale + Bzero;
     77    }
     78  }
     79  if (!strcmp (type, "short")) {
     80    for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
     81# ifdef BYTE_SWAP
     82      SWAP_BYTE;
     83# endif
     84      *(short *)Pout = *(short *)Pin*Bscale + Bzero;
     85    } 
     86  }
     87  if (!strcmp (type, "int")) {
     88    for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
     89# ifdef BYTE_SWAP
     90      SWAP_WORD;
     91# endif
     92      *(int *)Pout = *(int *)Pin*Bscale + Bzero;
     93    }
     94  }
     95  if (!strcmp (type, "float")) {
     96    for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
     97# ifdef BYTE_SWAP
     98      SWAP_WORD;
     99# endif
     100      *(float *)Pout = *(float *)Pin*Bscale + Bzero;
     101    }
     102  }
     103  if (!strcmp (type, "double")) {
     104    for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
     105# ifdef BYTE_SWAP
     106      SWAP_DBLE;
     107# endif
     108      *(double *)Pout = *(double *)Pin*Bscale + Bzero;
     109    }
     110  }
     111
     112  *Ncol = Nval;
     113  *Nrow = Ny;
     114  return (array);
     115}
    16116
    17117/***********************/
  • trunk/Ohana/src/libkapa/src/KapaOpen.c

    r14590 r16810  
    22
    33# define MY_PORT 2500
     4# define MY_PORT_MAX 2520
    45# define MY_WAIT 100000
    56# define DEBUG 0
     
    2627  }
    2728
    28   if (DEBUG) fprintf (stderr, "init sock: %d, len: %d\n", InitSocket, length);
     29  if (DEBUG) fprintf (stderr, "init sock: %d, len: %d, port %d\n", InitSocket, length, Address[0].sin_port);
    2930  status = bind (InitSocket, (struct sockaddr *) Address, length);
    3031  if (status == -1) {
     
    3233        close (InitSocket);
    3334        Address[0].sin_port ++;
    34         if (Address[0].sin_port > MY_PORT + 10) exit (2);
     35        if (Address[0].sin_port > MY_PORT_MAX) exit (2);
    3536        goto retry_server;
    3637    }
     
    193194      close (InitSocket);
    194195      Address.sin_port ++;
    195       if (Address.sin_port > MY_PORT + 10) return (-1);
     196      if (Address.sin_port > MY_PORT_MAX) return (-1);
    196197      goto retry_client;
    197198    }
  • trunk/Ohana/src/markstar/src/match_images.c

    r12332 r16810  
    2222  ALLOCATE (source, short int, Nimage);
    2323  for (j = 0; j < Nimage; j++) {
    24     start[j] = image[j].tzero - MAX(0.05*image[j].trate*image[j].NY, 1);
    25     stop[j]  = image[j].tzero + MAX(1.05*image[j].trate*image[j].NY, 1);
     24    start[j] = image[j].tzero - MAX(0.01*image[j].trate*image[j].NY, 1);
     25    stop[j]  = image[j].tzero + MAX(1.01*image[j].trate*image[j].NY, 1);
    2626    source[j] = image[j].photcode;
    2727  }
  • trunk/Ohana/src/mosastro/src/getptolemy.c

    r15743 r16810  
    5050      stars[k].R = catalog.average[j].R;
    5151      stars[k].D = catalog.average[j].D;
    52       stars[k].M = catalog.measure[catalog.average[j].offset].M;
     52      stars[k].M = catalog.measure[catalog.average[j].measureOffset].M;
    5353    }     
    5454    dvo_catalog_free (&catalog);
  • trunk/Ohana/src/opihi/dvo/avextract.c

    r15716 r16810  
    100100
    101101    for (j = 0; (j < catalog.Naverage) && !interrupt; j++) {
    102       m = catalog.average[j].offset;
     102      m = catalog.average[j].measureOffset;
    103103      // extract the relevant values
    104104      // XXX for measure values, this could be optimized for one loop over measures...
  • trunk/Ohana/src/opihi/dvo/ccd.c

    r15509 r16810  
    7272    for (i = 0; i < catalog.Naverage; i++) {
    7373      M1 = M2 = NULL;
    74       m = catalog.average[i].offset;
     74      m = catalog.average[i].measureOffset;
    7575
    7676      SetSelectionParam (0);
  • trunk/Ohana/src/opihi/dvo/cmd.c

    r15509 r16810  
    7070    for (i = 0; i < catalog.Naverage; i++) {
    7171      M1 = M3 = NULL;
    72       m = catalog.average[i].offset;
     72      m = catalog.average[i].measureOffset;
    7373
    7474      SetSelectionParam (0);
  • trunk/Ohana/src/opihi/dvo/dbExtractAverages.c

    r15509 r16810  
    4545
    4646    case AVE_NMEAS:
    47       value = average[0].Nm;
     47      value = average[0].Nmeasure;
    4848      break;
    4949    case AVE_NMISS:
    50       value = average[0].Nn;
     50      value = average[0].Nmissing;
    5151      break;
    5252    case AVE_Xp:
     
    7272          // XXX need to code this correctly: this returns just the first matching value
    7373          value = NAN;
    74           for (i = 0; i < average[0].Nm; i++) {
     74          for (i = 0; i < average[0].Nmeasure; i++) {
    7575            if (field->photcode->code != measure[i].photcode) continue;
    7676            value = measure[i].M;
  • trunk/Ohana/src/opihi/dvo/dbExtractMeasures.c

    r15509 r16810  
    11# include "dvoshell.h"
     2
     3// to add a new field to the extractions:
     4// 1) add the selection for the field below
     5// 2) add the field to the ParseMeasureField in dbFields.c
     6// 3) add the field to the measure enum list in dvoshell.h
    27
    38/* time concepts */
     
    111116      break;
    112117    case MEAS_NMEAS: /* OK */
    113       value = average[0].Nm;
     118      value = average[0].Nmeasure;
    114119      break;
    115120    case MEAS_NMISS: /* OK */
    116       value = average[0].Nn;
     121      value = average[0].Nmissing;
    117122      break;
    118123    case MEAS_OBJFLAGS: /* OK */
     
    171176    case MEAS_XCCD: /* OK */
    172177/* I need to perform this conversion for ELIXIR and LONEOS formats on load */     
    173 # if 0
     178# if 1
    174179      value = measure[0].Xccd;
    175180# else
     
    184189    case MEAS_YCCD: /* OK */
    185190/* I need to perform this conversion for ELIXIR and LONEOS formats on load */     
    186 # if 0
     191# if 1
    187192      value = measure[0].Yccd;
    188193# else
     
    230235      value = measure[0].qPSF;
    231236      break;
    232     case MEAS_PSF_PROB: /* OK */
    233       value = measure[0].psfProb;
     237    case MEAS_PSF_CHISQ: /* OK */
     238      value = measure[0].psfChisq;
    234239      break;
    235240    case MEAS_CR_NSIGMA: /* OK */
  • trunk/Ohana/src/opihi/dvo/dbFields.c

    r15208 r16810  
    148148  if (!strcasecmp (fieldName, "IMAGEID"))    ESCAPE (MEAS_IMAGE_ID,     MAG_NONE);
    149149  if (!strcasecmp (fieldName, "PSF_QF"))     ESCAPE (MEAS_PSF_QF,       MAG_NONE);
    150   if (!strcasecmp (fieldName, "PSF_PROB"))   ESCAPE (MEAS_PSF_PROB,     MAG_NONE);
     150  if (!strcasecmp (fieldName, "PSF_CHISQ"))  ESCAPE (MEAS_PSF_CHISQ,    MAG_NONE);
    151151  if (!strcasecmp (fieldName, "CR_NSIGMA"))  ESCAPE (MEAS_CR_NSIGMA,    MAG_NONE);
    152152  if (!strcasecmp (fieldName, "EXT_NSIGMA")) ESCAPE (MEAS_EXT_NSIGMA,   MAG_NONE);
  • trunk/Ohana/src/opihi/dvo/fitcolors.c

    r14401 r16810  
    216216
    217217          M1 = M2 = NULL;
    218           m = catalog[k].average[i].offset;
     218          m = catalog[k].average[i].measureOffset;
    219219
    220220          SetSelectionParam (0);
  • trunk/Ohana/src/opihi/dvo/fitsed.c

    r16040 r16810  
    207207
    208208      // load the measurements for this source
    209       m = catalog.average[i].offset;
    210       for (j = 0; j < catalog.average[i].Nm; j++) {
     209      m = catalog.average[i].measureOffset;
     210      for (j = 0; j < catalog.average[i].Nmeasure; j++) {
    211211        idx = hashcode[catalog.measure[m+j].photcode];
    212212        if (idx == -1) continue;
  • trunk/Ohana/src/opihi/dvo/gstar.c

    r16040 r16810  
    151151        gprint (GP_LOG, "%11.7f ", catalog.average[k].R);
    152152        gprint (GP_LOG, "%11.7f ", catalog.average[k].D);
    153         gprint (GP_LOG, "%3d   ",  catalog.average[k].Nm);
     153        gprint (GP_LOG, "%3d   ",  catalog.average[k].Nmeasure);
    154154        gprint (GP_LOG, "%4.1f ",  0.01*catalog.average[k].Xp);
    155155        gprint (GP_LOG, "%5d",     catalog.average[k].code);
     
    164164            gprint (GP_LOG, "%f",     catalog.average[k].P);
    165165            gprint (GP_LOG, "%f",     catalog.average[k].dP);
    166             gprint (GP_LOG, "%x",     catalog.average[k].objID_hi);
    167             gprint (GP_LOG, "%x",     catalog.average[k].objID_lo);
     166            gprint (GP_LOG, "%x",     catalog.average[k].objID);
     167            gprint (GP_LOG, "%x",     catalog.average[k].catID);
    168168        }
    169169
     
    188188
    189189      if (GetMeasures || SaveVectors) {
    190         m = catalog.average[k].offset;
    191         for (j = 0; j < catalog.average[k].Nm; j++, m++) {
     190        m = catalog.average[k].measureOffset;
     191        for (j = 0; j < catalog.average[k].Nmeasure; j++, m++) {
    192192
    193193          Mcat = PhotCat (&catalog.measure[m]);
     
    209209            if (FULL_OUTPUT) {
    210210                gprint (GP_LOG, "%f", catalog.measure[m].Mcal);
    211                 gprint (GP_LOG, "%f", catalog.measure[m].Mgal);
     211                gprint (GP_LOG, "%f", catalog.measure[m].Map);
    212212                gprint (GP_LOG, "%f", pow(10.0, 0.4*catalog.measure[m].dt));
    213213                gprint (GP_LOG, "%f", 1.0 + catalog.measure[m].airmass);
     
    223223                gprint (GP_LOG, "%d", catalog.measure[m].imageID);
    224224                gprint (GP_LOG, "%f", catalog.measure[m].qPSF);
    225                 gprint (GP_LOG, "%f", catalog.measure[m].psfProb);
     225                gprint (GP_LOG, "%f", catalog.measure[m].psfChisq);
    226226                gprint (GP_LOG, "%f", catalog.measure[m].crNsigma);
    227227                gprint (GP_LOG, "%f", catalog.measure[m].extNsigma);
  • trunk/Ohana/src/opihi/dvo/imextract.c

    r14590 r16810  
    11# include "dvoshell.h"
    22
    3 enum {ZERO, RA, DEC, Xm, AIRMASS, MCAL, dMCAL, PHOTCODE, TIME, FWHM, EXPTIME, NSTAR, SKY, NCAL, FLAG, NX_PIX, NY_PIX, THETA, SKEW, SCALE, DSCALE};
     3// need to upgrade this to support multiple fields and WHERE clauses
     4
     5enum {ZERO, RA, DEC, Xm, AIRMASS, MCAL, dMCAL, PHOTCODE, TIME, FWHM, EXPTIME, NSTAR, SKY, NCAL, FLAG, NX_PIX, NY_PIX, THETA, SKEW, SCALE, DSCALE, IMAGE_ID};
    46
    57int imextract (int argc, char **argv) {
     
    9496  if (!strcasecmp (argv[1], "scale")) mode = SCALE;
    9597  if (!strcasecmp (argv[1], "dscale")) mode = DSCALE;
     98  if (!strcasecmp (argv[1], "imageID")) mode = IMAGE_ID;
    9699  if (mode == ZERO) {
    97100    gprint (GP_ERR, "value may be one of the following:\n");
     
    181184        vec[0].elements[N] = image[j].NY;
    182185        break;
     186      case IMAGE_ID:
     187        vec[0].elements[N] = image[j].imageID;
     188        break;
    183189      case THETA: {
    184190        double theta1, theta2, s1, s2;
  • trunk/Ohana/src/opihi/dvo/lcurve.c

    r16040 r16810  
    122122    if (r < Radius2) {
    123123      /* found star, extract measurements */
    124       m = catalog.average[N1[i]].offset;
    125       for (j = 0; j < catalog.average[N1[i]].Nm; j++, m++) {
     124      m = catalog.average[N1[i]].measureOffset;
     125      for (j = 0; j < catalog.average[N1[i]].Nmeasure; j++, m++) {
    126126        if (ErrorBars) dYvec.elements[N] = catalog.measure[m].dM;
    127127        Xvec.elements[N] = TimeValue (catalog.measure[m].t, TimeReference, TimeFormat);
  • trunk/Ohana/src/opihi/dvo/lightcurve.c

    r16040 r16810  
    105105      k = N1[i];
    106106      /* found star, extract measurements */
    107       m = catalog.average[k].offset;
    108       for (j = 0; j < catalog.average[k].Nm; j++, m++) {
     107      m = catalog.average[k].measureOffset;
     108      for (j = 0; j < catalog.average[k].Nmeasure; j++, m++) {
    109109
    110110        if (PhotCodeSelect) {
  • trunk/Ohana/src/opihi/dvo/mextract.c

    r15716 r16810  
    120120
    121121    for (j = 0; (j < catalog.Naverage) && !interrupt; j++) {
    122       m = catalog.average[j].offset;
    123       for (k = 0; (k < catalog.average[j].Nm); k++, m++) {
     122      m = catalog.average[j].measureOffset;
     123      for (k = 0; (k < catalog.average[j].Nmeasure); k++, m++) {
    124124
    125125        // extract the relevant values for this measurement
  • trunk/Ohana/src/opihi/dvo/photometry.c

    r15509 r16810  
    562562  *nlist = 0;
    563563  Nlist = 0;
    564   NLIST = MAX (1, average[0].Nm);
     564  NLIST = MAX (1, average[0].Nmeasure);
    565565  ALLOCATE (list, double, NLIST);
    566566
     
    569569
    570570  /* look for measures */
    571   for (i = 0; i < average[0].Nm; i++) {
     571  for (i = 0; i < average[0].Nmeasure; i++) {
    572572    TESTCODE (code, measure[i]);  /* skip measurements not matching photcode */
    573573    TESTMEASURE (measure[i]);     /* exclusions based on measure.params  */
     
    633633
    634634    case AVE_NMEAS:
    635       value = average[0].Nm;
     635      value = average[0].Nmeasure;
    636636      break;
    637637    case AVE_NMISS:
    638       value = average[0].Nn;
     638      value = average[0].Nmissing;
    639639      break;
    640640    case AVE_Xp:
     
    658658        case MAG_CAL:
    659659          value = NAN;
    660           for (i = 0; i < average[0].Nm; i++) {
     660          for (i = 0; i < average[0].Nmeasure; i++) {
    661661              if (code[0].code != measure[i].photcode) continue;
    662662              value = measure[i].M;
     
    679679    case AVE_NCODE:
    680680      value = 0;
    681       for (i = 0; i < average[0].Nm; i++) {
     681      for (i = 0; i < average[0].Nmeasure; i++) {
    682682        if (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].photcode)) continue;
    683683        value ++;
     
    686686    case AVE_NPHOT:
    687687      value = 0;
    688       for (i = 0; i < average[0].Nm; i++) {
     688      for (i = 0; i < average[0].Nmeasure; i++) {
    689689        if (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].photcode)) continue;
    690690        if (measure[i].dbFlags & (ID_MEAS_POOR | ID_MEAS_SKIP)) continue;
     
    695695    case AVE_NCRIT:
    696696      value = 0;
    697       for (i = 0; i < average[0].Nm; i++) {
     697      for (i = 0; i < average[0].Nmeasure; i++) {
    698698        if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].photcode))) continue;
    699699        if (ErrSelect && (measure[i].dM > ErrValue)) continue;
     
    716716 
    717717  Nt = Nc = 0;
    718   for (k = 0; k < average[0].Nm; k++) {
     718  for (k = 0; k < average[0].Nmeasure; k++) {
    719719    if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[k].photcode))) continue;
    720720    Nc ++;
     
    732732 
    733733  Nt[0] = Nt[1] = Nt[2] = 0;
    734   for (k = 0; k < average[0].Nm; k++) {
     734  for (k = 0; k < average[0].Nmeasure; k++) {
    735735    if (code != GetPhotcodeEquivCodebyCode (measure[k].photcode)) continue;
    736736    N = GetMeasureTypeCode (&measure[k]);
     
    793793  if ((code != NULL) && (code[0].type == PHOT_REF)) {
    794794    Nm = 0;
    795     for (i = 0; i < average[0].Nm; i++) {
     795    for (i = 0; i < average[0].Nmeasure; i++) {
    796796      TESTCODE (code, measure[i]);
    797797      Nm++;
     
    805805  if (FWHMSelect) {
    806806    Nm = 0;
    807     for (i = 0; i < average[0].Nm; i++) {
     807    for (i = 0; i < average[0].Nmeasure; i++) {
    808808      fwhm = measure[i].FWx / 100.0;
    809809      switch (FWHMsign) {
     
    820820      Nm++;
    821821    }
    822     if (average[0].Nm * FWHMfrac > Nm) return (FALSE);
     822    if (average[0].Nmeasure * FWHMfrac > Nm) return (FALSE);
    823823  }
    824824
     
    833833  if (NcodeSelect) {
    834834    Nm = 0;
    835     for (i = 0; i < average[0].Nm; i++) {
     835    for (i = 0; i < average[0].Nmeasure; i++) {
    836836      TESTCODE (code, measure[i]);
    837837      Nm++;
     
    872872  if (NphotSelect) {
    873873    Nm = 0;
    874     for (i = 0; i < average[0].Nm; i++) {
     874    for (i = 0; i < average[0].Nmeasure; i++) {
    875875      TESTCODE (code, measure[i]);
    876876      if (measure[i].dbFlags && ID_MEAS_SKIP) continue;
     
    931931   Ns    - secfilt entry (-1 for PRI)
    932932   &catalog.average[i],
    933    &catalog.measure[catalog.average[i].offset],
     933   &catalog.measure[catalog.average[i].measureOffset],
    934934   &catalog.secfilt[i*Nsec]
    935935*/
     
    974974  *nlist = 0;
    975975  Nlist = 0;
    976   NLIST = MAX (1, average[0].Nm*average[0].Nm);
     976  NLIST = MAX (1, average[0].Nmeasure*average[0].Nmeasure);
    977977  ALLOCATE (list, double, NLIST);
    978978  M1 = M2 = NULL;
     
    10151015  *nlist = 0;
    10161016  Nlist = 0;
    1017   NLIST = MAX (1, average[0].Nm*average[0].Nm);
     1017  NLIST = MAX (1, average[0].Nmeasure*average[0].Nmeasure);
    10181018  ALLOCATE (list, double, NLIST);
    10191019
     
    10311031
    10321032  /* loop twice over all measures */
    1033   for (i = 0; i < average[0].Nm; i++) {
     1033  for (i = 0; i < average[0].Nmeasure; i++) {
    10341034    SetSelectionParam (Np0);
    10351035    TESTCODE (code[0], measure[i]);
    10361036    TESTMEASURE (measure[i]);
    10371037    SETMAG(M1, measure[i], mode[0]);
    1038     for (j = 0; j < average[0].Nm; j++) {
     1038    for (j = 0; j < average[0].Nmeasure; j++) {
    10391039      if (i == j) continue;
    10401040      SetSelectionParam (Np1);
     
    10861086  *nlist = 0;
    10871087  Nlist = 0;
    1088   NLIST = MAX (1, average[0].Nm*average[0].Nm);
     1088  NLIST = MAX (1, average[0].Nmeasure*average[0].Nmeasure);
    10891089  ALLOCATE (list, double, NLIST);
    10901090
     
    10991099
    11001100  /* loop twice over all measures */
    1101   for (i = 0; i < average[0].Nm; i++) {
     1101  for (i = 0; i < average[0].Nmeasure; i++) {
    11021102    TESTCODE (code[0], measure[i]);
    11031103    TESTMEASURE (measure[i]);
    11041104    SETMAG(M1, measure[i], mode[0]);
    1105     for (j = 0; j < average[0].Nm; j++) {
     1105    for (j = 0; j < average[0].Nmeasure; j++) {
    11061106      if (i == j) continue;
    11071107      TESTCODE (code[1], measure[j]);
  • trunk/Ohana/src/opihi/dvo/pmeasure.c

    r15038 r16810  
    111111      while (catalog.average[i].R < Rmin) catalog.average[i].R += 360.0;
    112112      while (catalog.average[i].R > Rmax) catalog.average[i].R -= 360.0;
    113       m = catalog.average[i].offset;
    114       for (k = 0; k < catalog.average[i].Nm; k++) {
     113      m = catalog.average[i].measureOffset;
     114      for (k = 0; k < catalog.average[i].Nmeasure; k++) {
    115115        if (FlagClip) {
    116116          flags = catalog.measure[m+k].dbFlags;
  • trunk/Ohana/src/opihi/dvo/subpix.c

    r16040 r16810  
    130130
    131131  /* only print the entries for existing measurements of this star */
    132   measure = &catalog.measure[catalog.average[Nentry].offset];
    133   Nmeasure = catalog.average[Nentry].Nm;
     132  measure = &catalog.measure[catalog.average[Nentry].measureOffset];
     133  Nmeasure = catalog.average[Nentry].Nmeasure;
    134134  for (i = 0; i < Nsub; i++) {
    135135    I = index[i];
  • trunk/Ohana/src/opihi/include/dvoshell.h

    r16004 r16810  
    7272      MEAS_IMAGE_ID,
    7373      MEAS_PSF_QF,
    74       MEAS_PSF_PROB,
     74      MEAS_PSF_CHISQ,
    7575      MEAS_CR_NSIGMA,
    7676      MEAS_EXT_NSIGMA,
  • trunk/Ohana/src/opihi/pantasks/ipptool2book.c

    r16567 r16810  
    108108    FREEKEYS;
    109109    return FALSE;
    110   }
    111   if (strcmp(bookName, argv[2])) {
    112     gprint (GP_ERR, "WARNING: metadata output name %s does not match expected bookname %s\n", bookName, argv[2]);
    113110  }
    114111  free (line);
  • trunk/Ohana/src/relastro/Makefile

    r16040 r16810  
    3737$(SRC)/UpdateObjects.$(ARCH).o   \
    3838$(SRC)/UpdateSimple.$(ARCH).o    \
     39$(SRC)/UpdateMeasures.$(ARCH).o  \
     40$(SRC)/GetAstromError.$(ARCH).o  \
    3941$(SRC)/args.$(ARCH).o            \
    4042$(SRC)/bcatalog.$(ARCH).o        \
  • trunk/Ohana/src/relastro/include/relastro.h

    r16060 r16810  
    1010} CoordMode;
    1111
     12typedef enum {ERROR_MODE_RA, ERROR_MODE_DEC, ERROR_MODE_POS} ErrorMode;
     13
    1214typedef struct {
    1315  double R, D;  /* Sky Coords    - degrees */
     
    1517  double L, M;  /* Focal Plane   - pixels  */
    1618  double X, Y;  /* Chip Coords   - pixels  */
    17   double Mag, dMag;
     19  double Mag;
     20  double dMag;
     21  double dPos;
    1822  int mask;
    1923} StarData;
     
    263267void fit_add (CoordFit *fit, double x1, double y1, double x2, double y2, double wt);
    264268void fit_eval (CoordFit *fit);
     269void fit_apply (CoordFit *fit, double *x2, double *y2, double x1, double y1);
    265270double **poly2d_dx (double **poly, int Nx, int Ny);
    266271double **poly2d_dy (double **poly, int Nx, int Ny);
    267272double **poly2d_copy (double **poly, int Nx, int Ny);
    268273double poly2d_eval (double **poly, int Nx, int Ny, double x, double y);
    269 void fit_apply_coords (CoordFit *fit, Coords *coords);
     274CoordFit *fit_apply_coords (CoordFit *fit, Coords *coords);
    270275int CoordsGetCenter (CoordFit *fit, double tol, double *xo, double *yo);
    271276CoordFit *CoordsSetCenter (CoordFit *input, double Xo, double Yo);
     
    278283int UpdateChips (Catalog *catalog, int Ncatalog);
    279284int UpdateMosaic (Catalog *catalog, int Ncatalog);
     285int UpdateMeasures (Catalog *catalog, int Ncatalog);
     286void fixImageRaw (Catalog *catalog, int Ncatalog, int im);
     287
    280288int sun_ecliptic (double jd, double *lambda, double *beta, double *epsilon);
    281289int ParFactor (double *pR, double *pD, double R, double D, time_t T);
  • trunk/Ohana/src/relastro/src/FitChip.c

    r15600 r16810  
    11# include "relastro.h"
     2# define SCATTER_MAX_ERROR 0.05
    23
    34void FitChip (StarData *raw, StarData *ref, int Nmatch, Coords *coords) {
    45
    5   int i;
     6  int i, Nscatter, Niter;
    67  CoordFit *fit;
     8  double dL, dM, dR, dRmax, *values;
    79
    8   fit = fit_init (coords[0].Npolyterms);
    9   for (i = 0; i < Nmatch; i++) {
    10     if (raw[i].mask) continue;
    11     fit_add (fit, raw[i].X, raw[i].Y, ref[i].L, ref[i].M, 1.0);
    12   }
    13   fit_eval (fit);
    14   fit_apply_coords (fit, coords);
    15   fit_free (fit);
     10  ALLOCATE (values, double, Nmatch);
    1611
    17   // apply new coords to raw (X,Y -> L,M)
    18   for (i = 0; i < Nmatch; i++) {
    19     XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, coords);
     12  for (Niter = 0; Niter < 3; Niter ++) {
     13    // measure the scatter distribution (use only the bright end detections)
     14    for (i = Nscatter = 0; i < Nmatch; i++) {
     15      if (raw[i].mask) continue;
     16      if (raw[i].dMag > SCATTER_MAX_ERROR) continue;
     17
     18      dL = raw[i].L - ref[i].L;
     19      dM = raw[i].M - ref[i].M;
     20      dR = hypot (dL, dM);
     21   
     22      values[Nscatter] = dR;
     23      Nscatter++;
     24    }
     25
     26    // for a 2D Gaussian, 40% of the points are within 1 sigma; dRmax is ~ 3 sigma
     27    dsort (values, Nscatter);
     28    dRmax = 3.0*values[(int)(0.40*Nscatter)];
     29
     30    fit = fit_init (coords[0].Npolyterms);
     31
     32    for (i = 0; i < Nmatch; i++) {
     33      if (raw[i].mask) continue;
     34
     35      // require radius of XXX arcsec
     36      dL = raw[i].L - ref[i].L;
     37      dM = raw[i].M - ref[i].M;
     38      dR = hypot (dL, dM);
     39
     40      if (dR > dRmax) {
     41        continue;
     42        raw[i].mask = TRUE;
     43      }
     44   
     45      fit_add (fit, raw[i].X, raw[i].Y, ref[i].L, ref[i].M, raw[i].dPos);
     46    }
     47    fprintf (stderr, "scatter limit: %f based on %d detections; using %d of %d for fit\n",
     48             dRmax, Nscatter, fit[0].Npts, Nmatch);
     49
     50    if (fit[0].Npts < 25) {
     51      fit_free (fit);
     52      free (values);
     53      return;
     54    }
     55    fit_eval (fit);
     56    fit_apply_coords (fit, coords);
     57    fit_free (fit);
     58
     59    for (i = 0; i < Nmatch; i++) {
     60      XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, coords);
     61    }
    2062  }
    2163
    22   fit_free (fit);
     64  free (values);
     65  return;
    2366}
    2467
     
    3477*/
    3578
    36 /* XXX I'm not using the errors at all : this could at least be done with the dMag values */
     79/* example using fit_apply() :
     80
     81  f = fopen ("test3.dat", "w");
     82
     83  // apply new coords to raw (X,Y -> L,M)
     84  for (i = 0; i < Nmatch; i++) {
     85    fprintf (f, "%f %f  %f %f  ", raw[i].X, raw[i].Y, raw[i].L, raw[i].M);
     86    fit_apply (newfit, &L1, &M1, raw[i].X - coords[0].crpix1, raw[i].Y - coords[0].crpix2);
     87    fprintf (f, "%f %f\n", L1, M1);
     88  }
     89  fclose (f);
     90*/
     91
     92/*** XXX this function can be improved in 4 important ways:
     93
     941) the initial value of the clipping radius could be set based on the distribution of the
     95   value (eg, inner 50%) (better to use dL, dM rather than dP, dQ)
     96
     972) multiple clipping passes could be performed
     98
     993) the per-star astrometric errors could be included in the fit (non-systematic terms at
     100   least, or scaled values of the mag error, or simply the mag error itself)
     101
     1024) we could ignore input detections on the basis of the photFlags
     103
     104*/
  • trunk/Ohana/src/relastro/src/FitMosaic.c

    r15238 r16810  
    55  int i;
    66  CoordFit *fit;
     7  double dP, dQ, dR;
    78
    89  fit = fit_init (coords[0].Npolyterms);
    910  for (i = 0; i < Nmatch; i++) {
    1011    if (raw[i].mask) continue;
     12
     13    // require radius of XXX arcsec
     14    dP = raw[i].P - ref[i].P;
     15    dQ = raw[i].Q - ref[i].Q;
     16    dR = 3600.0 * hypot (dP, dQ);
     17
     18    // XXX the value needs to be set in a more intelligent way
     19    if (dR > 0.15) continue;
     20   
    1121    fit_add (fit, raw[i].L, raw[i].M, ref[i].P, ref[i].Q, 1.0);
     22  }
     23  if (fit[0].Npts == 0) {
     24    fit_free (fit);
     25    return;
    1226  }
    1327  fit_eval (fit);
  • trunk/Ohana/src/relastro/src/FitSimple.c

    r15600 r16810  
    55  int i;
    66  CoordFit *fit;
     7  double dP, dQ, dR;
    78
    89  fit = fit_init (coords[0].Npolyterms);
    910  for (i = 0; i < Nmatch; i++) {
    1011    if (raw[i].mask) continue;
     12
     13    // require radius of XXX arcsec
     14    dP = raw[i].P - ref[i].P;
     15    dQ = raw[i].Q - ref[i].Q;
     16    dR = 3600.0 * hypot (dP, dQ);
     17
     18    // XXX the value needs to be set in a more intelligent way
     19    if (dR > 0.15) continue;
     20   
    1121    fit_add (fit, raw[i].X, raw[i].Y, ref[i].P, ref[i].Q, 1.0);
     22  }
     23  if (fit[0].Npts == 0) {
     24    fit_free (fit);
     25    return;
    1226  }
    1327  fit_eval (fit);
     
    2135    raw[i].Q = raw[i].M;
    2236  }
    23 
    24   fit_free (fit);
    2537}
    2638
     
    3749
    3850/* XXX I'm not using the errors at all : this could at least be done with the dMag values */
     51
     52/* XXX See notes in FitChips.c */
  • trunk/Ohana/src/relastro/src/ImageOps.c

    r16060 r16810  
    3333
    3434  for (i = 0; i < Nimage; i++) {
    35     start[i] = image[i].tzero - MAX(0.05*image[i].trate*image[i].NY, 1);
    36     stop[i]  = image[i].tzero + MAX(1.05*image[i].trate*image[i].NY, 1);
     35    start[i] = image[i].tzero - MAX(0.01*image[i].trate*image[i].NY, 1);
     36    stop[i]  = image[i].tzero + MAX(1.01*image[i].trate*image[i].NY, 1);
    3737  }
    3838}
     
    8181
    8282  int i, j;
     83  char *name;
    8384
    8485  for (i = 0; i < Ncatalog; i++) {
     
    8788    }
    8889  }
     90
     91  for (i = 0; VERBOSE && (i < Nimage); i++) {
     92    name = GetPhotcodeNamebyCode (image[i].photcode);
     93    fprintf (stderr, "image %d has %d measures (%s, %s)\n", i, Nlist[i],
     94             ohana_sec_to_date(image[i].tzero), name);
     95  }
    8996}
    9097
     
    182189// return StarData values for detections in the specified image, converting coordinates from the
    183190// chip positions: X,Y -> L,M -> P,Q -> R,D
     191void fixImageRaw (Catalog *catalog, int Ncatalog, int im) {
     192
     193  int i, m, c, n;
     194  double X, Y, L, M, P, Q, R, D, dR, dD;
     195 
     196  Mosaic *mosaic;
     197  Coords *moscoords, *imcoords;
     198 
     199  moscoords = NULL;
     200  mosaic = getMosaicForImage (im);
     201  if (mosaic != NULL) {
     202      moscoords = &mosaic[0].coords;
     203  }
     204  imcoords = &image[im].coords;
     205
     206  for (i = 0; i < Nlist[im]; i++) {
     207    m = mlist[im][i];
     208    c = clist[im][i];
     209
     210    X = catalog[c].measure[m].Xccd;
     211    Y = catalog[c].measure[m].Yccd;
     212    n = catalog[c].measure[m].averef;
     213
     214    if (moscoords == NULL) {
     215      // this is a Simple image (not a mosaic)
     216      // note that for a Simple image, L,M = P,Q
     217      XY_to_LM (&L, &M, X, Y, imcoords);
     218      LM_to_RD (&R, &D, L, M, imcoords);
     219    } else {
     220      XY_to_LM (&L, &M, X, Y, imcoords);
     221      XY_to_LM (&P, &Q, L, M, moscoords);
     222      LM_to_RD (&R, &D, P, Q, moscoords);
     223    }
     224
     225    // new dR, dD : test
     226    dR = 3600.0*(catalog[c].average[n].R - R);
     227    dD = 3600.0*(catalog[c].average[n].D - D);
     228   
     229    if (fabs(catalog[c].measure[m].dR - dR) > 10.0) {
     230      // XXXXX running into this still for last megacam exposure: wrong mosaic?
     231      // ???? inconsistently hitting this????
     232      fprintf (stderr, "!");
     233      abort ();
     234    }
     235    if (fabs(catalog[c].measure[m].dD - dD) > 10.0) {
     236      fprintf (stderr, "*");
     237      abort ();
     238    }
     239
     240    catalog[c].measure[m].dR = dR;
     241    catalog[c].measure[m].dD = dD;
     242
     243    if (catalog[c].measure[m].dR > +180.0*3600.0) {
     244      // average on high end of boundary, move star up
     245      R += 360.0;
     246      catalog[c].measure[m].dR = 3600.0*(catalog[c].average[n].R - R);
     247    }
     248    if (catalog[c].measure[m].dR < -180.0*3600.0) {
     249      // average on low end of boundary, move star down
     250      R -= 360.0;
     251      catalog[c].measure[m].dR = 3600.0*(catalog[c].average[n].R - R);
     252    }
     253  } 
     254  return;
     255}
     256
     257// return StarData values for detections in the specified image, converting coordinates from the
     258// chip positions: X,Y -> L,M -> P,Q -> R,D
    184259StarData *getImageRaw (Catalog *catalog, int Ncatalog, int im, int *Nstars, CoordMode mode) {
    185260
    186   int i, m, c;
     261  int i, m, c, n;
    187262 
    188263  Mosaic *mosaic;
     
    213288    raw[i].Mag  = catalog[c].measure[m].M;
    214289    raw[i].dMag = catalog[c].measure[m].dM;
     290    raw[i].dPos = GetAstromError (&catalog[c].measure[m], ERROR_MODE_POS);
     291
     292    n = catalog[c].measure[m].averef;
    215293
    216294    raw[i].mask = FALSE;
     295    if (catalog[c].average[n].Nmeasure < 2) {
     296      raw[i].mask = TRUE;
     297    }
    217298
    218299    switch (mode) {
     
    273354    ref[i].Mag  = catalog[c].measure[m].M;
    274355    ref[i].dMag = catalog[c].measure[m].dM;
     356    ref[i].dPos = GetAstromError (&catalog[c].measure[m], ERROR_MODE_POS);
    275357
    276358    ref[i].mask = FALSE;
     
    286368      case MODE_MOSAIC:
    287369      RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, moscoords);
    288       LM_to_XY (&ref[i].M, &ref[i].L, ref[i].P, ref[i].Q, moscoords);
     370      LM_to_XY (&ref[i].L, &ref[i].M, ref[i].P, ref[i].Q, moscoords);
    289371      LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, &image[im].coords);
    290372      break;
  • trunk/Ohana/src/relastro/src/MosaicOps.c

    r16060 r16810  
    3838
    3939    /* set image time range */
    40     start = image[i].tzero - MAX(0.05*image[i].trate*image[i].NY, 1);
    41     stop  = image[i].tzero + MAX(1.05*image[i].trate*image[i].NY, 1);
     40    start = image[i].tzero - MAX(0.01*image[i].trate*image[i].NY, 1);
     41    stop  = image[i].tzero + MAX(1.01*image[i].trate*image[i].NY, 1);
    4242
    4343    /* a new mosaic, define ranges */
     
    7777
    7878    /* set image time range */
    79     start = image[i].tzero - MAX(0.05*image[i].trate*image[i].NY, 1);
    80     stop  = image[i].tzero + MAX(1.05*image[i].trate*image[i].NY, 1);
     79    start = image[i].tzero - MAX(0.01*image[i].trate*image[i].NY, 1);
     80    stop  = image[i].tzero + MAX(1.01*image[i].trate*image[i].NY, 1);
    8181
    8282    /* find existing mosaic with this time range */
  • trunk/Ohana/src/relastro/src/UpdateChips.c

    r15600 r16810  
    2121    ref = getImageRef (catalog, Ncatalog, i, &Nstars, MODE_MOSAIC);
    2222
     23    fprintf (stderr, "image %d : Nstars: %d\n", i, Nstars);
    2324    FitChip (raw, ref, Nstars, &image[i].coords);
    2425
  • trunk/Ohana/src/relastro/src/UpdateObjects.c

    r16060 r16810  
    1818  for (i = 0; i < Ncatalog; i++) {
    1919    for (j = 0; j < catalog[i].Naverage; j++) {
    20       Nmax = MAX (Nmax, catalog[i].average[j].Nm);
     20      Nmax = MAX (Nmax, catalog[i].average[j].Nmeasure);
    2121    }
    2222  }
     
    4848  double Tmin, Tmax;
    4949  float errorScale;
    50   PhotCode *code;
    5150
    5251  initObjectData (catalog, Ncatalog);
     
    8180
    8281      N = 0;
    83       m = catalog[i].average[j].offset;
     82      m = catalog[i].average[j].measureOffset;
    8483
    8584      Tmin = Tmax = (catalog[i].measure[m].t - To) / (86400*365.25);
    8685      mode = FIT_MODE;
    8786
    88       for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
     87      for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    8988        if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;
    9089       
     
    9695        Tmax = MAX(Tmax, T[N]);
    9796
    98         /* the astrometric errors are not being carried yet (but should be!) */
    99         /* we use the photometric mag error as a weighting term */
    100 
    101         code = GetPhotcodebyCode (catalog[0].measure[m].photcode);
    102         errorScale = code[0].astromScale;
    103         dR[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR) * errorScale;
    104         dD[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR) * errorScale;
     97        dR[N] = GetAstromError (&catalog[i].measure[m], ERROR_MODE_RA);
     98        dD[N] = GetAstromError (&catalog[i].measure[m], ERROR_MODE_DEC);
    10599        dT[N] = catalog[i].measure[m].dt;
    106100
     
    193187
    194188      // the measure fields must be updated before the average fields
    195       m = catalog[i].average[j].offset;
    196       for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
     189      m = catalog[i].average[j].measureOffset;
     190      for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    197191        if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;
    198192        setMeanR (fit.Ro, &catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
  • trunk/Ohana/src/relastro/src/args.c

    r15600 r16810  
    202202  fprintf (stderr, "ERROR: USAGE: relastro -region RA RA DEC DEC\n");
    203203  fprintf (stderr, "  working options: \n");
    204   fprintf (stderr, "  -time (start) (stop)\n");
    205   fprintf (stderr, "  -v\n");
     204  fprintf (stderr, "  -update-objects\n");
     205  fprintf (stderr, "    -pm\n");
     206  fprintf (stderr, "    -par\n");
     207  fprintf (stderr, "    -pmpar\n");
     208  fprintf (stderr, "  -update-simple\n");
     209  fprintf (stderr, "  -update-chips\n");
     210  fprintf (stderr, "  -update-mosaics\n");
     211  fprintf (stderr, "  -time (start)(stop)\n");
     212  fprintf (stderr, "  -photcode (code)[,code,code...]\n");
    206213  fprintf (stderr, "  -plot\n");
    207214  fprintf (stderr, "  -plotdelay (seconds)\n");
    208   fprintf (stderr, "  -update\n");
     215  fprintf (stderr, "  -statmode (mode)\n");
     216  fprintf (stderr, "  -reset");
     217  fprintf (stderr, "  -update : apply new fit to database\n");
    209218  fprintf (stderr, "  -params\n");
    210   fprintf (stderr, "  -reset\n");
     219  fprintf (stderr, "  -plrange\n");
     220  fprintf (stderr, "  -minerror\n");
     221  fprintf (stderr, "  -area\n");
    211222  fprintf (stderr, "  -area Xmin Xmax Ymin Ymax\n");
    212223  fprintf (stderr, "  -instmag min max\n\n");
    213   fprintf (stderr, "  planned options: \n");
    214   fprintf (stderr, "  -photcode code[,code,code,..]\n");
     224  fprintf (stderr, "  -v\n");
    215225  fprintf (stderr, "  \n");
    216226  exit (2);
    217227}
     228
  • trunk/Ohana/src/relastro/src/bcatalog.c

    r15743 r16810  
    2222  /* exclude stars not in range or with too few measurements */
    2323  for (i = 0; i < catalog[0].Naverage; i++) {
    24     if (catalog[0].average[i].Nm < 2) continue;
     24    if (catalog[0].average[i].Nmeasure < 2) continue;
    2525
    2626    /* start with all stars good */
    2727    subcatalog[0].average[Naverage] = catalog[0].average[i];
    28     subcatalog[0].average[Naverage].offset = Nmeasure;
     28    subcatalog[0].average[Naverage].measureOffset = Nmeasure;
    2929    for (j = 0; j < PhotNsec; j++) {
    3030      subcatalog[0].secfilt[PhotNsec*Naverage+j] = catalog[0].secfilt[PhotNsec*i+j];
     
    3838
    3939    Nm = 0;
    40     for (j = 0; j < catalog[0].average[i].Nm; j++) {
     40    for (j = 0; j < catalog[0].average[i].Nmeasure; j++) {
    4141
    42       offset = catalog[0].average[i].offset + j;
     42      offset = catalog[0].average[i].measureOffset + j;
    4343
    4444      /* select measurements by photcode, if specified */
     
    9595      continue;
    9696    }
    97     subcatalog[0].average[Naverage].Nm = Nm;
     97    subcatalog[0].average[Naverage].Nmeasure = Nm;
    9898    Naverage ++;
    9999    if (Naverage == NAVERAGE) {
  • trunk/Ohana/src/relastro/src/fitpoly.c

    r16060 r16810  
    128128      matrix[i][j] = fit[0].sum[ix+jx][iy+jy];
    129129    }
     130
     131    // mask the terms not represented by the Coords terms
     132    if (ix + iy > fit[0].Norder) {
     133      for (j = 0; j < fit[0].Nelems; j++) {
     134        matrix[i][j] = 0.0;
     135      }
     136      vector[i][0] = 0.0;
     137      vector[i][1] = 0.0;
     138      matrix[i][i] = 1.0;
     139    }     
    130140  }
    131141
     
    133143    ix = i % fit[0].Nterms;
    134144    iy = i / fit[0].Nterms;
    135     fprintf (stderr, "x2 : x^%dy^%d: %10.4g    y2 : x^%dy^%d: %10.4g \n",
    136             ix, iy, vector[i][0], ix, iy, vector[i][1]);
     145    // fprintf (stderr, "x2 : x^%dy^%d: %10.4g    y2 : x^%dy^%d: %10.4g \n",
     146    // ix, iy, vector[i][0], ix, iy, vector[i][1]);
    137147  }     
    138148
     
    142152    ix = i % fit[0].Nterms;
    143153    iy = i / fit[0].Nterms;
    144     fprintf (stderr, "x2 : x^%dy^%d: %10.4g    y2 : x^%dy^%d: %10.4g \n",
    145             ix, iy, vector[i][0], ix, iy, vector[i][1]);
     154    // fprintf (stderr, "x2 : x^%dy^%d: %10.4g    y2 : x^%dy^%d: %10.4g \n",
     155    // ix, iy, vector[i][0], ix, iy, vector[i][1]);
    146156  }     
    147157
     
    158168}
    159169
     170void fit_apply (CoordFit *fit, double *x2, double *y2, double x1, double y1) {
     171 
     172  int ix, iy;
     173  double xterm, yterm, term;
     174  double x, y;
     175
     176  x = 0.0;
     177  y = 0.0;
     178
     179  xterm = 1;
     180  for (ix = 0; ix < fit[0].Nterms; ix++) {
     181    yterm = 1;
     182    for (iy = 0; iy < fit[0].Nterms; iy++) {
     183      term = xterm*yterm;
     184      x += fit[0].xfit[ix][iy]*term;
     185      y += fit[0].yfit[ix][iy]*term;
     186      yterm *= y1;
     187    }
     188    xterm *= x1;
     189  }
     190  *x2 = x;
     191  *y2 = y;
     192}
     193
    160194// Nx, Ny is the number of terms in x and in y
    161195double **poly2d_dx (double **poly, int Nx, int Ny) {
     
    209243  for (i = 0; i < Nx; i++) {
    210244    for (j = 0; j < Ny; j++) {
    211       out[i][j] = poly[i][j+1];
     245      out[i][j] = poly[i][j];
    212246    }
    213247  }
     
    237271/* this should only apply to the polynomial, not the projection terms */
    238272/* compare with psastro supporting code */
    239 void fit_apply_coords (CoordFit *fit, Coords *coords) {
     273CoordFit *fit_apply_coords (CoordFit *fit, Coords *coords) {
    240274
    241275  double c11, c12;
    242276  double c21, c22;
    243   double Xo, Yo, R;
     277  double Xo, Yo, R1, R2;
    244278  CoordFit *modfit;
    245279
     
    256290  modfit = CoordsSetCenter (fit, Xo, Yo);
    257291
     292  /* we do not modify crval1,2: these are kept at the default values */
     293
     294  // set cdelt1, cdelt2
     295  coords[0].cdelt1 = hypot (modfit[0].xfit[1][0], modfit[0].xfit[0][1]);
     296  coords[0].cdelt2 = hypot (modfit[0].yfit[1][0], modfit[0].yfit[0][1]);
     297  R1 = 1 / coords[0].cdelt1;
     298  R2 = 1 / coords[0].cdelt2;
     299
    258300  // set pc1_1, pc1_2, pc2_1, pc2_2 (cd1,cd2 = 1.0)
    259   coords[0].pc1_1 = modfit[0].xfit[1][0];
    260   coords[0].pc1_2 = modfit[0].xfit[0][1];
    261   coords[0].pc2_1 = modfit[0].yfit[1][0];
    262   coords[0].pc2_2 = modfit[0].yfit[0][1];
     301  coords[0].pc1_1 = modfit[0].xfit[1][0] * R1;
     302  coords[0].pc1_2 = modfit[0].xfit[0][1] * R2;
     303  coords[0].pc2_1 = modfit[0].yfit[1][0] * R1;
     304  coords[0].pc2_2 = modfit[0].yfit[0][1] * R2;
    263305
    264306  // set the polyterm elements
    265307  if (coords->Npolyterms > 1) {
    266     coords[0].polyterms[0][0] = modfit[0].xfit[2][0];
    267     coords[0].polyterms[1][0] = modfit[0].xfit[1][1];
    268     coords[0].polyterms[2][0] = modfit[0].xfit[0][2];
    269 
    270     coords[0].polyterms[0][1] = modfit[0].yfit[2][0];
    271     coords[0].polyterms[1][1] = modfit[0].yfit[1][1];
    272     coords[0].polyterms[2][1] = modfit[0].yfit[0][2];
     308    coords[0].polyterms[0][0] = modfit[0].xfit[2][0]*R1*R1;
     309    coords[0].polyterms[1][0] = modfit[0].xfit[1][1]*R1*R2;
     310    coords[0].polyterms[2][0] = modfit[0].xfit[0][2]*R2*R2;
     311
     312    coords[0].polyterms[0][1] = modfit[0].yfit[2][0]*R1*R1;
     313    coords[0].polyterms[1][1] = modfit[0].yfit[1][1]*R1*R2;
     314    coords[0].polyterms[2][1] = modfit[0].yfit[0][2]*R2*R2;
    273315  }
    274316
    275317  // I need to validate Norder
    276318  if (coords->Npolyterms > 2) {
    277     coords[0].polyterms[3][0] = modfit[0].xfit[3][0];
    278     coords[0].polyterms[4][0] = modfit[0].xfit[2][1];
    279     coords[0].polyterms[5][0] = modfit[0].xfit[1][2];
    280     coords[0].polyterms[6][0] = modfit[0].xfit[0][3];
    281 
    282     coords[0].polyterms[3][1] = modfit[0].yfit[3][0];
    283     coords[0].polyterms[4][1] = modfit[0].yfit[2][1];
    284     coords[0].polyterms[5][1] = modfit[0].yfit[1][2];
    285     coords[0].polyterms[6][1] = modfit[0].yfit[0][3];
    286   }
    287 
    288   /* we do not modify crval1,2: these are kept at the default values */
    289 
    290   /* normalize pc11,etc */
    291   c11 = coords[0].pc1_1;
    292   c21 = coords[0].pc1_1;
    293   c12 = coords[0].pc1_1;
    294   c22 = coords[0].pc1_1;
    295   coords[0].cdelt1 = coords[0].cdelt2 = sqrt(fabs(c11*c22 - c12*c21));
    296   R = 1 / coords[0].cdelt1;
    297 
    298   coords[0].pc1_1  = c11*R;
    299   coords[0].pc2_1  = c21*R;
    300   coords[0].pc1_2  = c12*R;
    301   coords[0].pc2_2  = c22*R;
     319    coords[0].polyterms[3][0] = modfit[0].xfit[3][0]*R1*R1*R1;
     320    coords[0].polyterms[4][0] = modfit[0].xfit[2][1]*R1*R1*R2;
     321    coords[0].polyterms[5][0] = modfit[0].xfit[1][2]*R1*R2*R2;
     322    coords[0].polyterms[6][0] = modfit[0].xfit[0][3]*R2*R2*R2;
     323
     324    coords[0].polyterms[3][1] = modfit[0].yfit[3][0]*R1*R1*R1;
     325    coords[0].polyterms[4][1] = modfit[0].yfit[2][1]*R1*R1*R2;
     326    coords[0].polyterms[5][1] = modfit[0].yfit[1][2]*R1*R2*R2;
     327    coords[0].polyterms[6][1] = modfit[0].yfit[0][3]*R2*R2*R2;
     328  }
    302329
    303330  fit_free (modfit);
  • trunk/Ohana/src/relastro/src/load_catalogs.c

    r15743 r16810  
    3939        for (j = 0; j < catalog[i].Naverage; j++) {
    4040          catalog[i].average[j].code = 0;
    41           m = catalog[i].average[j].offset;
    42           for (k = 0; k < catalog[i].average[j].Nm; k++) {
     41          m = catalog[i].average[j].measureOffset;
     42          for (k = 0; k < catalog[i].average[j].Nmeasure; k++) {
    4343            catalog[i].measure[m+k].dbFlags = 0;
    4444          }
  • trunk/Ohana/src/relastro/src/mkpolyterm.c

    r16060 r16810  
    2020
    2121  int i, Nx, Ny;
    22   double R, Xo, Yo, dPos;
     22  double R, Xo, Yo, dPos, dPosRef;
    2323  double **XdX, **XdY, **YdX, **YdY, **alpha, **beta;
    2424  double **xfit, **yfit;
     
    5151     */
    5252    dPos = tol + 1;
     53    dPosRef = dPos;
    5354    for (i = 0; (dPos > tol) && (i < 20); i++) {
    5455      // NOTE: order for alpha is: [y][x]
     
    6667      Yo -= beta[1][0];
    6768      dPos = hypot(beta[0][0], beta[1][0]);
     69      if (i == 0) {
     70        dPosRef = dPos;
     71      }
     72    }
     73    if (dPos > dPosRef) {
     74      fprintf (stderr, "*** warning : non-convergence in model conversion (mkpolyterm.c;73) *** \n");
    6875    }
    6976    array_free (alpha, 2);
  • trunk/Ohana/src/relastro/src/plot_scatter.c

    r12332 r16810  
    1212  for (i = 0; i < Ncatalog; i++) {
    1313    for (j = 0; j < catalog[i].Naverage; j++) {
    14       Ntot += catalog[i].average[j].Nm;
     14      Ntot += catalog[i].average[j].Nmeasure;
    1515    }
    1616  }
     
    2525      /* calculate the average value for a single star */
    2626      if (catalog[i].average[j].code & STAR_BAD) continue; 
    27       m = catalog[i].average[j].offset;
     27      m = catalog[i].average[j].measureOffset;
    2828
    29       for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
     29      for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    3030        if (catalog[i].measure[m].flags & MEAS_BAD) continue;
    3131
  • trunk/Ohana/src/relastro/src/relastro.c

    r16060 r16810  
    6464    save_catalogs (catalog, Ncatalog);
    6565  } else {
     66    // XXX for now, reload all catalogs at once; as memory use gets large, reload one-at-a-time
     67
     68    // load catalog data from region files : do not subselect
     69    catalog = load_catalogs (skylist, &Ncatalog, FALSE);
     70   
     71    // match measurements with images
     72    initImageBins (catalog, Ncatalog);
     73    findImages (catalog, Ncatalog);
     74
     75    // update the detection coordinates using the new image parameters
     76    UpdateMeasures (catalog, Ncatalog);
     77
     78    // write the updated detections to disk
     79    save_catalogs (catalog, Ncatalog);
     80
     81    // save the updated image parameters
    6682    dvo_image_update (&db, VERBOSE);
    6783    dvo_image_unlock (&db);
  • trunk/Ohana/src/relastro/src/setExclusions.c

    r15130 r16810  
    1111  for (i = 0; i < Ncatalog; i++) {
    1212    for (j = 0; j < catalog[i].Naverage; j++) {
    13       m = catalog[i].average[j].offset;
    14       for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
     13      m = catalog[i].average[j].measureOffset;
     14      for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    1515
    1616        /* select measurements by photcode */
  • trunk/Ohana/src/relphot/src/ImageOps.c

    r15509 r16810  
    2424
    2525  for (i = 0; i < Nimage; i++) {
    26     start[i] = image[i].tzero - MAX(0.05*image[i].trate*image[i].NY, 1);
    27     stop[i]  = image[i].tzero + MAX(1.05*image[i].trate*image[i].NY, 1);
     26    start[i] = image[i].tzero - MAX(0.01*image[i].trate*image[i].NY, 1);
     27    stop[i]  = image[i].tzero + MAX(1.01*image[i].trate*image[i].NY, 1);
    2828  }
    2929}
  • trunk/Ohana/src/relphot/src/MosaicOps.c

    r15514 r16810  
    4141
    4242    /* set image time range */
    43     start = image[i].tzero - MAX(0.05*image[i].trate*image[i].NY, 1);
    44     stop  = image[i].tzero + MAX(1.05*image[i].trate*image[i].NY, 1);
     43    start = image[i].tzero - MAX(0.01*image[i].trate*image[i].NY, 1);
     44    stop  = image[i].tzero + MAX(1.01*image[i].trate*image[i].NY, 1);
    4545
    4646    /* find existing mosaic with this time range */
  • trunk/Ohana/src/relphot/src/StarOps.c

    r15514 r16810  
    1212  for (i = 0; i < Ncatalog; i++) {
    1313    for (j = 0; j < catalog[i].Naverage; j++) {
    14       Nmax = MAX (Nmax, catalog[i].average[j].Nm);
     14      Nmax = MAX (Nmax, catalog[i].average[j].Nmeasure);
    1515    }
    1616  }
     
    4343      /* calculate the average value for a single star */
    4444      if (catalog[i].average[j].code & STAR_BAD) continue; 
    45       m = catalog[i].average[j].offset;
     45      m = catalog[i].average[j].measureOffset;
    4646
    4747      N = 0;
    48       for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
     48      for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    4949        if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;
    5050        // XXX allow REF stars (no Image Entry) to be included in the calculation this
     
    9494  for (i = 0; i < Ncatalog; i++) {
    9595    for (j = 0; j < catalog[i].Naverage; j++) {
    96       Nmax = MAX (Nmax, catalog[i].average[j].Nm);
     96      Nmax = MAX (Nmax, catalog[i].average[j].Nmeasure);
    9797    }
    9898  }
     
    107107
    108108      N = 0;
    109       m = catalog[i].average[j].offset;
    110       for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
     109      m = catalog[i].average[j].measureOffset;
     110      for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    111111        if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;
    112112        // XXX allow REF stars (no Image Entry) to be included in the calculation this
     
    158158    for (j = 0; j < catalog[i].Naverage; j++) {
    159159
    160       m = catalog[i].average[j].offset;
    161       for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
     160      m = catalog[i].average[j].measureOffset;
     161      for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    162162        if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;
    163163        Mcal  = getMcal  (m, i);
     
    247247  for (i = 0; i < Ncatalog; i++) {
    248248    for (j = 0; j < catalog[i].Naverage; j++) {
    249       Nmax = MAX (Nmax, catalog[i].average[j].Nm);
     249      Nmax = MAX (Nmax, catalog[i].average[j].Nmeasure);
    250250    }
    251251  }
     
    270270
    271271      /* accumulate list of valid measurements */
    272       m = catalog[i].average[j].offset;
     272      m = catalog[i].average[j].measureOffset;
    273273      N = 0;
    274       for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
     274      for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    275275        /* if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue; */
    276276        Mcal  = getMcal  (m, i);
     
    305305      image_bad = IMAGE_BAD;
    306306      IMAGE_BAD = ID_IMAGE_NOCAL;
    307       m = catalog[i].average[j].offset;
     307      m = catalog[i].average[j].measureOffset;
    308308      N = 0;
    309       for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
     309      for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    310310        /* if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue; */
    311311        Mcal  = getMcal  (m, i);
     
    362362      /* calculate the average value for a single star */
    363363      if (catalog[i].average[j].code & STAR_BAD) continue; 
    364       m = catalog[i].average[j].offset;
     364      m = catalog[i].average[j].measureOffset;
    365365
    366366      N = 0;
    367       for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
     367      for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    368368        Mcal = getMcal  (m, i);
    369369        if (isnan(Mcal)) continue;
  • trunk/Ohana/src/relphot/src/bcatalog.c

    r15743 r16810  
    2222  /* exclude stars not in range or with too few measurements */
    2323  for (i = 0; i < catalog[0].Naverage; i++) {
    24     // if (catalog[0].average[i].Nm < 2) continue;
     24    // if (catalog[0].average[i].Nmeasure < 2) continue;
    2525
    2626    /* start with all stars good */
    2727    subcatalog[0].average[Naverage] = catalog[0].average[i];
    28     subcatalog[0].average[Naverage].offset = Nmeasure;
     28    subcatalog[0].average[Naverage].measureOffset = Nmeasure;
    2929    for (j = 0; j < PhotNsec; j++) {
    3030      subcatalog[0].secfilt[PhotNsec*Naverage+j] = catalog[0].secfilt[PhotNsec*i+j];
     
    3939
    4040    Nm = 0;
    41     for (j = 0; j < catalog[0].average[i].Nm; j++) {
     41    for (j = 0; j < catalog[0].average[i].Nmeasure; j++) {
    4242
    43       offset = catalog[0].average[i].offset + j;
     43      offset = catalog[0].average[i].measureOffset + j;
    4444
    4545      /* select measurements by photcode */
     
    9696    }
    9797    # endif
    98     subcatalog[0].average[Naverage].Nm = Nm;
     98    subcatalog[0].average[Naverage].Nmeasure = Nm;
    9999    Naverage ++;
    100100    if (Naverage == NAVERAGE) {
  • trunk/Ohana/src/relphot/src/plot_scatter.c

    r15509 r16810  
    1111  for (i = 0; i < Ncatalog; i++) {
    1212    for (j = 0; j < catalog[i].Naverage; j++) {
    13       Ntot += catalog[i].average[j].Nm;
     13      Ntot += catalog[i].average[j].Nmeasure;
    1414    }
    1515  }
     
    2424      /* calculate the average value for a single star */
    2525      if (catalog[i].average[j].code & STAR_BAD) continue; 
    26       m = catalog[i].average[j].offset;
     26      m = catalog[i].average[j].measureOffset;
    2727
    28       for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
     28      for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    2929        if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue;
    3030        Mcal = getMcal  (m, i);
  • trunk/Ohana/src/relphot/src/setExclusions.c

    r15038 r16810  
    1010  for (i = 0; i < Ncatalog; i++) {
    1111    for (j = 0; j < catalog[i].Naverage; j++) {
    12       m = catalog[i].average[j].offset;
    13       for (k = 0; k < catalog[i].average[j].Nm; k++, m++) {
     12      m = catalog[i].average[j].measureOffset;
     13      for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) {
    1414
    1515        /* select measurements by photcode */
  • trunk/Ohana/src/relphot/src/setMrelFinal.c

    r15509 r16810  
    1313      catalog[0].secfilt[PhotNsec*i+PhotSec].Xm = NAN_S_SHORT;
    1414
    15       m = catalog[0].average[i].offset;
    16       for (j = 0; j < catalog[0].average[i].Nm; j++, m++) {
     15      m = catalog[0].average[i].measureOffset;
     16      for (j = 0; j < catalog[0].average[i].Nmeasure; j++, m++) {
    1717       
    1818        /* select measurements by photcode */
     
    5656    catalog[0].average[i].code &= ~ID_STAR_FEW;
    5757    catalog[0].average[i].code &= ~ID_STAR_POOR;
    58     m = catalog[0].average[i].offset;
    59     for (j = 0; j < catalog[0].average[i].Nm; j++, m++) {
     58    m = catalog[0].average[i].measureOffset;
     59    for (j = 0; j < catalog[0].average[i].Nmeasure; j++, m++) {
    6060      catalog[0].measure[m].dbFlags &= ~ID_MEAS_NOCAL;
    6161    }
     
    8080  /* mark measures which should be ignored on second pass */
    8181  for (i = 0; i < catalog[0].Naverage; i++) {
    82     Ntot += catalog[0].average[i].Nm;
     82    Ntot += catalog[0].average[i].Nmeasure;
    8383    if (catalog[0].found[i]) continue;
    8484
    85     m = catalog[0].average[i].offset;
    86     for (k = 0; k < catalog[0].average[i].Nm; k++, m++) {
     85    m = catalog[0].average[i].measureOffset;
     86    for (k = 0; k < catalog[0].average[i].Nmeasure; k++, m++) {
    8787      Ntry++;
    8888
  • trunk/Ohana/src/uniphot/src/update_catalog.c

    r15509 r16810  
    1717    }
    1818
    19     m = catalog[0].average[i].offset;
    20     for (j = 0; j < catalog[0].average[i].Nm; j++, m++) {
     19    m = catalog[0].average[i].measureOffset;
     20    for (j = 0; j < catalog[0].average[i].Nmeasure; j++, m++) {
    2121      code = GetPhotcodebyCode (catalog[0].measure[m].photcode);
    2222      if (code == NULL) continue;
Note: See TracChangeset for help on using the changeset viewer.