IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21508


Ignore:
Timestamp:
Feb 16, 2009, 11:33:52 AM (17 years ago)
Author:
eugene
Message:

merge changes from eam_branch_20090208: add PS1_V1 formats; rename average.code to flags, image.code to flags; some opihi function name clarification; drop Stars as autocode struct; rework addstar to isolate input -> Measure conversions

Location:
trunk/Ohana
Files:
19 added
8 deleted
114 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/configure.tcsh

    r19564 r21508  
    1212set memcheck = 0
    1313set use_tcmalloc = 0
     14set use_gnu99 = 0
    1415
    1516set prefix  = ""
     
    7071   set use_tcmalloc = 1
    7172   breaksw;
     73  case --use-gnu99
     74   set use_gnu99 = 1
     75   breaksw;
    7276  case --pedantic
    7377   set pedantic = 1
     
    167171  set CFLAGS = "-g -O0"
    168172endif 
     173
    169174# optimize overrides user-supplied CFLAGS
    170175if ($optimize) set CFLAGS = "-O2"
     
    172177# profiler code
    173178if ($profile) set CFLAGS = "$CFLAGS -pg"
     179
     180# use_gnu99
     181if ($use_gnu99) set CFLAGS = "$CFLAGS -std=gnu99"
    174182
    175183if (! $?CPPFLAGS) then
  • trunk/Ohana/src/addstar/Makefile

    r20936 r21508  
    2727mkcmf       : $(BIN)/mkcmf.$(ARCH)
    2828
    29 all: addstar addstarc addstard addstart sedstar load2mass skycells
     29all: addstar sedstar load2mass skycells
     30
     31# I need to fix the client/server version of addstar now that I have dropped Stars
     32# as an autocode type and have converted to carrying average and measure
     33# all: addstar addstarc addstard addstart sedstar load2mass skycells
    3034
    3135ADDSTAR = \
     
    4852$(SRC)/find_matches_refstars.$(ARCH).o \
    4953$(SRC)/find_subset.$(ARCH).o \
    50 $(SRC)/get2mass.$(ARCH).o \
    51 $(SRC)/get2mass_as.$(ARCH).o \
    52 $(SRC)/get2mass_as_raw.$(ARCH).o \
    53 $(SRC)/get2mass_dr2.$(ARCH).o \
    54 $(SRC)/get2mass_ops.$(ARCH).o \
    5554$(SRC)/getgsc.$(ARCH).o \
    5655$(SRC)/gettycho.$(ARCH).o \
     
    7170$(SRC)/replace_match.$(ARCH).o \
    7271$(SRC)/resort_catalog.$(ARCH).o \
     72$(SRC)/StarOps.$(ARCH).o \
    7373$(SRC)/ReadStarsFITS.$(ARCH).o \
    7474$(SRC)/ReadStarsTEXT.$(ARCH).o \
     
    106106$(SRC)/find_matches_refstars.$(ARCH).o \
    107107$(SRC)/find_subset.$(ARCH).o \
    108 $(SRC)/get2mass.$(ARCH).o \
    109 $(SRC)/get2mass_as.$(ARCH).o \
    110 $(SRC)/get2mass_as_raw.$(ARCH).o \
    111 $(SRC)/get2mass_dr2.$(ARCH).o \
    112 $(SRC)/get2mass_ops.$(ARCH).o \
    113108$(SRC)/getgsc.$(ARCH).o \
    114109$(SRC)/gettycho.$(ARCH).o \
     
    141136$(SRC)/find_matches_refstars.$(ARCH).o \
    142137$(SRC)/find_subset.$(ARCH).o \
    143 $(SRC)/get2mass.$(ARCH).o \
    144 $(SRC)/get2mass_as.$(ARCH).o \
    145 $(SRC)/get2mass_as_raw.$(ARCH).o \
    146 $(SRC)/get2mass_dr2.$(ARCH).o \
    147 $(SRC)/get2mass_ops.$(ARCH).o \
    148138$(SRC)/getgsc.$(ARCH).o \
    149139$(SRC)/getusno.$(ARCH).o \
     
    209199$(SRC)/replace_match.$(ARCH).o \
    210200$(SRC)/update_coords.$(ARCH).o \
     201$(SRC)/StarOps.$(ARCH).o \
    211202$(SRC)/ConfigInit.$(ARCH).o \
    212203$(SRC)/Shutdown.$(ARCH).o \
     
    252243$(BIN)/mkcmf.$(ARCH)       : $(MKCMF)
    253244
    254 INSTALL = addstar addstarc addstard addstart sedstar load2mass skycells mkcmf
     245INSTALL = addstar sedstar load2mass skycells mkcmf
     246
     247# I need to fix the client/server version of addstar now that I have dropped Stars
     248# as an autocode type and have converted to carrying average and measure
     249# all: addstar addstarc addstard addstart sedstar load2mass skycells
     250# INSTALL = addstar addstarc addstard addstart sedstar load2mass skycells mkcmf
    255251
    256252# dependancy rules for binary code #########################
  • trunk/Ohana/src/addstar/doc/notes.txt

    r20652 r21508  
     1
     22009.02.11
     3
     4  updating DVO tables with more fields: cleaning up the conversions
     5  from external formats to the DVO internal formats:  I am changing
     6  the APIs to convert directly to the Measure structure, including
     7  conversion functions for the compressed fields (ie, pixels carried
     8  as short).
     9
     10  A few remaining issues:
     11
     12  * t_msec : I've added a field to carry the fractional seconds, but
     13    nothing is yet setting this value, and the query functions do not
     14    use this value.
     15
     16  * various fields are reported in either arcseconds or pixels (eg,
     17    FWHMx, moments, error in centroid).  These are currently not very
     18    consistent, and should be tightened up...
     19
     20    ** if we store these values in pixels, then cameras with a wide
     21       range of plate scales (GPC1 << SkyProbe << AllSky) will all fit
     22       in field with a small dynamic range; since we also provide the
     23       plate scale (as a float), conversions are easy:
     24       GPC1     : 0.26 arcsec / pixel
     25       SkyProbe : 4.5 arcsec / pixel
     26       AllSky   : 3600.0 arcsec / pixel
    127
    2282008.10.11
  • trunk/Ohana/src/addstar/include/addstar.h

    r21153 r21508  
    2828    fprintf (stderr, "ERROR:  photcode %s not found in photcode table\n", NAME); \
    2929    exit (0); }
     30
     31typedef struct {
     32  char *exthead;
     33  char *extdata;
     34  char *exttype;
     35  int extnum_head;
     36  int extnum_data;
     37} HeaderSet;
     38
     39typedef struct {
     40  Average average;
     41  Measure measure;
     42  int found;
     43} Stars;
    3044
    3145typedef struct {
     
    3953  char *refcat;
    4054} DVO_DATA;
    41 
    42 typedef struct {
    43   char *exthead;
    44   char *extdata;
    45   char *exttype;
    46   int extnum_head;
    47   int extnum_data;
    48 } HeaderSet;
    4955
    5056typedef struct sockaddr_in SockAddress;
     
    9298/* these globals modify the behavior of gstars (KEEP) */
    9399double  SNLIMIT;
     100int     PHOTFLAG_EXCLUDE;
    94101int     ACCEPT_ASTROM;  // accept even bad astrometry solutions (NASTRO == 0)
    95102int     ACCEPT_MOTION;  // accept reference proper motion measurements
     
    137144/*** addstar prototypes ***/
    138145
     146AddstarClientOptions ConfigInit   PROTO((int *argc, char **argv));
     147AddstarClientOptions args         PROTO((int argc, char **argv, AddstarClientOptions options));
     148
    139149void       AddToCalibration       PROTO((Average *average, SecFilt *secfilt, Measure *measure, Measure *new, int *next, int Nstar));
    140 AddstarClientOptions ConfigInit   PROTO((int *argc, char **argv));
    141150void       FindCalibration        PROTO((Image *image));
    142151FILE      *GetDB                  PROTO((int *state));
     
    145154void       SetProtect             PROTO((int mode));
    146155int        SetSignals             PROTO((void));
    147 int        Shutdown               PROTO((char *message, ...); )
     156int        Shutdown               PROTO((char *message, ...));
    148157void       TrapSignal             PROTO((int sig));
    149158float      airmass                PROTO((float secz_image, double ra, double dec, double st, double latitude));
     159float      azimuth                PROTO((double ha, double dec, double latitude));
    150160void       SetAirmassQuality      PROTO((int quality));
    151161SkyTable  *SkyTableFromTychoIndex PROTO((char *filename, int VERBOSE));
    152 AddstarClientOptions args         PROTO((int argc, char **argv, AddstarClientOptions options));
    153162void       check_permissions      PROTO((char *basefile));
    154163int        dump_rawstars          PROTO((Stars *stars, int Nstars));
    155164int        edge_check             PROTO((double *x1, double *y1, double *x2, double *y2));
    156165Image     *fakeimage              PROTO((char *rootname, int *Nimage, int photcode));
     166
    157167int        find_matches           PROTO((SkyRegion *region, Stars *stars, int Nstars, Catalog *catalog, AddstarClientOptions options));
    158168int        find_matches_closest   PROTO((SkyRegion *region, Stars *stars, int Nstars, Catalog *catalog, AddstarClientOptions options));
    159169int        find_matches_refstars  PROTO((SkyRegion *region, Stars **stars, int Nstars, Catalog *catalog, AddstarClientOptions options));
     170
    160171Stars    **find_subset            PROTO((SkyRegion *region, Stars *stars, int Nstars, int *NSTARS));
    161172int        gcatalog               PROTO((Catalog *catalog));
    162173Stars     *get2mass               PROTO((SkyRegion *patch, int photcode, int mode, int *NSTARS));
    163174double     get_subpix             PROTO((double x, double y));
     175
     176Stars     *greference             PROTO((char *Refcat, SkyRegion *catstats, int photcode, int *nstars));
    164177Stars     *getgsc                 PROTO((SkyRegion *patch, int *NSTARS));
    165178Stars     *gettycho               PROTO((SkyRegion *catstats, int photcode, int *Nstars));
    166179Stars     *getusno                PROTO((SkyRegion *catstats, int photcode, int *Nstars));
    167180Stars     *getusnob               PROTO((SkyRegion *catstats, int photcode, int *Nstars));
    168 Image     *gimages                PROTO((FITS_DB *db, Image *image, Coords *mosaic, int *Npimage));
    169 Stars     *grefcat                PROTO((char *Refcat, SkyRegion *catstats, int photcode, int *nstars));
     181
     182// load text-based stars (REF only in the sense of REF photcodes)
    170183Stars     *grefstars              PROTO((char *file, int photcode, int *Nstars));
    171184
     
    249262Stars     *Convert_PS1_DEV_0      PROTO((FTable *table, int *nstars));
    250263Stars     *Convert_PS1_DEV_1      PROTO((FTable *table, int *nstars));
     264Stars     *Convert_PS1_V1         PROTO((FTable *table, int *nstars));
     265
     266int        InitStar               PROTO((Stars *star));
     267short      ShortPixels            PROTO((float pixels));
     268short      ShortDegree            PROTO((float degrees));
    251269
    252270int args_skycells (int argc, char **argv);
  • trunk/Ohana/src/addstar/include/skycells.h

    r21153 r21508  
    3030  int NX;
    3131  int NY;
    32   int code;
     32  int photcode;
    3333  char name[64];
    3434} SkyRectangle;
  • trunk/Ohana/src/addstar/src/ConfigInit.c

    r20936 r21508  
    3939  ScanConfig (config, "MIN_SN_FSTAT",           "%lf", 0, &SNLIMIT);
    4040  ScanConfig (config, "ADDSTAR_SNLIMIT",        "%lf", 0, &SNLIMIT);
     41
     42  /* exclude stars with bits that match the given photFlags bits */
     43  PHOTFLAG_EXCLUDE = 0;
     44  ScanConfig (config, "ADDSTAR_PHOTFLAG_EXCLUDE", "%d", 0, &PHOTFLAG_EXCLUDE);
    4145
    4246  MAX_CERROR = 0.5; // arcseconds
  • trunk/Ohana/src/addstar/src/FilterStars.c

    r19823 r21508  
    11# include "addstar.h"
     2# define EXTERNAL_ID FALSE
    23
     4/* exclude some detections based on various filter options:
     5 * *** S/N limit
     6 * *** Acceptable window on detector
     7 * *** bad photFlags
     8 */
     9
     10// the imageID supplied here is the sequence **within this set**
     11// this value is updated based on the image table later
    312Stars *FilterStars (Stars *instars, Image *image, unsigned int imageID) {
    413
     
    1928  ALLOCATE (stars, Stars, image[0].nstar);
    2029  for (N = j = 0; j < image[0].nstar; j++) {
     30
    2131    /* allow for some dynamic filtering of star list */
    22     if (SNLIMIT && instars[j].dM > SNLIMIT) continue;
    23     if (XMAX && (instars[j].X > XMAX)) continue;
    24     if (XMIN && (instars[j].X < XMIN)) continue;
    25     if (YMAX && (instars[j].Y > YMAX)) continue;
    26     if (YMIN && (instars[j].Y < YMIN)) continue;
     32    if (SNLIMIT && instars[j].measure.dM > SNLIMIT) continue;
     33    if (XMAX && (instars[j].measure.Xccd > XMAX)) continue;
     34    if (XMIN && (instars[j].measure.Xccd < XMIN)) continue;
     35    if (YMAX && (instars[j].measure.Yccd > YMAX)) continue;
     36    if (YMIN && (instars[j].measure.Yccd < YMIN)) continue;
     37    if (PHOTFLAG_EXCLUDE && (instars[j].measure.photFlags & PHOTFLAG_EXCLUDE)) continue;
     38
    2739    stars[N] = instars[j];
    2840
    29     XY_to_RD (&stars[N].R, &stars[N].D, stars[N].X, stars[N].Y, &image[0].coords);
    30     stars[N].R = ohana_normalize_angle (stars[N].R);
    31     stars[N].found = -1;
    32     stars[N].code = image[0].photcode;
     41    XY_to_RD (&stars[N].average.R, &stars[N].average.D, stars[N].measure.Xccd, stars[N].measure.Yccd, &image[0].coords);
     42    stars[N].average.R = ohana_normalize_angle (stars[N].average.R);
    3343
    34     RMIN = MIN (RMIN, stars[N].R);
    35     RMAX = MAX (RMAX, stars[N].R);
    36     DMIN = MIN (DMIN, stars[N].D);
    37     DMAX = MAX (DMAX, stars[N].D);
     44    stars[N].measure.photcode = image[0].photcode;
     45
     46    // determine the full coverage of this set of measurements
     47    RMIN = MIN (RMIN, stars[N].average.R);
     48    RMAX = MAX (RMAX, stars[N].average.R);
     49    DMIN = MIN (DMIN, stars[N].average.D);
     50    DMAX = MAX (DMAX, stars[N].average.D);
     51
    3852    /** additional quantities to supply to Stars based on the image data **/
    3953
    40     /* calculate accurate per-star airmass */
    41     stars[N].airmass = airmass (image[0].secz, stars[N].R, stars[N].D, image[0].sidtime, image[0].latitude);
    42     stars[N].Mcal    = image[0].Mcal;
    43     stars[N].t       = image[0].tzero + 1e-4*stars[N].Y*image[0].trate;  /* trate is in 0.1 msec / row */
    44     stars[N].dt      = MTIME;
     54    /* calculate accurate per-star airmass and azimuth */
     55    stars[N].measure.airmass = airmass (image[0].secz, stars[N].average.R, stars[N].average.D, image[0].sidtime, image[0].latitude);
     56    stars[N].measure.az      = azimuth (image[0].sidtime - stars[N].average.R, stars[N].average.D, image[0].latitude);
     57    stars[N].measure.Mcal    = image[0].Mcal;
     58    stars[N].measure.t       = image[0].tzero + 1e-4*stars[N].measure.Yccd*image[0].trate;  /* trate is in 0.1 msec / row */
     59    stars[N].measure.dt      = MTIME;
    4560
    46     if ((stars[N].M > 25.0) && (stars[N].M < 32.0)) {
     61    // watch out for any strange values:
     62    if ((stars[N].measure.M > 25.0) && (stars[N].measure.M < 32.0)) {
    4763      fprintf (stderr, "*");
    4864    }
    49 
    5065    // stars->M is either NAN or a valid inst magnitude
    5166    // stars->dM is either NAN or a valid error
     
    5469    dMx = 0.0;
    5570    if (SUBPIX) {
    56       dMs = get_subpix (stars[N].X, stars[N].Y);
    57       dMx = scat_subpix (stars[N].X, stars[N].Y);
    58       if (!isnan(stars[N].dM)) {
    59         stars[N].dM = hypot (stars[N].dM, dMx);
     71      dMs =  get_subpix (stars[N].measure.Xccd, stars[N].measure.Yccd);
     72      dMx = scat_subpix (stars[N].measure.Xccd, stars[N].measure.Yccd);
     73      if (!isnan(stars[N].measure.dM)) {
     74        stars[N].measure.dM = hypot (stars[N].measure.dM, dMx);
    6075      }
    6176    }
    6277
    63     if (!isnan(stars[N].M)) {
    64       stars[N].M += MTIME - dMs;
     78    if (!isnan(stars[N].measure.M)) {
     79      stars[N].measure.M  += MTIME - dMs;
    6580    }
    66     if (!isnan(stars[N].Map)) {
    67       stars[N].Map += MTIME - dMs;
     81    if (!isnan(stars[N].measure.Map)) {
     82      stars[N].measure.Map += MTIME - dMs;
    6883    }
    6984   
    70     // XXX currently, this ID is internal only;
    71     // should we use the psphot / other external ID, if available?
    72     stars[N].detID = N; // sequence number within image
    73     stars[N].imageID = imageID; // does this need to be updated?
     85    // the external ID is supplied, but do we trust it?
     86    if (!EXTERNAL_ID) {
     87      stars[N].measure.detID = N; // sequence number within image
     88    }
     89
     90# if (0)
     91    if (PSPS_ID) {
     92      double mjd;
     93      mjd = ohana_sec_to_mjd (image[0].tzero);
     94      // XXX this is clearly wrong : what does PSPS want?
     95      stars[N].measure.extID = PSPS_create_detectid (mjd, imageID);
     96    }
     97# endif
     98
     99    stars[N].measure.imageID = imageID; // this value is update in UpdateImageIDs
    74100
    75101    N ++;
  • trunk/Ohana/src/addstar/src/GetFileMode.c

    r20545 r21508  
    77  int Naxis;
    88  int simple, extend, haveNaxis, haveCTYPE;
     9  int tmp, havePHOT_VER, haveTARG_VER;
    910
    1011  gfits_scan (header, "SIMPLE", "%t", 1, &simple);
     
    1415  gfits_scan (header, "EXTEND", "%t", 1, &extend);
    1516   
    16 {
    17     int tmp, havePHOT_VER, haveTARG_VER;
    18 
    19     // SDSS tsObj files have a version number for the PHOTO and
    20     // TS (target selection) pipelines present as header keywords
    21     havePHOT_VER = gfits_scan (header, "PHOT_VER", "%s", 1, &tmp);
    22     haveTARG_VER = gfits_scan (header, "TARG_VER", "%s", 1, &tmp);
    23     if (havePHOT_VER && haveTARG_VER) return SDSS_OBJ;
    24 }
     17  // SDSS tsObj files have a version number for the PHOTO and
     18  // TS (target selection) pipelines present as header keywords
     19  havePHOT_VER = gfits_scan (header, "PHOT_VER", "%s", 1, &tmp);
     20  haveTARG_VER = gfits_scan (header, "TARG_VER", "%s", 1, &tmp);
     21  if (havePHOT_VER && haveTARG_VER) return SDSS_OBJ;
    2522
    2623  if ((Naxis == 2) || TEXTMODE || !simple) {
  • trunk/Ohana/src/addstar/src/LoadData.c

    r19259 r21508  
    4141    // I need to detect them here and load them with ReadStarsTEXT instead of calling the code
    4242    // below.
     43    // inStars = ReadStarsFITS (f, headers[Nhead], headers[Ndata], &images[0][Nvalid].nstar);
    4344
    4445    // XXX use something to set the chip name? EXTNAME?
  • trunk/Ohana/src/addstar/src/LoadDataPMM.c

    r19259 r21508  
    8282
    8383    for (i = 0; i < Nline; i++) {
    84       // fscanf (f, "%lf %lf %lf", &ra, &dec, &mag) != EOF) {
    85 
    8684      dparse (&ra,  1, &buffer[i*NBYTE_ASC_TABLE]);
    8785      dparse (&dec, 2, &buffer[i*NBYTE_ASC_TABLE]);
    8886      dparse (&mag, 3, &buffer[i*NBYTE_ASC_TABLE]);
    8987
    90       memset (&inStars[Ninstars], 0, sizeof(Stars));
     88      InitStar (&inStars[Ninstars]);
    9189
    9290      if (ra > 180) {
     
    10098      maxD = MAX(maxD, dec);
    10199
    102       inStars[Ninstars].M       = mag - ZeroPoint + ZeroPt;
    103       inStars[Ninstars].R       = ra;
    104       inStars[Ninstars].D       = dec;
    105       inStars[Ninstars].t       = images[0][0].tzero;
    106       inStars[Ninstars].dt      = images[0][0].exptime;
    107       inStars[Ninstars].code    = code;
    108       inStars[Ninstars].airmass = airmass;
    109       inStars[Ninstars].az      = az;
    110       inStars[Ninstars].found   = -1; // found starts at -1 == not yet found
     100      inStars[Ninstars].average.R        = ra;
     101      inStars[Ninstars].average.D        = dec;
     102
     103      inStars[Ninstars].measure.M        = mag - ZeroPoint + ZeroPt;
     104      inStars[Ninstars].measure.t        = images[0][0].tzero;
     105      inStars[Ninstars].measure.dt       = images[0][0].exptime;
     106      inStars[Ninstars].measure.photcode = code;
     107      inStars[Ninstars].measure.airmass  = airmass;
     108      inStars[Ninstars].measure.az       = az;
     109
    111110      Ninstars++;
    112111      CHECK_REALLOCATE (inStars, Stars, NINSTARS, Ninstars, 10000);
     
    238237    image[0].Mcal = 0.0;
    239238    image[0].Xm   = NAN_S_SHORT;
    240     image[0].code = 0;
     239    image[0].flags = 0;
    241240
    242241    image[0].nstar = 0;
  • trunk/Ohana/src/addstar/src/LoadStars.c

    r16973 r21508  
    6363    }
    6464
     65    // load PMM data if specified (these are not stored as FITS-tables)
    6566    if (PMM_CCD_TABLE != NULL) {
    6667      LoadDataPMM (f, file[i], images, Nimages, &stars, Nstars);
     
    6869    }
    6970
     71    // otherwise, we have FITS-table files: parse their headers to determine the contents
    7072    headers = LoadHeaders (f, &mode, &Nheaders);
    7173    headerSets = MatchHeaders (&extsize, &NheaderSets, mode, headers, Nheaders);
     
    8688    }
    8789
     90    // if these are SDSS data, load with SDSS-specific wrapper
    8891    if (headerSets[0].exttype && !strcmp (headerSets[0].exttype, "SDSS_OBJ")) {
    8992      LoadDataSDSS (f, file[i], images, Nimages, &stars, Nstars, headers, extsize, headerSets, NheaderSets);
  • trunk/Ohana/src/addstar/src/MatchHeaders.c

    r16810 r21508  
    5151    if (!strcmp (exttype, "PS1_DEV_0")) goto keep;
    5252    if (!strcmp (exttype, "PS1_DEV_1")) goto keep;
     53    if (!strcmp (exttype, "PS1_V1")) goto keep;
    5354    continue;
    5455
  • trunk/Ohana/src/addstar/src/ReadImageHeader.c

    r20936 r21508  
    200200  image[0].Mcal = 0.0;
    201201  image[0].Xm   = NAN_S_SHORT;
    202   image[0].code = 0;
     202  image[0].flags = 0;
    203203
    204204  /* find expected number of stars */
  • trunk/Ohana/src/addstar/src/ReadStarsFITS.c

    r17191 r21508  
    4040    stars = Convert_PS1_DEV_1 (&table, &Nstars);
    4141  }
     42  if (!strcmp (type, "PS1_V1")) {
     43    stars = Convert_PS1_V1 (&table, &Nstars);
     44  }
    4245  if (stars == NULL) {
    4346    fprintf (stderr, "ERROR: invalid table type %s\n", type);
     
    6265  ZeroPt = GetZeroPoint();
    6366
    64   /* XXX we need to check at least the size of the loaded table */
    65   // XXX use memset to zero-out the elements before setting
    66 
    67   ALLOCATE (stars, Stars, Nstars);
    68   for (i = 0; i < Nstars; i++) {
    69     stars[i].X      = smpdata[i].X;
    70     stars[i].Y      = smpdata[i].Y;
     67  ALLOCATE (stars, Stars, Nstars);
     68  for (i = 0; i < Nstars; i++) {
     69    InitStar (&stars[i]);
     70
     71    stars[i].measure.Xccd      = smpdata[i].X;
     72    stars[i].measure.Yccd      = smpdata[i].Y;
    7173
    7274    if ((smpdata[i].M >= ZeroPt) || isnan(smpdata[i].M)) {
    73       stars[i].M    = NAN;
    74       stars[i].Map  = NAN;
    75     } else {
    76       stars[i].M    = smpdata[i].M;
    77       stars[i].Map  = smpdata[i].M;
    78     }
    79 
    80     stars[i].dM     = smpdata[i].dM*0.001;
    81     stars[i].dophot = smpdata[i].dophot;
    82 
    83     stars[i].fx     = smpdata[i].fx;
    84     stars[i].fy     = smpdata[i].fy;
    85     stars[i].df     = smpdata[i].df;
     75      stars[i].measure.M       = NAN;
     76      stars[i].measure.Map     = NAN;
     77    } else {
     78      stars[i].measure.M       = smpdata[i].M;
     79      stars[i].measure.Map     = smpdata[i].M;
     80    }
     81
     82    stars[i].measure.dM        = smpdata[i].dM*0.001;
     83
     84    // the dophot type information gets pushed into the upper 2 bytes of photFlags
     85    stars[i].measure.photFlags = (smpdata[i].dophot << 16);
     86
     87    stars[i].measure.FWx       = ShortPixels (smpdata[i].fx);
     88    stars[i].measure.FWy       = ShortPixels (smpdata[i].fy);
     89    stars[i].measure.theta     = ShortDegree (smpdata[i].df);
    8690  }   
    8791  *nstars = Nstars;
     
    101105  ALLOCATE (stars, Stars, Nstars);
    102106  for (i = 0; i < Nstars; i++) {
    103     stars[i].X       = ps1data[i].X;
    104     stars[i].Y       = ps1data[i].Y;
    105     stars[i].dX      = ps1data[i].dX;
    106     stars[i].dY      = ps1data[i].dY;
     107    InitStar (&stars[i]);
     108    stars[i].measure.Xccd     = ps1data[i].X;
     109    stars[i].measure.Yccd     = ps1data[i].Y;
     110
     111    stars[i].measure.dXccd    = ShortPixels(ps1data[i].dX);
     112    stars[i].measure.dYccd    = ShortPixels(ps1data[i].dY);
     113   
    107114    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
    108       stars[i].M     = NAN;
    109     } else {
    110       stars[i].M     = ps1data[i].M + ZeroPt;
    111     }
    112     stars[i].dM      = ps1data[i].dM;
    113     stars[i].Mpeak   = ps1data[i].Mpeak;
    114 
    115     stars[i].sky     = ps1data[i].sky;
    116     stars[i].dsky    = ps1data[i].dSky;
    117 
    118     stars[i].fx      = ps1data[i].fx;
    119     stars[i].fy      = ps1data[i].fy;
    120     stars[i].df      = ps1data[i].df;
    121 
    122     stars[i].psfChisq = ps1data[i].psfChisq;
    123     stars[i].psfQual  = ps1data[i].psfQual;
    124 
    125     stars[i].detID   = ps1data[i].detID;
    126 
    127     /* these are set elsewhere */
    128     stars[i].R       = 0.0;
    129     stars[i].D       = 0.0;
    130     stars[i].dR      = 0.0;
    131     stars[i].dD      = 0.0;
    132 
    133     stars[i].uR      = 0.0;
    134     stars[i].uD      = 0.0;
    135     stars[i].duR     = 0.0;
    136     stars[i].duD     = 0.0;
    137 
    138     stars[i].P       = 0.0;
    139     stars[i].dP      = 0.0;
    140 
    141     stars[i].Mcal    = 0;
    142     stars[i].t       = 0;
    143     stars[i].dt      = 0;
    144     stars[i].airmass = 0;
    145     stars[i].code    = 0;
    146     stars[i].found   = 0;
    147 
    148     /* these are not used */
    149     stars[i].Map     = NAN;
    150     stars[i].dophot  = 0;
     115      stars[i].measure.M      = NAN;
     116    } else {
     117      stars[i].measure.M      = ps1data[i].M + ZeroPt;
     118    }
     119    stars[i].measure.Map      = NAN;
     120    stars[i].measure.dM       = ps1data[i].dM;
     121    stars[i].measure.Sky      = ps1data[i].sky;
     122    stars[i].measure.dSky     = ps1data[i].dSky;
     123
     124    stars[i].measure.FWx      = ShortPixels(ps1data[i].fx);
     125    stars[i].measure.FWy      = ShortPixels(ps1data[i].fy);
     126    stars[i].measure.theta    = ShortDegree(ps1data[i].df);
     127
     128    stars[i].measure.psfChisq = ps1data[i].psfChisq;
     129    stars[i].measure.psfQual  = ps1data[i].psfQual;
     130
     131    stars[i].measure.detID    = ps1data[i].detID;
    151132  }   
    152133  *nstars = Nstars;
     
    168149  ALLOCATE (stars, Stars, Nstars);
    169150  for (i = 0; i < Nstars; i++) {
    170     stars[i].X       = ps1data[i].X;
    171     stars[i].Y       = ps1data[i].Y;
    172     stars[i].dX      = ps1data[i].dX;
    173     stars[i].dY      = ps1data[i].dY;
     151    InitStar (&stars[i]);
     152    stars[i].measure.Xccd       = ps1data[i].X;
     153    stars[i].measure.Yccd       = ps1data[i].Y;
     154
     155    stars[i].measure.dXccd      = ShortPixels(ps1data[i].dX);
     156    stars[i].measure.dYccd      = ShortPixels(ps1data[i].dY);
     157
    174158    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
    175         stars[i].M   = NAN;
    176     } else {
    177         stars[i].M   = ps1data[i].M + ZeroPt;
    178     }
    179     stars[i].dM      = ps1data[i].dM;
    180     stars[i].Mpeak   = ps1data[i].Mpeak;
    181 
    182     stars[i].sky     = ps1data[i].sky;
    183     stars[i].dsky    = ps1data[i].dSky;
    184 
    185     stars[i].fx      = ps1data[i].fx;
    186     stars[i].fy      = ps1data[i].fy;
    187     stars[i].df      = ps1data[i].df;
    188 
    189     stars[i].psfChisq  = ps1data[i].psfChisq;
    190     stars[i].psfQual   = ps1data[i].psfQual;
    191     stars[i].crNsigma  = ps1data[i].crNsigma;
    192     stars[i].extNsigma = ps1data[i].extNsigma;
    193 
    194     stars[i].detID     = ps1data[i].detID;
    195     stars[i].flags     = ps1data[i].flags;
    196 
    197     // XXX not defined anyway
    198     // stars[i].stargal   = ps1data[i].stargal;
    199 
    200     /* these are set elsewhere */
    201     stars[i].R       = 0.0;
    202     stars[i].D       = 0.0;
    203     stars[i].dR      = 0.0;
    204     stars[i].dD      = 0.0;
    205 
    206     stars[i].uR      = 0.0;
    207     stars[i].uD      = 0.0;
    208     stars[i].duR     = 0.0;
    209     stars[i].duD     = 0.0;
    210 
    211     stars[i].P       = 0.0;
    212     stars[i].dP      = 0.0;
    213 
    214     stars[i].Mcal    = 0;
    215     stars[i].t       = 0;
    216     stars[i].dt      = 0;
    217     stars[i].airmass = 0;
    218     stars[i].az      = 0;
    219     stars[i].code    = 0;
    220     stars[i].found   = 0;
    221 
    222     /* these are not used */
    223     stars[i].Map     = NAN;
    224     stars[i].dophot  = 0;
    225   }   
    226   *nstars = Nstars;
    227   return (stars);
    228 }
     159        stars[i].measure.M      = NAN;
     160    } else {
     161        stars[i].measure.M      = ps1data[i].M + ZeroPt;
     162    }
     163    stars[i].measure.Map        = NAN;
     164    stars[i].measure.dM         = ps1data[i].dM;
     165    stars[i].measure.Sky        = ps1data[i].sky;
     166    stars[i].measure.dSky       = ps1data[i].dSky;
     167
     168    stars[i].measure.FWx        = ShortPixels(ps1data[i].fx);
     169    stars[i].measure.FWy        = ShortPixels(ps1data[i].fy);
     170    stars[i].measure.theta      = ShortDegree(ps1data[i].df);
     171
     172    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     173    stars[i].measure.psfQual    = ps1data[i].psfQual;
     174    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     175    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     176
     177    stars[i].measure.detID      = ps1data[i].detID;
     178    stars[i].measure.photFlags  = ps1data[i].flags;
     179  }   
     180  *nstars = Nstars;
     181  return (stars);
     182}
     183
     184Stars *Convert_PS1_V1 (FTable *table, int *nstars) {
     185
     186  int i, Nstars;
     187  double ZeroPt;
     188  Stars *stars;
     189  CMF_PS1_V1 *ps1data;
     190
     191  ps1data = gfits_table_get_CMF_PS1_V1 (table, &Nstars, NULL);
     192  ZeroPt = GetZeroPoint();
     193
     194  ALLOCATE (stars, Stars, Nstars);
     195  for (i = 0; i < Nstars; i++) {
     196    InitStar (&stars[i]);
     197    stars[i].measure.Xccd       = ps1data[i].X;
     198    stars[i].measure.Yccd       = ps1data[i].Y;
     199    stars[i].measure.dXccd      = ShortPixels(ps1data[i].dX);
     200    stars[i].measure.dYccd      = ShortPixels(ps1data[i].dY);
     201
     202    stars[i].measure.posangle   = ShortDegree(ps1data[i].posangle);
     203    stars[i].measure.pltscale   = ps1data[i].pltscale;
     204
     205    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     206        stars[i].measure.M      = NAN;
     207    } else {
     208        stars[i].measure.M      = ps1data[i].M + ZeroPt;
     209    }
     210    stars[i].measure.dM         = ps1data[i].dM;
     211    stars[i].measure.dMcal      = ps1data[i].dMcal;
     212    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     213                       
     214    stars[i].measure.Sky        = ps1data[i].sky;
     215    stars[i].measure.dSky       = ps1data[i].dSky;
     216                       
     217    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     218    stars[i].measure.psfQual    = ps1data[i].psfQual;
     219    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     220    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     221    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     222    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     223
     224    stars[i].measure.FWx        = ShortPixels(ps1data[i].fx);
     225    stars[i].measure.FWy        = ShortPixels(ps1data[i].fy);
     226    stars[i].measure.theta      = ShortDegree(ps1data[i].df);
     227
     228    stars[i].measure.Mxx        = ShortPixels(ps1data[i].Mxx);
     229    stars[i].measure.Mxy        = ShortPixels(ps1data[i].Mxy);
     230    stars[i].measure.Myy        = ShortPixels(ps1data[i].Myy);
     231                       
     232    stars[i].measure.photFlags  = ps1data[i].flags;
     233
     234    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     235    stars[i].measure.detID      = ps1data[i].detID;
     236
     237    // the Average fields and the following Measure fields are set in FilterStars after
     238    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
     239    // averef is set in find_matches, dbFlags is zero on ingest.
     240
     241    // the following fields are currently not being set anywhere: t_msec
     242  }   
     243  *nstars = Nstars;
     244  return (stars);
     245}
  • trunk/Ohana/src/addstar/src/ReadStarsSDSS.c

    r20688 r21508  
    140140    for (j = 0; j < NFILTER; j++) {
    141141      N = NFILTER*i + j;
    142       stars[N].X         = colc[N];
    143       stars[N].Y         = rowc[N];
    144       stars[N].dX        = colcErr[N];
    145       stars[N].dY        = rowcErr[N];
    146       stars[N].M         = psfCounts[N] + ZeroPt - zeropt[j];
    147       stars[N].dM        = psfCountsErr[N];
    148       stars[N].Map       = fiberCounts[N] + ZeroPt - zeropt[j];
    149       stars[N].Mpeak     = NAN;
    150       stars[N].sky       = sky[N]; // adjust this to counts?
    151       stars[N].dsky      = skyErr[N];
    152       stars[N].fx        = seeing[j]; // reported in arcsec?
    153       stars[N].fy        = seeing[j];
    154       stars[N].df        = 0.0;
    155       stars[N].psfChisq  = prob_psf[N]; // XXX not really the correct value...
    156       stars[N].psfQual   = 0.0;
    157       stars[N].crNsigma  = 0.0;
    158       stars[N].extNsigma = 0.0;
    159       stars[N].detID     = N;
    160       stars[N].R         = ra[i] + dCOS(dec[i]) * offsetRa[N] / 3600.0;
    161       stars[N].D         = dec[i] + offsetDec[N] / 3600.0;
    162       stars[N].dR        = NAN;
    163       stars[N].dD        = NAN;
    164       stars[N].uR        = 0.0; // I don't trust the SDSS proper motions
    165       stars[N].uD        = 0.0; // I don't trust the SDSS proper motions
    166       stars[N].duR       = 0.0;
    167       stars[N].duD       = 0.0;
    168       stars[N].P         = 0.0;
    169       stars[N].dP        = 0.0;
    170       stars[N].Mcal      = 0.0;
    171       stars[N].t         = tzero[j] + clockRate*rowc[N]; // time since row 0
    172       stars[N].dt        = 53.907456; // is this 2048*clockRate ?
     142      InitStar (&stars[N]);
     143     
     144      // any values not explicitly set are left at 0.0
     145      stars[N].average.R         = ra[i] + dCOS(dec[i]) * offsetRa[N] / 3600.0;
     146      stars[N].average.D         = dec[i] + offsetDec[N] / 3600.0;
     147      stars[N].average.dR        = NAN;
     148      stars[N].average.dD        = NAN;
     149
     150      stars[N].measure.Xccd      = colc[N];
     151      stars[N].measure.Yccd      = rowc[N];
     152      stars[N].measure.dXccd     = ShortPixels(colcErr[N]);
     153      stars[N].measure.dYccd     = ShortPixels(rowcErr[N]);
     154      stars[N].measure.M         = psfCounts[N] + ZeroPt - zeropt[j];
     155      stars[N].measure.dM        = psfCountsErr[N];
     156      stars[N].measure.Map       = fiberCounts[N] + ZeroPt - zeropt[j];
     157      stars[N].measure.Sky       = sky[N]; // adjust this to counts?
     158      stars[N].measure.dSky      = skyErr[N];
     159      stars[N].measure.FWx       = ShortPixels(seeing[j]); // reported in arcsec?
     160      stars[N].measure.FWy       = ShortPixels(seeing[j]);
     161      stars[N].measure.psfChisq  = prob_psf[N]; // XXX not really the correct value...
     162      stars[N].measure.detID     = N;
     163      stars[N].measure.t         = tzero[j] + clockRate*rowc[N]; // time since row 0
     164      stars[N].measure.dt        = 53.907456; // is this 2048*clockRate ?
    173165
    174166      SetSDSSFlags (&stars[N], flags[N], flags2[N]);
     
    182174      double Latitude = 32.7803611755; // degrees
    183175
    184       jd = ohana_sec_to_jd (stars[N].t);
     176      jd = ohana_sec_to_jd (stars[N].measure.t);
    185177      sidtime  = 15.0*ohana_lst (jd, Longitude); // sidtime in degrees
    186       altaz (&alt, &az, sidtime - stars[N].R, stars[N].D, Latitude);
    187 
    188       stars[N].airmass   = 1.0 / dCOS(90.0 - alt);
    189       stars[N].az        = az;
    190 
    191       stars[N].code      = photcode[j];
    192       stars[N].found     = -1;
    193       stars[N].dophot    = 0;
     178      altaz (&alt, &az, sidtime - stars[N].average.R, stars[N].average.D, Latitude);
     179
     180      stars[N].measure.airmass   = 1.0 / dCOS(90.0 - alt);
     181      stars[N].measure.az        = az;
     182      stars[N].measure.photcode  = photcode[j];
    194183    }
    195184  }   
     
    202191    strcpy (images[N].coords.ctype, "RA---TAN");
    203192   
    204     images[N].coords.crval1 = stars[0].R;
    205     images[N].coords.crval2 = stars[0].D;
     193    images[N].coords.crval1 = stars[0].average.R;
     194    images[N].coords.crval2 = stars[0].average.D;
    206195   
    207     images[N].coords.crpix1 = stars[0].X;
    208     images[N].coords.crpix2 = stars[0].Y;
     196    images[N].coords.crpix1 = stars[0].measure.Xccd;
     197    images[N].coords.crpix2 = stars[0].measure.Yccd;
    209198    images[N].coords.cdelt1 = images[N].coords.cdelt2 = 0.4 / 3600.0;
    210199
     
    251240
    252241    images[N].trate = clockRate * 1e-4;
    253     images[N].secz = stars[0].airmass;
     242    images[N].secz = stars[0].measure.airmass;
    254243    images[N].ccdnum = camcol;
    255244
     
    257246    images[N].Mcal = 0.0;
    258247    images[N].Xm   = NAN_S_SHORT;
    259     images[N].code = 0;
     248    images[N].flags = 0;
    260249
    261250    images[N].nstar = Nstars;
     
    297286
    298287  // XXX this is wrong, need to roll left to set the correct bit
    299   if (flags1 & 0x00000002) star[0].flags |= 0x0001; // BRIGHT            - 1  1
    300   if (flags1 & 0x00000004) star[0].flags |= 0x0002; // EDGE              - 1  2
    301   if (flags1 & 0x00000008) star[0].flags |= 0x0004; // BLENDED           - 1  3
    302   if (flags1 & 0x00000010) star[0].flags |= 0x0008; // CHILD             - 1  4
    303   if (flags1 & 0x00000020) star[0].flags |= 0x0010; // PEAKCENTER        - 1  5
    304   if (flags1 & 0x00000040) star[0].flags |= 0x0020; // NODEBLEND         - 1  6
    305   if (flags1 & 0x00040000) star[0].flags |= 0x0040; // SATUR             - 1 18
    306   if (flags1 & 0x00080000) star[0].flags |= 0x0080; // NOTCHECKED        - 1 19
    307   if (flags1 & 0x10000000) star[0].flags |= 0x0100; // BINNED1           - 1 28
    308   if (flags1 & 0x20000000) star[0].flags |= 0x0200; // BINNED2           - 1 29
    309   if (flags1 & 0x40000000) star[0].flags |= 0x0400; // BINNED4           - 1 30
    310   if (flags2 & 0x00000040) star[0].flags |= 0x0800; // LOCAL_EDGE        - 2  7
    311   if (flags2 & 0x00000800) star[0].flags |= 0x1000; // INTERP_CENTER     - 2 12
    312   if (flags2 & 0x00002000) star[0].flags |= 0x2000; // DEBLEND_NOPEAK    - 2 14
    313   if (flags2 & 0x02000000) star[0].flags |= 0x4000; // NOTCHECKED_CENTER - 2 26
     288  if (flags1 & 0x00000002) star[0].measure.photFlags |= 0x0001; // BRIGHT            - 1  1
     289  if (flags1 & 0x00000004) star[0].measure.photFlags |= 0x0002; // EDGE              - 1  2
     290  if (flags1 & 0x00000008) star[0].measure.photFlags |= 0x0004; // BLENDED           - 1  3
     291  if (flags1 & 0x00000010) star[0].measure.photFlags |= 0x0008; // CHILD             - 1  4
     292  if (flags1 & 0x00000020) star[0].measure.photFlags |= 0x0010; // PEAKCENTER        - 1  5
     293  if (flags1 & 0x00000040) star[0].measure.photFlags |= 0x0020; // NODEBLEND         - 1  6
     294  if (flags1 & 0x00040000) star[0].measure.photFlags |= 0x0040; // SATUR             - 1 18
     295  if (flags1 & 0x00080000) star[0].measure.photFlags |= 0x0080; // NOTCHECKED        - 1 19
     296  if (flags1 & 0x10000000) star[0].measure.photFlags |= 0x0100; // BINNED1           - 1 28
     297  if (flags1 & 0x20000000) star[0].measure.photFlags |= 0x0200; // BINNED2           - 1 29
     298  if (flags1 & 0x40000000) star[0].measure.photFlags |= 0x0400; // BINNED4           - 1 30
     299  if (flags2 & 0x00000040) star[0].measure.photFlags |= 0x0800; // LOCAL_EDGE        - 2  7
     300  if (flags2 & 0x00000800) star[0].measure.photFlags |= 0x1000; // INTERP_CENTER     - 2 12
     301  if (flags2 & 0x00002000) star[0].measure.photFlags |= 0x2000; // DEBLEND_NOPEAK    - 2 14
     302  if (flags2 & 0x02000000) star[0].measure.photFlags |= 0x4000; // NOTCHECKED_CENTER - 2 26
    314303  return (TRUE);
    315304
  • trunk/Ohana/src/addstar/src/ReadStarsTEXT.c

    r16810 r21508  
    77
    88  int j, N, Nextra, Ninstar, Nskip, Nbytes, nbytes;
    9   int done;
     9  int done, itmp;
    1010  char *buffer, *c, *c2;
    11   double tmp;
     11  double tmp, fx, fy, df;
    1212  double ZeroPt;
    1313  Stars *stars;
     
    6666    Nextra = nbytes % BYTES_STAR;
    6767    for (j = 0; (j < Ninstar) && (N < *nstars); j++, N++) {
    68       dparse (&stars[N].X,  1, &buffer[j*BYTES_STAR]);
    69       dparse (&stars[N].Y,  2, &buffer[j*BYTES_STAR]);
    70       dparse (&stars[N].M,  3, &buffer[j*BYTES_STAR]);
    71       if ((stars[N].M > ZeroPt) || isnan(stars[N].M)) {
    72         stars[N].M = NAN;
     68      InitStar (&stars[N]);
     69      fparse (&stars[N].measure.Xccd,  1, &buffer[j*BYTES_STAR]);
     70      fparse (&stars[N].measure.Yccd,  2, &buffer[j*BYTES_STAR]);
     71      fparse (&stars[N].measure.M,  3, &buffer[j*BYTES_STAR]);
     72      if ((stars[N].measure.M > ZeroPt) || isnan(stars[N].measure.M)) {
     73        stars[N].measure.M = NAN;
    7374      }
    7475
    7576      /* cmp files carry dM in millimags */
    7677      dparse (&tmp, 4, &buffer[j*BYTES_STAR]);
    77       stars[N].dM = 0.001*tmp;
     78      stars[N].measure.dM = 0.001*tmp;
    7879
     80      // the dophot type information get pushed into the upper 2 bytes of photFlags
    7981      dparse (&tmp,         5, &buffer[j*BYTES_STAR]);
    80       stars[N].dophot = tmp;
     82      itmp = tmp;
     83      stars[N].measure.photFlags = (itmp << 16);
    8184
    8285      // XXX I've removed the Mgal field from the measure.d table, and am using Map
     
    8790
    8891      // dparse (&stars[N].Mgal, 7, &buffer[j*BYTES_STAR]);
    89       dparse (&stars[N].Map,  8, &buffer[j*BYTES_STAR]);
    90       dparse (&stars[N].fx,   9, &buffer[j*BYTES_STAR]);
    91       dparse (&stars[N].fy,  10, &buffer[j*BYTES_STAR]);
    92       dparse (&stars[N].df,  11, &buffer[j*BYTES_STAR]);
     92      fparse (&stars[N].measure.Map,  8, &buffer[j*BYTES_STAR]);
     93      dparse (&fx,   9, &buffer[j*BYTES_STAR]);
     94      dparse (&fy,  10, &buffer[j*BYTES_STAR]);
     95      dparse (&df,  11, &buffer[j*BYTES_STAR]);
     96
     97      stars[N].measure.FWx   = ShortPixels (fx);
     98      stars[N].measure.FWy   = ShortPixels (fy);
     99      stars[N].measure.theta = ShortDegree (df);
    93100    }
    94101  }
  • trunk/Ohana/src/addstar/src/SEDfit.c

    r16810 r21508  
    164164    outcat[0].average[Nave].measureOffset = Nmeas;
    165165    outcat[0].average[Nave].missingOffset = -1;
    166     outcat[0].average[Nave].code          = 0;
     166    outcat[0].average[Nave].flags         = 0;
    167167
    168168    for (j = 0; j < Nsec; j++) {
     
    181181    for (j = 0; valid && (j < Nmodel); j++) {
    182182      n = modelRow[j];
    183       outcat[0].measure[Nmeas].dR       = 0.0;
    184       outcat[0].measure[Nmeas].dD       = 0.0;
    185       outcat[0].measure[Nmeas].M        = table[0].row[minFit.row][0].mags[n] + minFit.Md;
    186       outcat[0].measure[Nmeas].dM       = 0.0;
    187       outcat[0].measure[Nmeas].Mcal     = 0;
    188       outcat[0].measure[Nmeas].t        = TIMEREF;
    189       outcat[0].measure[Nmeas].averef   = Nave;
    190       outcat[0].measure[Nmeas].photcode = table[0].code[n];
    191       outcat[0].measure[Nmeas].dophot  = 0;
    192       outcat[0].measure[Nmeas].dbFlags  = 0;
    193       outcat[0].measure[Nmeas].dt       = 0xffff;
    194 
    195       outcat[0].measure[Nmeas].airmass  = 0;
    196       outcat[0].measure[Nmeas].FWx      = NAN_S_SHORT;
    197       outcat[0].measure[Nmeas].FWy      = NAN_S_SHORT;
    198       outcat[0].measure[Nmeas].theta    = NAN_S_SHORT;
     183      outcat[0].measure[Nmeas].dR        = 0.0;
     184      outcat[0].measure[Nmeas].dD        = 0.0;
     185      outcat[0].measure[Nmeas].M         = table[0].row[minFit.row][0].mags[n] + minFit.Md;
     186      outcat[0].measure[Nmeas].dM        = 0.0;
     187      outcat[0].measure[Nmeas].Mcal      = 0;
     188      outcat[0].measure[Nmeas].t         = TIMEREF;
     189      outcat[0].measure[Nmeas].averef    = Nave;
     190      outcat[0].measure[Nmeas].photcode  = table[0].code[n];
     191      outcat[0].measure[Nmeas].photFlags = 0;
     192      outcat[0].measure[Nmeas].dbFlags   = 0;
     193      outcat[0].measure[Nmeas].dt        = 0xffff;
     194                                         
     195      outcat[0].measure[Nmeas].airmass   = 0;
     196      outcat[0].measure[Nmeas].FWx       = NAN_S_SHORT;
     197      outcat[0].measure[Nmeas].FWy       = NAN_S_SHORT;
     198      outcat[0].measure[Nmeas].theta     = NAN_S_SHORT;
    199199
    200200      outcat[0].average[Nave].Nmeasure++;
  • trunk/Ohana/src/addstar/src/SkyListForStars.c

    r16040 r21508  
    11# include "addstar.h"
     2
     3void sort_stars_ra (Stars *stars, int N) {
     4
     5# define SWAPFUNC(A,B){ Stars tmp; tmp = stars[A]; stars[A] = stars[B]; stars[B] = tmp; }
     6# define COMPARE(A,B)(stars[A].average.R < stars[B].average.R)
     7
     8  OHANA_SORT (N, COMPARE, SWAPFUNC);
     9
     10# undef SWAPFUNC
     11# undef COMPARE
     12
     13}
    214
    315SkyList *SkyListForStars (SkyTable *table, int depth, Stars *stars, int Nstars) {
     
    1729  sort_stars_ra (stars, Nstars); /* sort by RA */
    1830  for (i = 0; i < Nstars; i++) {
    19     if (stars[i].found) continue;
    20     here = SkyRegionByPoint (table, depth, stars[i].R, stars[i].D);
    21     stars[i].found = TRUE;
     31    if (stars[i].found == -2) continue;
     32    here = SkyRegionByPoint (table, depth, stars[i].average.R, stars[i].average.D);
     33    stars[i].found = -2;
    2234    /* search forward for all contained stars */
    2335    for (j = i; j < Nstars; j++) {
    24       if (stars[j].R >= here[0].regions[0][0].Rmax) break;
    25       if (stars[j].R <  here[0].regions[0][0].Rmin) break;
    26       if (stars[j].D <  here[0].regions[0][0].Dmin) continue;
    27       if (stars[j].D >= here[0].regions[0][0].Dmax) continue;
    28       stars[j].found = TRUE;
     36      if (stars[j].average.R >= here[0].regions[0][0].Rmax) break;
     37      if (stars[j].average.R <  here[0].regions[0][0].Rmin) break;
     38      if (stars[j].average.D <  here[0].regions[0][0].Dmin) continue;
     39      if (stars[j].average.D >= here[0].regions[0][0].Dmax) continue;
     40      stars[j].found = -2;
    2941    }
    3042    list[0].regions[Nr] = here[0].regions[0];
  • trunk/Ohana/src/addstar/src/UpdateImageIDs.c

    r20182 r21508  
    4343
    4444  for (i = 0; i < Nstars; i++) {
    45     stars[i].imageID += imageID;
     45    stars[i].measure.imageID += imageID;
    4646  }
    4747
    4848  imageID += Nimages;
    4949  status = gfits_modify (&db.header, "IMAGEID", "%u", 1, imageID);
    50  
    5150
    5251  if (isEmpty) {
  • trunk/Ohana/src/addstar/src/addstar.c

    r18721 r21508  
    135135        break;
    136136      case M_REFCAT:
    137         stars = grefcat (argv[1], skylist[0].regions[i], options.photcode, &Nstars);
     137        stars = greference (argv[1], skylist[0].regions[i], options.photcode, &Nstars);
    138138      case M_REFLIST:
    139139        subset = find_subset (skylist[0].regions[i], stars, Nstars, &Nsubset);
  • trunk/Ohana/src/addstar/src/airmass.c

    r8642 r21508  
    11# include "addstar.h"
    22
    3 static int AirmassQuality = FALSE;
     3static int AirmassQuality = TRUE;
    44
    55void SetAirmassQuality (int quality) {
     
    2525  return (secz);
    2626}
     27
     28// ha/dec -> az
     29float azimuth (double ha, double dec, double latitude) {
     30
     31  double rdec, rlat, rha;
     32  double sinh, cosh;
     33  float az;
     34
     35  rdec = RAD_DEG*dec;
     36  rha = RAD_DEG*ha;
     37  rlat = RAD_DEG*latitude;
     38
     39  sinh = - cos (rdec) * sin (rha);
     40  cosh =   sin (rdec) * cos (rlat) - cos (rdec) * cos (rha) * sin (rlat);
     41
     42  az = DEG_RAD * atan2 (sinh, cosh);
     43
     44  return az;
     45}
  • trunk/Ohana/src/addstar/src/args.c

    r20183 r21508  
    2828    remove_argument (N, &argc, argv);
    2929  }
     30  if ((N = get_argument (argc, argv, "-resort"))) {
     31    options.mode = M_RESORT;
     32    remove_argument (N, &argc, argv);
     33  }
    3034  if ((N = get_argument (argc, argv, "-fakeimage"))) {
    3135    options.mode = M_FAKEIMAGE;
     
    3640    remove_argument (N, &argc, argv);
    3741    FAKE_THETA = atof (argv[N]);
    38     remove_argument (N, &argc, argv);
    39   }
    40   if ((N = get_argument (argc, argv, "-resort"))) {
    41     options.mode = M_RESORT;
    4242    remove_argument (N, &argc, argv);
    4343  }
     
    221221  /*** optional situations ***/
    222222  /* choose high quality airmass vs low quality airmass (per-star vs per-image) */
    223   QUALITY_AIRMASS = FALSE;
     223  QUALITY_AIRMASS = TRUE;
    224224  if ((N = get_argument (argc, argv, "-quality-airmass"))) {
    225225    remove_argument (N, &argc, argv);
    226226    QUALITY_AIRMASS = TRUE;
     227  }
     228  if ((N = get_argument (argc, argv, "-quick-airmass"))) {
     229    remove_argument (N, &argc, argv);
     230    QUALITY_AIRMASS = FALSE;
    227231  }
    228232  /* choose high quality airmass vs low quality airmass (per-star vs per-image) */
     
    310314
    311315  fprintf (stderr, "USAGE: addstar (filename)\n");
     316  fprintf (stderr, "USAGE: addstar -list (filename)\n");
    312317  fprintf (stderr, "USAGE: addstar -cat (catalog)\n");
    313318  fprintf (stderr, "USAGE: addstar -ref (filename)\n");
    314319  fprintf (stderr, "USAGE: addstar -fakeimage (ra) (dec) (theta) (name)\n");
    315320  fprintf (stderr, "USAGE: addstar -resort (SkyRegion)\n");
     321  fprintf (stderr, "USAGE: addstar -ppm (filename)\n");
    316322  exit (2);
    317323}
     
    322328  fprintf (stderr, "  addstar (filename)\n");
    323329  fprintf (stderr, "     add specified image (cmp format) to database\n\n");
     330  fprintf (stderr, "  addstar -list (filename)\n");
     331  fprintf (stderr, "     add list of images (cmp format) to database\n\n");
    324332  fprintf (stderr, "  addstar -ref (filename)");
    325333  fprintf (stderr, "     add ASCII data (ra dec mag dmag) to database\n\n");
     
    328336  fprintf (stderr, "  addstar -resort (SkyRegion)");
    329337  fprintf (stderr, "     perform measure sorting for the specified catalog\n\n");
     338  fprintf (stderr, "  addstar -fakeimage (ra) (dec) (theta) (name)");
     339  fprintf (stderr, "     insert a fake image in the db\n\n");
     340  fprintf (stderr, "  addstar -pmm (filename)");
     341  fprintf (stderr, "     insert pmm table into database\n\n");
    330342
    331343  fprintf (stderr, "  optional flags:\n");
     
    340352  fprintf (stderr, "  -missed                     : skipped 'missed' entries\n");
    341353  fprintf (stderr, "  -replace                    : replace time/photcode measurements (no duplication)\n");
    342   fprintf (stderr, "  -closest                    : use closest-star algorith\n");
     354  fprintf (stderr, "  -closest                    : use closest-star algorith (default)\n");
     355  fprintf (stderr, "  -all-matches                : use all-matches algorith\n");
    343356  fprintf (stderr, "  -nosort                     : don't re-sort the measure entries (improves speed)\n");
    344357  fprintf (stderr, "  -update                     : only update the new rows (forces -nosort)\n");
     358  fprintf (stderr, "  -force-sort                 : \n");
    345359  fprintf (stderr, "  -image                      : only insert image data\n");
    346360  fprintf (stderr, "  -cal                        : perform zero-point calibration\n");
     361  fprintf (stderr, "  -excal                      : apply supplied zero-point calibration\n");
     362  fprintf (stderr, "  -incal                      : perform zero-point calibration\n");
     363  fprintf (stderr, "  -quality-airmass            : use per-star airmass values (default)\n");
     364  fprintf (stderr, "  -quick-airmass              : use per-image airmass values\n");
     365  fprintf (stderr, "  -subpix                     : apply subpixel corrections\n");
    347366  fprintf (stderr, "  -skyprobe                   : specify skyprobe mode\n");
     367  fprintf (stderr, "  -2massquality               : define 2MASS quality flags to keep\n");
    348368  fprintf (stderr, "  -accept                     : accept bad astrometry from header\n");
    349369  fprintf (stderr, "  -accept-astrom              : accept bad astrometry from header\n");
    350370  fprintf (stderr, "  -accept-motion              : accept proper-motion data from reference\n");
     371  fprintf (stderr, "  -accept-time                : use TZERO supplied in header\n");
     372  fprintf (stderr, "  -no-stars                   : skip the stars\n");
    351373  fprintf (stderr, "  -force                      : force read of database with inconsistent info\n");
     374  fprintf (stderr, "  -textmode                   : force textmode for file (ignore header clues)\n");
    352375  fprintf (stderr, "  -v                          : verbose mode\n");
    353376  fprintf (stderr, "  -dump (mode)                : output test data. Currently supported values for mode are: 'rawdata', 'cal'.\n");
  • trunk/Ohana/src/addstar/src/dump.c

    r3404 r21508  
    1111    fprintf (f, "%4d  %10.6f %10.6f  %8.2f %8.2f  %7.2f %7.2f\n",
    1212             i,
    13              stars[i].R, stars[i].D,
    14              stars[i].X, stars[i].Y,
    15              stars[i].M, stars[i].dM);
     13             stars[i].average.R, stars[i].average.D,
     14             stars[i].measure.Xccd, stars[i].measure.Yccd,
     15             stars[i].measure.M, stars[i].measure.dM);
    1616  }
    1717
  • trunk/Ohana/src/addstar/src/fakeimage.c

    r16983 r21508  
    129129    image[i+1].ccdnum = 0xff;
    130130
    131     image[i+1].Mcal = 0.0;
    132     image[i+1].Xm   = NAN_S_SHORT;
    133     image[i+1].code = 0;
     131    image[i+1].Mcal  = 0.0;
     132    image[i+1].Xm    = NAN_S_SHORT;
     133    image[i+1].flags = 0;
    134134
    135135    image[i+1].nstar = 0;
     
    189189  image[0].Mcal = 0.0;
    190190  image[0].Xm   = NAN_S_SHORT;
    191   image[0].code = 0;
     191  image[0].flags = 0;
    192192  image[0].nstar = 0;
    193193  image[0].Myyyy = 0;
  • trunk/Ohana/src/addstar/src/find_matches.c

    r20936 r21508  
    6262  strcpy (tcoords.ctype, "RA---ARC");
    6363
    64   /* build spatial index (RA sort) */
     64  /* build spatial index (RA sort) referencing input array sequence */
    6565  Nstars = 0;
    6666  for (i = 0; i < NstarsIn; i++) {
    67     status = RD_to_XY (&X1[Nstars], &Y1[Nstars], stars[i].R, stars[i].D, &tcoords);
     67    status = RD_to_XY (&X1[Nstars], &Y1[Nstars], stars[i].average.R, stars[i].average.D, &tcoords);
    6868    if (!status) continue;
    6969    N1[Nstars] = i;
     
    104104  /** find matched stars **/
    105105  for (i = j = 0; (i < Nstars) && (j < Nave); ) {
    106         if (!finite(X1[i]) || !finite(Y1[i])) {
     106    if (!finite(X1[i]) || !finite(Y1[i])) {
    107107      i++;
    108108      continue;
     
    147147
    148148      /** add measurements for this star **/
    149       /** dR,dD now represent arcsec **/
    150       catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N].R);
     149
     150      // set the new measurements
     151      catalog[0].measure[Nmeas]          = stars[N].measure;
     152
     153      // the following measure elements cannot be set until here:
     154      catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
     155      catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N].average.D);
     156      catalog[0].measure[Nmeas].dbFlags  = 0;
     157      catalog[0].measure[Nmeas].averef   = n; // this must be an absolute sequence number, if partial average is loaded
     158      catalog[0].measure[Nmeas].objID    = catalog[0].average[n].objID;
     159      catalog[0].measure[Nmeas].catID    = catalog[0].catID;
     160
     161      // rationalize dR:
    151162      if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) {
    152163          // average on high end of boundary, move star up
    153           stars[N].R += 360.0;
    154           catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].R);
     164          stars[N].average.R += 360.0;
     165          catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
    155166      }
    156167      if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) {
    157168          // average on low end of boundary, move star down
    158           stars[N].R -= 360.0;
    159           catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].R);
     169          stars[N].average.R -= 360.0;
     170          catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
    160171      }
    161172      if (fabs(catalog[0].measure[Nmeas].dR) > 10*RADIUS) {
    162173          fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n",
    163174                   catalog[0].average[n].R, catalog[0].average[n].D,
    164                    stars[N].R, stars[N].D,
     175                   stars[N].average.R, stars[N].average.D,
    165176                   X1[i], X2[J],
    166177                   Y1[i], Y2[J]);
    167178      }
    168       catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N].D);
    169 
    170       catalog[0].measure[Nmeas].Xccd     = stars[N].X;
    171       catalog[0].measure[Nmeas].Yccd     = stars[N].Y;
    172 
    173       catalog[0].measure[Nmeas].M        = stars[N].M;
    174       catalog[0].measure[Nmeas].dM       = stars[N].dM;  /* error in input files stored in thousandths of mag */
    175       catalog[0].measure[Nmeas].Mcal     = stars[N].Mcal;
    176       catalog[0].measure[Nmeas].t        = stars[N].t;
    177       catalog[0].measure[Nmeas].averef   = n;              /* this must be an absolute sequence number, if partial average is loaded */
    178       catalog[0].measure[Nmeas].photcode = stars[N].code;  /* photcode */
    179       catalog[0].measure[Nmeas].dophot   = stars[N].dophot; 
    180       catalog[0].measure[Nmeas].dbFlags  = 0;
    181       catalog[0].measure[Nmeas].dt       = stars[N].dt;
    182       catalog[0].measure[Nmeas].airmass  = stars[N].airmass;
    183 
    184       catalog[0].measure[Nmeas].photFlags = stars[N].flags;
    185       catalog[0].measure[Nmeas].qPSF      = stars[N].psfQual;
    186       catalog[0].measure[Nmeas].psfChisq  = stars[N].psfChisq;
    187       catalog[0].measure[Nmeas].crNsigma  = stars[N].crNsigma;
    188       catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma;
    189       catalog[0].measure[Nmeas].Sky       = stars[N].sky;
    190       catalog[0].measure[Nmeas].dSky      = stars[N].dsky;
    191 
    192       catalog[0].measure[Nmeas].stargal   = 0; // XXX not yet set
    193 
    194       catalog[0].measure[Nmeas].detID     = stars[N].detID;
    195       catalog[0].measure[Nmeas].imageID   = stars[N].imageID;
    196 
    197       catalog[0].measure[Nmeas].dXccd     = stars[N].dX;
    198       catalog[0].measure[Nmeas].dYccd     = stars[N].dY;
    199 
    200       catalog[0].measure[Nmeas].Map      = stars[N].Map;
    201       catalog[0].measure[Nmeas].FWx      = 100*stars[N].fx;
    202       catalog[0].measure[Nmeas].FWy      = 100*stars[N].fy;
    203       catalog[0].measure[Nmeas].theta    = (0xffff/360.0)*stars[N].df;
    204        
     179
    205180      /* adds the measurement to the calibration if appropriate color terms are found */
    206181      /* we call this before (optionally) setting the average magnitude to avoid auto-correlations */
     
    266241    N = N1[i];
    267242    if (stars[N].found >= 0) continue;
    268     if (!IN_REGION (stars[N].R, stars[N].D)) continue;
    269 
    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;
     243    if (!IN_REGION (stars[N].average.R, stars[N].average.D)) continue;
     244
     245    catalog[0].average[Nave].R             = stars[N].average.R;
     246    catalog[0].average[Nave].D             = stars[N].average.D;
     247    catalog[0].average[Nave].dR            = 0;
     248    catalog[0].average[Nave].dD            = 0;
     249
    273250    catalog[0].average[Nave].Nmeasure      = 1;
    274251    catalog[0].average[Nave].Nmissing      = 0;
     252    catalog[0].average[Nave].Nextend       = 0;
     253
    275254    catalog[0].average[Nave].measureOffset = Nmeas;
    276255    catalog[0].average[Nave].missingOffset = -1;
    277     catalog[0].average[Nave].code          = 0;
    278 
    279     catalog[0].average[Nave].dR        = 0;
    280     catalog[0].average[Nave].dD        = 0;
    281     catalog[0].average[Nave].uR        = 0;
    282     catalog[0].average[Nave].uD        = 0;
    283     catalog[0].average[Nave].duR       = 0;
    284     catalog[0].average[Nave].duD       = 0;
    285     catalog[0].average[Nave].P         = 0;
    286     catalog[0].average[Nave].dP        = 0;
    287 
    288     catalog[0].average[Nave].objID     = objID;
    289     catalog[0].average[Nave].catID     = catID;
     256    catalog[0].average[Nave].extendOffset  = -1;
     257
     258    catalog[0].average[Nave].uR            = 0;
     259    catalog[0].average[Nave].uD            = 0;
     260    catalog[0].average[Nave].duR           = 0;
     261    catalog[0].average[Nave].duD           = 0;
     262    catalog[0].average[Nave].P             = 0;
     263    catalog[0].average[Nave].dP            = 0;
     264
     265    catalog[0].average[Nave].Xp            = 0;
     266    catalog[0].average[Nave].ChiSq         = 0.0;
     267    catalog[0].average[Nave].Npos          = 0;
     268
     269    catalog[0].average[Nave].objID         = objID;
     270    catalog[0].average[Nave].catID         = catID;
     271    catalog[0].average[Nave].flags         = 0;
     272
    290273    objID ++;
    291274
    292275    for (j = 0; j < Nsecfilt; j++) {
    293       catalog[0].secfilt[Nave*Nsecfilt+j].M  = NAN;
    294       catalog[0].secfilt[Nave*Nsecfilt+j].dM = NAN;
    295       catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NAN_S_SHORT;
    296     }
    297 
    298     catalog[0].measure[Nmeas].Xccd     = stars[N].X;
    299     catalog[0].measure[Nmeas].Yccd     = stars[N].Y;
    300 
     276      catalog[0].secfilt[Nave*Nsecfilt+j].M     = NAN;
     277      catalog[0].secfilt[Nave*Nsecfilt+j].dM    = NAN;
     278      catalog[0].secfilt[Nave*Nsecfilt+j].Xm    = NAN_S_SHORT;
     279      catalog[0].secfilt[Nave*Nsecfilt+j].M_20  = NAN_S_SHORT;
     280      catalog[0].secfilt[Nave*Nsecfilt+j].M_80  = NAN_S_SHORT;
     281      catalog[0].secfilt[Nave*Nsecfilt+j].Ncode = 0;
     282      catalog[0].secfilt[Nave*Nsecfilt+j].Nused = 0;
     283    }
     284
     285    // supply the measurments from this detection
     286    catalog[0].measure[Nmeas]           = stars[N].measure;
     287
     288    // the following measure elements cannot be set until here:
    301289    catalog[0].measure[Nmeas].dR        = 0.0;
    302290    catalog[0].measure[Nmeas].dD        = 0.0;
    303     catalog[0].measure[Nmeas].M         = stars[N].M;
    304     catalog[0].measure[Nmeas].dM        = stars[N].dM;
    305     catalog[0].measure[Nmeas].Mcal      = stars[N].Mcal;
    306     catalog[0].measure[Nmeas].t         = stars[N].t;
    307     catalog[0].measure[Nmeas].averef    = Nave;           /* XXX EAM : must be absolute Nave if partial read */
    308     catalog[0].measure[Nmeas].photcode  = stars[N].code;  /* photcode */
    309     catalog[0].measure[Nmeas].dophot    = stars[N].dophot; 
    310291    catalog[0].measure[Nmeas].dbFlags   = 0;
    311     catalog[0].measure[Nmeas].dt        = stars[N].dt;
    312     catalog[0].measure[Nmeas].airmass   = stars[N].airmass;
    313 
    314     catalog[0].measure[Nmeas].photFlags = stars[N].flags;
    315     catalog[0].measure[Nmeas].qPSF      = stars[N].psfQual;
    316     catalog[0].measure[Nmeas].psfChisq  = stars[N].psfChisq;
    317     catalog[0].measure[Nmeas].crNsigma  = stars[N].crNsigma;
    318     catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma;
    319     catalog[0].measure[Nmeas].Sky       = stars[N].sky;
    320     catalog[0].measure[Nmeas].dSky      = stars[N].dsky;
    321 
    322     catalog[0].measure[Nmeas].stargal   = 0; // XXX not yet set
    323 
    324     catalog[0].measure[Nmeas].detID     = stars[N].detID;
    325     catalog[0].measure[Nmeas].imageID   = stars[N].imageID;
    326 
    327     catalog[0].measure[Nmeas].dXccd     = stars[N].dX;
    328     catalog[0].measure[Nmeas].dYccd     = stars[N].dY;
    329 
    330     catalog[0].measure[Nmeas].Map       = stars[N].Map;
    331     catalog[0].measure[Nmeas].FWx       = 100*stars[N].fx;
    332     catalog[0].measure[Nmeas].FWy       = 100*stars[N].fy;
    333     catalog[0].measure[Nmeas].theta     = (0xffff/360.0)*stars[N].df;
    334     /* XXX replace df here with theta, right? */
     292    catalog[0].measure[Nmeas].averef    = Nave; // XXX EAM : must be absolute Nave if partial read
     293    catalog[0].measure[Nmeas].objID     = catalog[0].average[Nave].objID;
     294    catalog[0].measure[Nmeas].catID     = catalog[0].catID;
    335295
    336296    /* set the average magnitude if not already set and the photcode.equiv is not 0 */
  • trunk/Ohana/src/addstar/src/find_matches_closest.c

    r20936 r21508  
    77  double *X1, *Y1, *X2, *Y2;
    88  double dX, dY, dR;
    9   int *N1, *N2,  *next_meas, *next_miss;
    10   int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch;
     9  int *N1, *N2,  *next_meas;
     10  int Nave, NAVE, Nmeas, NMEAS, Nmatch;
    1111  int Nsecfilt, Nsec;
    1212  unsigned int objID, catID;
     
    3737  Nmatch = 0;
    3838  NMEAS = Nmeas = catalog[0].Nmeasure;
    39   NMISS = Nmiss = catalog[0].Nmissing;
    4039
    4140  // current max obj ID for this catalog
     
    6665  Nstars = 0;
    6766  for (i = 0; i < NstarsIn; i++) {
    68     status = RD_to_XY (&X1[Nstars], &Y1[Nstars], stars[i].R, stars[i].D, &tcoords);
     67    status = RD_to_XY (&X1[Nstars], &Y1[Nstars], stars[i].average.R, stars[i].average.D, &tcoords);
    6968    if (!status) continue;
    7069    N1[Nstars] = i;
     
    9291  if (Nave > 1) sort_coords_index (X2, Y2, N2, Nave);
    9392
    94   /* set up pointers for linked list of measure, missing */
     93  /* set up pointers for linked list of measure */
    9594  if (catalog[0].sorted && (catalog[0].Nmeasure == catalog[0].Nmeas_disk)) {
    9695    // this version is only valid if we have done a full catalog load, and if the catalog
     
    10099    next_meas = build_measure_links (catalog[0].average, Nave, catalog[0].measure, Nmeas);
    101100  }   
    102   next_miss = init_missing_links (catalog[0].average, Nave, catalog[0].missing, Nmiss);
    103   /* missing MUST be written 'sorted', or not at all */
    104101
    105102  /* choose a radius for matches */
     
    167164       
    168165    /** add measurements for this star **/
     166
     167    // set the new measurements
     168    catalog[0].measure[Nmeas]          = stars[N].measure;
     169
    169170    /** dR,dD now represent arcsec **/
    170     catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N].R);
     171    catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
     172    catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N].average.D);
     173    catalog[0].measure[Nmeas].dbFlags  = 0;
     174    catalog[0].measure[Nmeas].averef   = n;
     175    catalog[0].measure[Nmeas].objID    = catalog[0].average[n].objID;
     176    catalog[0].measure[Nmeas].catID    = catalog[0].catID;
     177
     178    // rationalize dR
    171179    if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) {
    172180      // average on high end of boundary, move star up
    173       stars[N].R += 360.0;
    174       catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].R);
     181      stars[N].average.R += 360.0;
     182      catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
    175183    }
    176184    if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) {
    177185      // average on low end of boundary, move star down
    178       stars[N].R -= 360.0;
    179       catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].R);
     186      stars[N].average.R -= 360.0;
     187      catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].average.R);
    180188    }
    181189    if (fabs(catalog[0].measure[Nmeas].dR) > 10*RADIUS) {
    182190      fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n",
    183191               catalog[0].average[n].R, catalog[0].average[n].D,
    184                stars[N].R, stars[N].D,
     192               stars[N].average.R, stars[N].average.D,
    185193               X1[i], X2[Jmin],
    186194               Y1[i], Y2[Jmin]);
    187195    }
    188     catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N].D);
    189 
    190     /* XXX need to add dX, dY : need to load into stars[N].dX,dY */
    191     /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */
    192     catalog[0].measure[Nmeas].Xccd     = stars[N].X;
    193     catalog[0].measure[Nmeas].Yccd     = stars[N].Y;
    194 
    195     catalog[0].measure[Nmeas].M        = stars[N].M;
    196     catalog[0].measure[Nmeas].dM       = stars[N].dM;  /* error in input files stored in thousandths of mag */
    197     catalog[0].measure[Nmeas].Mcal     = stars[N].Mcal;
    198     catalog[0].measure[Nmeas].t        = stars[N].t;
    199     catalog[0].measure[Nmeas].averef   = n;
    200     catalog[0].measure[Nmeas].photcode = stars[N].code;  /* photcode */
    201     catalog[0].measure[Nmeas].dophot   = stars[N].dophot; 
    202     catalog[0].measure[Nmeas].dbFlags  = 0;
    203     catalog[0].measure[Nmeas].dt       = stars[N].dt;
    204     catalog[0].measure[Nmeas].airmass  = stars[N].airmass;
    205 
    206     catalog[0].measure[Nmeas].photFlags = stars[N].flags;
    207     catalog[0].measure[Nmeas].qPSF      = stars[N].psfQual;
    208     catalog[0].measure[Nmeas].psfChisq  = stars[N].psfChisq;
    209     catalog[0].measure[Nmeas].crNsigma  = stars[N].crNsigma;
    210     catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma;
    211     catalog[0].measure[Nmeas].Sky       = stars[N].sky;
    212     catalog[0].measure[Nmeas].dSky      = stars[N].dsky;
    213 
    214     catalog[0].measure[Nmeas].stargal   = 0;
    215 
    216     catalog[0].measure[Nmeas].detID     = stars[N].detID;
    217     catalog[0].measure[Nmeas].imageID   = stars[N].imageID;
    218 
    219     catalog[0].measure[Nmeas].dXccd     = stars[N].dX;
    220     catalog[0].measure[Nmeas].dYccd     = stars[N].dY;
    221 
    222     catalog[0].measure[Nmeas].Map       = stars[N].Map;
    223 
    224     // XXX saturate range for FWx, FWy, theta
    225     // XXX convert to unsigned int for these...
    226     catalog[0].measure[Nmeas].FWx      = 100*stars[N].fx;
    227     catalog[0].measure[Nmeas].FWy      = 100*stars[N].fy;
    228     catalog[0].measure[Nmeas].theta    = (0xffff/360.0)*stars[N].df;
    229        
     196
     197
     198    /* adds the measurement to the calibration if appropriate color terms are found */
     199    /* we call this before (optionally) setting the average magnitude to avoid auto-correlations */
     200    if (options.calibrate) {
     201      AddToCalibration (&catalog[0].average[n], &catalog[0].secfilt[n*Nsecfilt], catalog[0].measure, &catalog[0].measure[Nmeas], next_meas, N);
     202    }
     203
    230204    /* set the average magnitude if not already set and the photcode.equiv is not 0 */
    231205    /* in UPDATE mode, this value is not saved; use relphot to recalculate */
     
    234208        catalog[0].secfilt[n*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);
    235209      }
    236     }
    237 
    238     /* adds the measurement to the calibration if appropriate color terms are found */
    239     if (options.calibrate) {
    240       AddToCalibration (&catalog[0].average[n], &catalog[0].secfilt[n*Nsecfilt], catalog[0].measure, &catalog[0].measure[Nmeas], next_meas, N);
    241210    }
    242211
     
    270239    N = N1[i];
    271240    if (stars[N].found >= 0) continue;
    272     if (!IN_REGION (stars[N].R, stars[N].D)) continue;
    273 
    274     catalog[0].average[Nave].R             = stars[N].R;
    275     catalog[0].average[Nave].D             = stars[N].D;
    276     catalog[0].average[Nave].Xp            = 0;
     241    if (!IN_REGION (stars[N].average.R, stars[N].average.D)) continue;
     242
     243    catalog[0].average[Nave].R             = stars[N].average.R;
     244    catalog[0].average[Nave].D             = stars[N].average.D;
     245    catalog[0].average[Nave].dR            = 0;
     246    catalog[0].average[Nave].dD            = 0;
     247
    277248    catalog[0].average[Nave].Nmeasure      = 1;
    278249    catalog[0].average[Nave].Nmissing      = 0;
     250    catalog[0].average[Nave].Nextend       = 0;
     251
    279252    catalog[0].average[Nave].measureOffset = Nmeas;
    280253    catalog[0].average[Nave].missingOffset = -1;
    281     catalog[0].average[Nave].code          = 0;
    282 
    283     catalog[0].average[Nave].dR        = 0;
    284     catalog[0].average[Nave].dD        = 0;
    285     catalog[0].average[Nave].uR        = 0;
    286     catalog[0].average[Nave].uD        = 0;
    287     catalog[0].average[Nave].duR       = 0;
    288     catalog[0].average[Nave].duD       = 0;
    289     catalog[0].average[Nave].P         = 0;
    290     catalog[0].average[Nave].dP        = 0;
    291 
    292     catalog[0].average[Nave].objID     = objID;
    293     catalog[0].average[Nave].catID     = catID;
     254    catalog[0].average[Nave].extendOffset  = -1;
     255
     256    catalog[0].average[Nave].uR            = 0;
     257    catalog[0].average[Nave].uD            = 0;
     258    catalog[0].average[Nave].duR           = 0;
     259    catalog[0].average[Nave].duD           = 0;
     260    catalog[0].average[Nave].P             = 0;
     261    catalog[0].average[Nave].dP            = 0;
     262
     263    catalog[0].average[Nave].Xp            = 0;
     264    catalog[0].average[Nave].ChiSq         = 0.0;
     265    catalog[0].average[Nave].Npos          = 0;
     266
     267    catalog[0].average[Nave].objID         = objID;
     268    catalog[0].average[Nave].catID         = catID;
     269    catalog[0].average[Nave].flags         = 0;
     270
    294271    objID ++;
    295272
     
    298275      catalog[0].secfilt[Nave*Nsecfilt+j].dM = NAN;
    299276      catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NAN_S_SHORT;
    300     }
    301 
    302     catalog[0].measure[Nmeas].Xccd     = stars[N].X;
    303     catalog[0].measure[Nmeas].Yccd     = stars[N].Y;
    304 
     277      catalog[0].secfilt[Nave*Nsecfilt+j].M_20  = NAN_S_SHORT;
     278      catalog[0].secfilt[Nave*Nsecfilt+j].M_80  = NAN_S_SHORT;
     279      catalog[0].secfilt[Nave*Nsecfilt+j].Ncode = 0;
     280      catalog[0].secfilt[Nave*Nsecfilt+j].Nused = 0;
     281    }
     282
     283    // supply the measurments from this detection
     284    catalog[0].measure[Nmeas]           = stars[N].measure;
     285
     286    // the following measure elements cannot be set until here:
    305287    catalog[0].measure[Nmeas].dR       = 0.0;
    306288    catalog[0].measure[Nmeas].dD       = 0.0;
    307     catalog[0].measure[Nmeas].M        = stars[N].M;
    308     catalog[0].measure[Nmeas].dM       = stars[N].dM;
    309     catalog[0].measure[Nmeas].Mcal     = stars[N].Mcal;
    310     catalog[0].measure[Nmeas].t        = stars[N].t;
     289    catalog[0].measure[Nmeas].dbFlags  = 0;
    311290    catalog[0].measure[Nmeas].averef   = Nave;
    312     catalog[0].measure[Nmeas].photcode = stars[N].code;  /* photcode */
    313     catalog[0].measure[Nmeas].dophot   = stars[N].dophot; 
    314     catalog[0].measure[Nmeas].dbFlags  = 0;
    315     catalog[0].measure[Nmeas].dt       = stars[N].dt;
    316     catalog[0].measure[Nmeas].airmass  = stars[N].airmass;
    317 
    318     catalog[0].measure[Nmeas].photFlags = stars[N].flags;
    319     catalog[0].measure[Nmeas].qPSF      = stars[N].psfQual;
    320     catalog[0].measure[Nmeas].psfChisq  = stars[N].psfChisq;
    321     catalog[0].measure[Nmeas].crNsigma  = stars[N].crNsigma;
    322     catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma;
    323     catalog[0].measure[Nmeas].Sky       = stars[N].sky;
    324     catalog[0].measure[Nmeas].dSky      = stars[N].dsky;
    325 
    326     catalog[0].measure[Nmeas].stargal   = 0;
    327 
    328     catalog[0].measure[Nmeas].detID     = stars[N].detID;
    329     catalog[0].measure[Nmeas].imageID   = stars[N].imageID;
    330 
    331     catalog[0].measure[Nmeas].dXccd     = stars[N].dX;
    332     catalog[0].measure[Nmeas].dYccd     = stars[N].dY;
    333 
    334     catalog[0].measure[Nmeas].Map      = stars[N].Map;
    335     catalog[0].measure[Nmeas].FWx      = 100*stars[N].fx;
    336     catalog[0].measure[Nmeas].FWy      = 100*stars[N].fy;
    337     catalog[0].measure[Nmeas].theta    = (0xffff/360.0)*stars[N].df;
     291    catalog[0].measure[Nmeas].objID    = catalog[0].average[Nave].objID;
     292    catalog[0].measure[Nmeas].catID    = catalog[0].catID;
    338293
    339294    /* set the average magnitude if not already set and the photcode.equiv is not 0 */
  • trunk/Ohana/src/addstar/src/find_matches_refstars.c

    r18374 r21508  
    6969 
    7070  for (i = 0; i < Nstars; i++) {
    71     RD_to_XY (&X1[i], &Y1[i], stars[i][0].R, stars[i][0].D, &tcoords);
     71    RD_to_XY (&X1[i], &Y1[i], stars[i][0].average.R, stars[i][0].average.D, &tcoords);
    7272    N1[i] = i;
    7373  }
     
    134134      /* find last measurement of this star */
    135135      for (k = 0; k < catalog[0].average[n].Nmeasure - 1; k++) m = next[m];
     136
    136137      /* set up references */
    137138      next[Nmeas] = next[m];
    138139      next[m] = Nmeas;
     140
    139141      /* last just was moved */
    140142      if (next[Nmeas] == -1) last = Nmeas;
    141143       
    142144      /** add measurements for this star **/
     145
     146      // set the new measurements
     147      catalog[0].measure[Nmeas]          = stars[N][0].measure;
     148
    143149      /** *** dR,dD now in arcsec *** **/
    144       catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N][0].R);
    145       catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N][0].D);
    146       catalog[0].measure[Nmeas].M        = stars[N][0].M;
    147       catalog[0].measure[Nmeas].dM       = stars[N][0].dM;
    148       catalog[0].measure[Nmeas].Mcal     = 0;
    149       catalog[0].measure[Nmeas].t        = (TIMEREF == 0) ? stars[N][0].t : TIMEREF; /** careful : time_t vs e_time **/
     150      catalog[0].measure[Nmeas].dR       = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
     151      catalog[0].measure[Nmeas].dD       = 3600.0*(catalog[0].average[n].D - stars[N][0].average.D);
     152
     153      // rationalize dR:
     154      if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) {
     155          // average on high end of boundary, move star up
     156          stars[N][0].average.R += 360.0;
     157          catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
     158      }
     159      if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) {
     160          // average on low end of boundary, move star down
     161          stars[N][0].average.R -= 360.0;
     162          catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N][0].average.R);
     163      }
     164
    150165      catalog[0].measure[Nmeas].averef   = n;
    151       catalog[0].measure[Nmeas].photcode = stars[N][0].code;
    152       catalog[0].measure[Nmeas].dophot   = 0;
    153166      catalog[0].measure[Nmeas].dbFlags  = 0;
    154       catalog[0].measure[Nmeas].dt       = 0xffff;
    155 
    156       catalog[0].measure[Nmeas].Map      = NAN;
    157       catalog[0].measure[Nmeas].airmass  = 0;
    158       catalog[0].measure[Nmeas].FWx      = stars[N][0].fx; // XXX make sure these are zero'ed as needed
    159       catalog[0].measure[Nmeas].FWy      = stars[N][0].fy; // XXX make sure these are zero'ed as needed
    160       catalog[0].measure[Nmeas].theta    = stars[N][0].df; // XXX make sure these are zero'ed as needed
    161        
    162       catalog[0].measure[Nmeas].photFlags = stars[N][0].flags; // XXX make sure these are zero'ed as needed
    163       catalog[0].measure[Nmeas].qPSF      = 0;
    164       catalog[0].measure[Nmeas].psfChisq  = 0;
    165       catalog[0].measure[Nmeas].crNsigma  = 0;
    166       catalog[0].measure[Nmeas].extNsigma = 0;
    167       catalog[0].measure[Nmeas].Sky       = 0;
    168       catalog[0].measure[Nmeas].dSky      = 0;
    169 
    170       catalog[0].measure[Nmeas].stargal   = 0; // XXX not yet set
    171 
    172       catalog[0].measure[Nmeas].detID     = 0;
    173       catalog[0].measure[Nmeas].imageID   = 0;
    174 
    175       catalog[0].measure[Nmeas].dXccd     = 0;
    176       catalog[0].measure[Nmeas].dYccd     = 0;
    177 
    178       catalog[0].measure[Nmeas].Xccd     = stars[N][0].X; // XXX make sure these are zero'ed as needed
    179       catalog[0].measure[Nmeas].Yccd     = stars[N][0].Y; // XXX make sure these are zero'ed as needed
     167      catalog[0].measure[Nmeas].objID    = catalog[0].average[n].objID;
     168      catalog[0].measure[Nmeas].catID    = catalog[0].catID;
     169
     170      catalog[0].measure[Nmeas].t        = (TIMEREF == 0) ? stars[N][0].measure.t      : TIMEREF; /** careful : time_t vs e_time **/
     171      catalog[0].measure[Nmeas].t_msec   = (TIMEREF == 0) ? stars[N][0].measure.t_msec : TIMEREF; /** careful : time_t vs e_time **/
    180172
    181173      if (ACCEPT_MOTION) {
    182         catalog[0].average[n].uR         = stars[N][0].uR;
    183         catalog[0].average[n].uD         = stars[N][0].uD;
    184         catalog[0].average[n].duR        = stars[N][0].duR;
    185         catalog[0].average[n].duD        = stars[N][0].duD;
    186         catalog[0].average[n].P          = stars[N][0].P;
    187         catalog[0].average[n].dP         = stars[N][0].dP;
     174        catalog[0].average[n].uR         = stars[N][0].average.uR;
     175        catalog[0].average[n].uD         = stars[N][0].average.uD;
     176        catalog[0].average[n].duR        = stars[N][0].average.duR;
     177        catalog[0].average[n].duD        = stars[N][0].average.duD;
     178        catalog[0].average[n].P          = stars[N][0].average.P;
     179        catalog[0].average[n].dP         = stars[N][0].average.dP;
    188180      }
    189181
     
    233225  for (i = 0; (i < Nstars) && !options.only_match; i+=NREFSTAR_GROUP) {
    234226    N = N1[i];
    235     if (stars[N][0].found >= 0) continue;
    236 
    237     catalog[0].average[Nave].R             = stars[N][0].R;
    238     catalog[0].average[Nave].D             = stars[N][0].D;
    239     catalog[0].average[Nave].Xp            = 0;
     227    if (stars[N][0].found > -1) continue;
     228
     229    catalog[0].average[Nave].R             = stars[N][0].average.R;
     230    catalog[0].average[Nave].D             = stars[N][0].average.D;
     231
    240232    catalog[0].average[Nave].Nmeasure      = NREFSTAR_GROUP;
    241233    catalog[0].average[Nave].Nmissing      = 0;
     234    catalog[0].average[Nave].Nextend       = 0;
     235
    242236    catalog[0].average[Nave].measureOffset = Nmeas;
    243237    catalog[0].average[Nave].missingOffset = -1;
    244     catalog[0].average[Nave].code          = 0;
     238    catalog[0].average[Nave].extendOffset  = -1;
    245239
    246240    if (ACCEPT_MOTION) {
    247       catalog[0].average[Nave].dR    = stars[N][0].dR;
    248       catalog[0].average[Nave].dD    = stars[N][0].dD;
    249       catalog[0].average[Nave].uR    = stars[N][0].uR;
    250       catalog[0].average[Nave].uD    = stars[N][0].uD;
    251       catalog[0].average[Nave].duR   = stars[N][0].duR;
    252       catalog[0].average[Nave].duD   = stars[N][0].duD;
    253       catalog[0].average[Nave].P     = stars[N][0].P;
    254       catalog[0].average[Nave].dP    = stars[N][0].dP;
     241      catalog[0].average[Nave].dR          = stars[N][0].average.dR;
     242      catalog[0].average[Nave].dD          = stars[N][0].average.dD;
     243      catalog[0].average[Nave].uR          = stars[N][0].average.uR;
     244      catalog[0].average[Nave].uD          = stars[N][0].average.uD;
     245      catalog[0].average[Nave].duR         = stars[N][0].average.duR;
     246      catalog[0].average[Nave].duD         = stars[N][0].average.duD;
     247      catalog[0].average[Nave].P           = stars[N][0].average.P;
     248      catalog[0].average[Nave].dP          = stars[N][0].average.dP;
    255249    } else {
    256       catalog[0].average[Nave].dR    = 0;
    257       catalog[0].average[Nave].dD    = 0;
    258       catalog[0].average[Nave].uR    = 0;
    259       catalog[0].average[Nave].uD    = 0;
    260       catalog[0].average[Nave].duR   = 0;
    261       catalog[0].average[Nave].duD   = 0;
    262       catalog[0].average[Nave].P     = 0;
    263       catalog[0].average[Nave].dP    = 0;
    264     }
    265 
    266     catalog[0].average[Nave].objID     = objID;
    267     catalog[0].average[Nave].catID     = catID;
     250      catalog[0].average[Nave].dR          = 0;
     251      catalog[0].average[Nave].dD          = 0;
     252      catalog[0].average[Nave].uR          = 0;
     253      catalog[0].average[Nave].uD          = 0;
     254      catalog[0].average[Nave].duR         = 0;
     255      catalog[0].average[Nave].duD         = 0;
     256      catalog[0].average[Nave].P           = 0;
     257      catalog[0].average[Nave].dP          = 0;
     258      catalog[0].average[Nave].Xp          = 0;
     259    }
     260
     261    catalog[0].average[Nave].Xp            = 0;
     262    catalog[0].average[Nave].ChiSq         = 0.0;
     263    catalog[0].average[Nave].Npos          = 0;
     264
     265    catalog[0].average[Nave].objID         = objID;
     266    catalog[0].average[Nave].catID         = catID;
     267    catalog[0].average[Nave].flags         = 0;
     268
    268269    objID ++;
    269270
    270271    for (j = 0; j < Nsecfilt; j++) {
    271       catalog[0].secfilt[Nave*Nsecfilt+j].M  = NAN;
    272       catalog[0].secfilt[Nave*Nsecfilt+j].dM = NAN;
    273       catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NAN_S_SHORT;
     272      catalog[0].secfilt[Nave*Nsecfilt+j].M     = NAN;
     273      catalog[0].secfilt[Nave*Nsecfilt+j].dM    = NAN;
     274      catalog[0].secfilt[Nave*Nsecfilt+j].Xm    = NAN_S_SHORT;
     275      catalog[0].secfilt[Nave*Nsecfilt+j].M_20  = NAN_S_SHORT;
     276      catalog[0].secfilt[Nave*Nsecfilt+j].M_80  = NAN_S_SHORT;
     277      catalog[0].secfilt[Nave*Nsecfilt+j].Ncode = 0;
     278      catalog[0].secfilt[Nave*Nsecfilt+j].Nused = 0;
    274279    }
    275280
    276281    for (j = 0; j < NREFSTAR_GROUP; j++) {
    277282      N = N1[i + j];
     283
     284      catalog[0].measure[Nmeas]          = stars[N][0].measure;
     285
    278286      catalog[0].measure[Nmeas].dR       = 0.0;
    279287      catalog[0].measure[Nmeas].dD       = 0.0;
    280       catalog[0].measure[Nmeas].M        = stars[N][0].M;
    281       catalog[0].measure[Nmeas].dM       = stars[N][0].dM;
    282       catalog[0].measure[Nmeas].Mcal     = 0;
    283       catalog[0].measure[Nmeas].t        = (stars[N][0].t == 0) ? TIMEREF : stars[N][0].t; /** careful : time_t vs e_time **/
     288
     289      catalog[0].measure[Nmeas].t        = (stars[N][0].measure.t == 0) ? TIMEREF : stars[N][0].measure.t;      /** careful : time_t vs e_time **/
     290      catalog[0].measure[Nmeas].t_msec   = (stars[N][0].measure.t == 0) ?       0 : stars[N][0].measure.t_msec; /** careful : time_t vs e_time **/
     291      catalog[0].measure[Nmeas].dbFlags  = 0;
    284292      catalog[0].measure[Nmeas].averef   = Nave;
    285       catalog[0].measure[Nmeas].photcode = stars[N][0].code;
    286       catalog[0].measure[Nmeas].dophot   = 0;
    287       catalog[0].measure[Nmeas].dbFlags  = 0;
    288       catalog[0].measure[Nmeas].dt       = 0xffff;
    289 
    290       catalog[0].measure[Nmeas].photFlags = stars[N][0].flags; // XXX make sure these are zero'ed as needed
    291       catalog[0].measure[Nmeas].qPSF      = 0;
    292       catalog[0].measure[Nmeas].psfChisq  = 0;
    293       catalog[0].measure[Nmeas].crNsigma  = 0;
    294       catalog[0].measure[Nmeas].extNsigma = 0;
    295       catalog[0].measure[Nmeas].Sky       = 0;
    296       catalog[0].measure[Nmeas].dSky      = 0;
    297 
    298       catalog[0].measure[Nmeas].stargal   = 0; // XXX not yet set
    299 
    300       catalog[0].measure[Nmeas].detID     = 0;
    301       catalog[0].measure[Nmeas].imageID   = 0;
    302 
    303       catalog[0].measure[Nmeas].dXccd     = 0;
    304       catalog[0].measure[Nmeas].dYccd     = 0;
    305 
    306       catalog[0].measure[Nmeas].Xccd     = stars[N][0].X; // XXX make sure these are zero'ed as needed
    307       catalog[0].measure[Nmeas].Yccd     = stars[N][0].Y; // XXX make sure these are zero'ed as needed
    308 
    309       catalog[0].measure[Nmeas].airmass  = 0;
    310       catalog[0].measure[Nmeas].Map      = NAN;
    311       catalog[0].measure[Nmeas].FWx      = stars[N][0].fx; // XXX make sure these are zero'ed as needed
    312       catalog[0].measure[Nmeas].FWy      = stars[N][0].fy; // XXX make sure these are zero'ed as needed
    313       catalog[0].measure[Nmeas].theta    = stars[N][0].df; // XXX make sure these are zero'ed as needed
    314 
    315       catalog[0].measure[Nmeas].Xccd     = 0.0;
    316       catalog[0].measure[Nmeas].Yccd     = 0.0;
     293      catalog[0].measure[Nmeas].objID    = catalog[0].average[Nave].objID;
     294      catalog[0].measure[Nmeas].catID    = catalog[0].catID;
    317295
    318296      stars[N][0].found = Nmeas;
  • trunk/Ohana/src/addstar/src/find_subset.c

    r5443 r21508  
    2020  /* find stars within ra,dec region */
    2121  for (i = N = 0; i < Nstars; i++) {
    22     if (stars[i].R <  RA0)  continue;
    23     if (stars[i].R >= RA1)  continue;
    24     if (stars[i].D <  DEC0) continue;
    25     if (stars[i].D >= DEC1) continue;
     22    if (stars[i].average.R <  RA0)  continue;
     23    if (stars[i].average.R >= RA1)  continue;
     24    if (stars[i].average.D <  DEC0) continue;
     25    if (stars[i].average.D >= DEC1) continue;
    2626
    2727    subset[N] = &stars[i];
  • trunk/Ohana/src/addstar/src/get2mass_dr2.c

    r16810 r21508  
    6868        dparse (&J,  1, &buffer[NBYTE*i + 53]);
    6969        dparse (&dJ, 2, &buffer[NBYTE*i + 53]);
    70         stars[Nstars].M    = J;
    71         stars[Nstars].dM   = dJ;
    72         stars[Nstars].code = TM_J;
     70        stars[Nstars].M        = J;
     71        stars[Nstars].dM       = dJ;
     72        stars[Nstars].photcode = TM_J;
    7373      }
    7474      if (photcode == TM_H) {
    7575        dparse (&H,  1, &buffer[NBYTE*i + 72]);
    7676        dparse (&dH, 2, &buffer[NBYTE*i + 72]);
    77         stars[Nstars].M    = H;
    78         stars[Nstars].dM   = dH;
    79         stars[Nstars].code = TM_H;
     77        stars[Nstars].M        = H;
     78        stars[Nstars].dM       = dH;
     79        stars[Nstars].photcode = TM_H;
    8080      }
    8181      if (photcode == TM_K) {
    8282        dparse (&K,  1, &buffer[NBYTE*i + 91]);
    8383        dparse (&dK, 2, &buffer[NBYTE*i + 91]);
    84         stars[Nstars].M    = K;
    85         stars[Nstars].dM   = dK;
    86         stars[Nstars].code = TM_K;
     84        stars[Nstars].M        = K;
     85        stars[Nstars].dM       = dK;
     86        stars[Nstars].photcode = TM_K;
    8787      }
    8888      Nstars ++;
  • trunk/Ohana/src/addstar/src/get2mass_full.c

    r17439 r21508  
    1515  ptr = next2MASSfield (ptr); // dec (assumed to be already set)
    1616  ptr = next2MASSfield (ptr); // err_maj
    17   star[0][0].fx = strtod (ptr, NULL);
     17  star[0][0].measure.FWx = ShortPixels(strtod (ptr, NULL));
    1818  ptr = next2MASSfield (ptr); // err_min
    19   star[0][0].fy = strtod (ptr, NULL);
     19  star[0][0].measure.FWy = ShortPixels(strtod (ptr, NULL));
    2020  ptr = next2MASSfield (ptr); // err_ang
    21   star[0][0].df = strtod (ptr, NULL);
    22 
    23   star[2][0].fx = star[2][0].fx = star[0][0].fx;
    24   star[2][0].fy = star[2][0].fy = star[0][0].fy;
    25   star[2][0].df = star[2][0].df = star[0][0].df;
     21  star[0][0].measure.theta = ShortPixels(strtod (ptr, NULL));
     22
     23  star[2][0].measure.FWx   = star[2][0].measure.FWx   = star[0][0].measure.FWx;
     24  star[2][0].measure.FWy   = star[2][0].measure.FWy   = star[0][0].measure.FWy;
     25  star[2][0].measure.theta = star[2][0].measure.theta = star[0][0].measure.theta;
    2626
    2727  ptr = next2MASSfield (ptr); // designation (skip)
    2828
    2929  ptr = next2MASSfield (ptr); // j_m
    30   star[0][0].M  = strtod (ptr, NULL);
     30  star[0][0].measure.M  = strtod (ptr, NULL);
    3131  ptr = next2MASSfield (ptr); // j_cmsig
    32   star[0][0].dM = strtod (ptr, NULL);
     32  star[0][0].measure.dM = strtod (ptr, NULL);
    3333  ptr = next2MASSfield (ptr); // j_msigcom
    3434  dMfull = strtod (ptr, NULL);
    35   star[0][0].dMcal = sqrt (SQ(dMfull) - SQ(star[0][0].dM));
     35  star[0][0].measure.dMcal = sqrt (SQ(dMfull) - SQ(star[0][0].measure.dM));
    3636  ptr = next2MASSfield (ptr); // j_snr (skip)
    3737
    3838  ptr = next2MASSfield (ptr); // h_m
    39   star[1][0].M  = strtod (ptr, NULL);
     39  star[1][0].measure.M  = strtod (ptr, NULL);
    4040  ptr = next2MASSfield (ptr); // h_cmsig
    41   star[1][0].dM = strtod (ptr, NULL);
     41  star[1][0].measure.dM = strtod (ptr, NULL);
    4242  ptr = next2MASSfield (ptr); // h_msigcom
    4343  dMfull = strtod (ptr, NULL);
    44   star[1][0].dMcal = sqrt (SQ(dMfull) - SQ(star[1][0].dM));
     44  star[1][0].measure.dMcal = sqrt (SQ(dMfull) - SQ(star[1][0].measure.dM));
    4545  ptr = next2MASSfield (ptr); // h_snr (skip)
    4646
    4747  ptr = next2MASSfield (ptr); // k_m
    48   star[2][0].M  = strtod (ptr, NULL);
     48  star[2][0].measure.M  = strtod (ptr, NULL);
    4949  ptr = next2MASSfield (ptr); // k_cmsig
    50   star[2][0].dM = strtod (ptr, NULL);
     50  star[2][0].measure.dM = strtod (ptr, NULL);
    5151  ptr = next2MASSfield (ptr); // k_msigcom
    5252  dMfull = strtod (ptr, NULL);
    53   star[2][0].dMcal = sqrt (SQ(dMfull) - SQ(star[2][0].dM));
     53  star[2][0].measure.dMcal = sqrt (SQ(dMfull) - SQ(star[2][0].measure.dM));
    5454  ptr = next2MASSfield (ptr); // k_snr (skip)
    5555
    56   star[2][0].flags = star[1][0].flags = star[0][0].flags = 0;
     56  star[2][0].measure.photFlags = star[1][0].measure.photFlags = star[0][0].measure.photFlags = 0;
    5757
    5858  ptr = next2MASSfield (ptr); // ph_qual
     
    9999
    100100  ptr = next2MASSfield (ptr); // x_scan
    101   star[0][0].X = strtod (ptr, NULL);
    102   star[2][0].X = star[1][0].X = star[0][0].X;
     101  star[0][0].measure.Xccd = strtod (ptr, NULL);
     102  star[2][0].measure.Xccd = star[1][0].measure.Xccd = star[0][0].measure.Xccd;
    103103
    104104  ptr = next2MASSfield (ptr); // jdate (julian date)
    105105  jd = strtod (ptr, NULL);
    106   star[0][0].t = ohana_jd_to_sec (jd);
    107   star[2][0].t = star[1][0].t = star[0][0].t;
     106  star[0][0].measure.t = ohana_jd_to_sec (jd);
     107  star[2][0].measure.t = star[1][0].measure.t = star[0][0].measure.t;
    108108
    109109  ptr = next2MASSfield (ptr); // j_psfchi
    110   star[0][0].psfChisq = strtod (ptr, NULL);
     110  star[0][0].measure.psfChisq = strtod (ptr, NULL);
    111111  ptr = next2MASSfield (ptr); // h_psfchi
    112   star[1][0].psfChisq = strtod (ptr, NULL);
     112  star[1][0].measure.psfChisq = strtod (ptr, NULL);
    113113  ptr = next2MASSfield (ptr); // k_psfchi
    114   star[2][0].psfChisq = strtod (ptr, NULL);
     114  star[2][0].measure.psfChisq = strtod (ptr, NULL);
    115115
    116116  ptr = next2MASSfield (ptr); // j_m_stdap
    117   star[0][0].Map = strtod (ptr, NULL);
     117  star[0][0].measure.Map = strtod (ptr, NULL);
    118118  ptr = next2MASSfield (ptr); // j_msig_stdap (skip?)
    119119
    120120  ptr = next2MASSfield (ptr); // h_m_stdap
    121   star[1][0].Map = strtod (ptr, NULL);
     121  star[1][0].measure.Map = strtod (ptr, NULL);
    122122  ptr = next2MASSfield (ptr); // h_msig_stdap (skip?)
    123123
    124124  ptr = next2MASSfield (ptr); // k_m_stdap
    125   star[2][0].Map = strtod (ptr, NULL);
     125  star[2][0].measure.Map = strtod (ptr, NULL);
    126126  ptr = next2MASSfield (ptr); // k_msig_stdap (skip?)
    127127
     
    140140  set2MASS_use_flag (star[2], ptr[0]);
    141141
    142   star[0][0].code  = TM_J;
    143   star[0][0].found = -1;
    144   star[0][0].detID   = 0;
    145   star[0][0].imageID = 0;
    146 
    147   star[1][0].code  = TM_H;
    148   star[1][0].found = -1;
    149   star[1][0].detID   = 0;
    150   star[1][0].imageID = 0;
    151 
    152   star[2][0].code  = TM_K;
    153   star[2][0].found = -1;
    154   star[2][0].detID   = 0;
    155   star[2][0].imageID = 0;
     142  star[0][0].measure.photcode  = TM_J;
     143  star[0][0].measure.detID   = 0;
     144  star[0][0].measure.imageID = 0;
     145
     146  star[1][0].measure.photcode  = TM_H;
     147  star[1][0].measure.detID   = 0;
     148  star[1][0].measure.imageID = 0;
     149
     150  star[2][0].measure.photcode  = TM_K;
     151  star[2][0].measure.detID   = 0;
     152  star[2][0].measure.imageID = 0;
    156153
    157154  return TRUE;
     
    174171
    175172  switch (qual) {
    176     case 'X': star[0].flags |= 0x0000; break;
    177     case 'U': star[0].flags |= 0x0001; break;
    178     case 'F': star[0].flags |= 0x0002; break;
    179     case 'E': star[0].flags |= 0x0003; break;
    180     case 'A': star[0].flags |= 0x0004; break;
    181     case 'B': star[0].flags |= 0x0005; break;
    182     case 'C': star[0].flags |= 0x0006; break;
    183     case 'D': star[0].flags |= 0x0007; break;
     173    case 'X': star[0].measure.photFlags |= 0x0000; break;
     174    case 'U': star[0].measure.photFlags |= 0x0001; break;
     175    case 'F': star[0].measure.photFlags |= 0x0002; break;
     176    case 'E': star[0].measure.photFlags |= 0x0003; break;
     177    case 'A': star[0].measure.photFlags |= 0x0004; break;
     178    case 'B': star[0].measure.photFlags |= 0x0005; break;
     179    case 'C': star[0].measure.photFlags |= 0x0006; break;
     180    case 'D': star[0].measure.photFlags |= 0x0007; break;
    184181    default:
    185182      fprintf (stderr, "error!\n");
     
    192189
    193190  switch (qual) {
    194     case '0': star[0].flags |= 0x0000; break;
    195     case '1': star[0].flags |= 0x0010; break;
    196     case '2': star[0].flags |= 0x0020; break;
    197     case '3': star[0].flags |= 0x0030; break;
    198     case '4': star[0].flags |= 0x0040; break;
    199     case '6': star[0].flags |= 0x0050; break;
    200     case '9': star[0].flags |= 0x0060; break;
     191    case '0': star[0].measure.photFlags |= 0x0000; break;
     192    case '1': star[0].measure.photFlags |= 0x0010; break;
     193    case '2': star[0].measure.photFlags |= 0x0020; break;
     194    case '3': star[0].measure.photFlags |= 0x0030; break;
     195    case '4': star[0].measure.photFlags |= 0x0040; break;
     196    case '6': star[0].measure.photFlags |= 0x0050; break;
     197    case '9': star[0].measure.photFlags |= 0x0060; break;
    201198    default:
    202199      fprintf (stderr, "error!\n");
     
    209206
    210207  switch (qual) {
    211     case 'p': star[0].flags |= 0x0000; break;
    212     case 'c': star[0].flags |= 0x0100; break;
    213     case 'd': star[0].flags |= 0x0200; break;
    214     case 's': star[0].flags |= 0x0300; break;
    215     case 'b': star[0].flags |= 0x0400; break;
    216     case '0': star[0].flags |= 0x0500; break;
     208    case 'p': star[0].measure.photFlags |= 0x0000; break;
     209    case 'c': star[0].measure.photFlags |= 0x0100; break;
     210    case 'd': star[0].measure.photFlags |= 0x0200; break;
     211    case 's': star[0].measure.photFlags |= 0x0300; break;
     212    case 'b': star[0].measure.photFlags |= 0x0400; break;
     213    case '0': star[0].measure.photFlags |= 0x0500; break;
    217214    default:
    218215      fprintf (stderr, "error!\n");
     
    225222
    226223  switch (qual) {
    227     case '0': star[0].flags &= ~0x0008; break;
    228     case '1': star[0].flags &= ~0x0008; break;
    229     default:  star[0].flags |=  0x0008; break;
     224    case '0': star[0].measure.photFlags &= ~0x0008; break;
     225    case '1': star[0].measure.photFlags &= ~0x0008; break;
     226    default:  star[0].measure.photFlags |=  0x0008; break;
    230227  }     
    231228  return (TRUE);
     
    235232
    236233  switch (qual) {
    237     case '0': star[0].flags &= ~0x0080; break;
    238     case '1': star[0].flags &= ~0x0080; break;
     234    case '0': star[0].measure.photFlags &= ~0x0080; break;
     235    case '1': star[0].measure.photFlags &= ~0x0080; break;
    239236    default: 
    240       star[0].flags |= 0x0080;
    241       star[0].extNsigma = 100.0;
     237      star[0].measure.photFlags |= 0x0080;
     238      star[0].measure.extNsigma = 100.0;
    242239      break;
    243240  }     
     
    248245
    249246  switch (qual) {
    250     case '0': star[0].flags &= ~0x0800; break;
    251     case '1': star[0].flags &= ~0x0800; break;
    252     default:  star[0].flags |=  0x0800; break;
     247    case '0': star[0].measure.photFlags &= ~0x0800; break;
     248    case '1': star[0].measure.photFlags &= ~0x0800; break;
     249    default:  star[0].measure.photFlags |=  0x0800; break;
    253250  }     
    254251  return (TRUE);
     
    258255
    259256  switch (qual) {
    260     case '0': star[0].flags &= ~0x1000; break;
    261     case '1': star[0].flags &= ~0x1000; break;
    262     default:  star[0].flags |=  0x1000; break;
     257    case '0': star[0].measure.photFlags &= ~0x1000; break;
     258    case '1': star[0].measure.photFlags &= ~0x1000; break;
     259    default:  star[0].measure.photFlags |=  0x1000; break;
    263260  }     
    264261  return (TRUE);
     
    268265
    269266  switch (qual) {
    270     case '0': star[0].flags &= ~0x2000; break;
    271     case '1': star[0].flags |=  0x2000; break;
     267    case '0': star[0].measure.photFlags &= ~0x2000; break;
     268    case '1': star[0].measure.photFlags |=  0x2000; break;
    272269    default:  abort();
    273270  }     
  • trunk/Ohana/src/addstar/src/get2mass_ops.c

    r17196 r21508  
    4242  double M, dM;
    4343  e_time time;
     44
     45  InitStar (star);
    4446
    4547  ptr = skipNbounds (line, '|', FilterSkip, Nmax);
     
    5759  }
    5860
    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;
     61  star[0].measure.M        = M;
     62  star[0].measure.dM       = dM;
     63  star[0].measure.photcode = Photcode;
     64  star[0].measure.t        = time;
     65  star[0].measure.detID    = 0;
     66  star[0].measure.imageID  = 0;
    6667
    6768  return TRUE;
     
    107108  // how many bits are being used for the 2mass flags; can we just set photFlags based on them?
    108109
    109   star[0].M     = J;
    110   star[0].dM    = dJ;
    111   star[0].code  = TM_J;
    112   star[0].t     = time;
    113   star[0].found = -1;
    114   star[0].detID   = 0;
    115   star[0].imageID = 0;
    116 
    117   star[1].M     = H;
    118   star[1].dM    = dH;
    119   star[1].code  = TM_H;
    120   star[1].t     = time;
    121   star[1].found = -1;
    122   star[1].detID   = 0;
    123   star[1].imageID = 0;
    124 
    125   star[2].M     = K;
    126   star[2].dM    = dK;
    127   star[2].code  = TM_K;
    128   star[2].t     = time;
    129   star[2].found = -1;
    130   star[2].detID   = 0;
    131   star[2].imageID = 0;
     110  star[0].measure.M         = J;
     111  star[0].measure.dM        = dJ;
     112  star[0].measure.photcode  = TM_J;
     113  star[0].measure.t         = time;
     114  star[0].measure.detID     = 0;
     115  star[0].measure.imageID   = 0;
     116
     117  star[1].measure.M         = H;
     118  star[1].measure.dM        = dH;
     119  star[1].measure.photcode  = TM_H;
     120  star[1].measure.t         = time;
     121  star[1].measure.detID     = 0;
     122  star[1].measure.imageID   = 0;
     123
     124  star[2].measure.M         = K;
     125  star[2].measure.dM        = dK;
     126  star[2].measure.photcode  = TM_K;
     127  star[2].measure.t         = time;
     128  star[2].measure.detID     = 0;
     129  star[2].measure.imageID   = 0;
    132130
    133131  return TRUE;
  • trunk/Ohana/src/addstar/src/getgsc.c

    r17439 r21508  
    6767    Nline = nbytes / BYTES_STAR;
    6868    for (i = 0; i < Nline; i++) {
     69
     70      InitStar (&stars[Nstars]);
     71
    6972      Nbyte = i*BYTES_STAR;
    70       dparse (&stars[Nstars].R, 1, &buffer[Nbyte]);
    71       dparse (&stars[Nstars].D, 2, &buffer[Nbyte]);
    72       if (stars[Nstars].R < UserPatch.Rmin) continue;
    73       if (stars[Nstars].R > UserPatch.Rmax) continue;
    74       if (stars[Nstars].D < UserPatch.Dmin) continue;
    75       if (stars[Nstars].D > UserPatch.Dmax) continue;
     73      dparse (&stars[Nstars].average.R, 1, &buffer[Nbyte]);
     74      dparse (&stars[Nstars].average.D, 2, &buffer[Nbyte]);
    7675
    77       dparse (&stars[Nstars].M, 3, &buffer[Nbyte]);
    78       stars[Nstars].dM    = NAN;
    79       stars[Nstars].t     = 0;
    80       stars[Nstars].code  = GSC_M;
    81       stars[Nstars].found = -1;
     76      if (stars[Nstars].average.R < UserPatch.Rmin) continue;
     77      if (stars[Nstars].average.R > UserPatch.Rmax) continue;
     78      if (stars[Nstars].average.D < UserPatch.Dmin) continue;
     79      if (stars[Nstars].average.D > UserPatch.Dmax) continue;
    8280
    83       stars[Nstars].detID   = 0;
    84       stars[Nstars].imageID = 0;
    85 
    86       stars[Nstars].X  = 0;
    87       stars[Nstars].Y  = 0;
    88       stars[Nstars].fx = 0;
    89       stars[Nstars].fy = 0;
    90       stars[Nstars].df = 0;
     81      fparse (&stars[Nstars].measure.M, 3, &buffer[Nbyte]);
     82      stars[Nstars].measure.dM        = NAN;
     83      stars[Nstars].measure.photcode  = GSC_M;
     84      stars[Nstars].measure.t         = 0;
    9185
    9286      Nstars ++;
  • trunk/Ohana/src/addstar/src/gettycho.c

    r17439 r21508  
    6969
    7070      for (j = 0; j < nitems; j++) {
     71
    7172        line = &buffer[j*NBYTE];
    72         stars[Ntycho].R = atof (&line[15]);
    73         stars[Ntycho].D = atof (&line[28]);
    7473
    75         if (stars[Ntycho].R < region[0].Rmin) goto next_section;
    76         if (stars[Ntycho].R > region[0].Rmax) goto next_section;
    77         if (stars[Ntycho].D < region[0].Dmin) goto next_section;
    78         if (stars[Ntycho].D > region[0].Dmax) goto next_section;
     74        InitStar (&stars[Ntycho]);
    7975
    80         if (stars[Ntycho].R < UserPatch.Rmin) continue;
    81         if (stars[Ntycho].R > UserPatch.Rmax) continue;
    82         if (stars[Ntycho].D < UserPatch.Dmin) continue;
    83         if (stars[Ntycho].D > UserPatch.Dmax) continue;
     76        stars[Ntycho].average.R = atof (&line[15]);
     77        stars[Ntycho].average.D = atof (&line[28]);
    8478
    85         stars[Ntycho].dR  = 1000 * atof (&line[57]);
    86         stars[Ntycho].dD  = 1000 * atof (&line[64]);
     79        if (stars[Ntycho].average.R < region[0].Rmin) goto next_section;
     80        if (stars[Ntycho].average.R > region[0].Rmax) goto next_section;
     81        if (stars[Ntycho].average.D < region[0].Dmin) goto next_section;
     82        if (stars[Ntycho].average.D > region[0].Dmax) goto next_section;
     83
     84        if (stars[Ntycho].average.R < UserPatch.Rmin) continue;
     85        if (stars[Ntycho].average.R > UserPatch.Rmax) continue;
     86        if (stars[Ntycho].average.D < UserPatch.Dmin) continue;
     87        if (stars[Ntycho].average.D > UserPatch.Dmax) continue;
     88
     89        stars[Ntycho].average.dR  = 1000 * atof (&line[57]);
     90        stars[Ntycho].average.dD  = 1000 * atof (&line[64]);
    8791
    8892        /* XXX : we need to apply uR,uD to R,D to advance to 2000.0 */
    89         stars[Ntycho].uR  = atof (&line[41]);
    90         stars[Ntycho].uD  = atof (&line[49]);
     93        stars[Ntycho].average.uR  = atof (&line[41]);
     94        stars[Ntycho].average.uD  = atof (&line[49]);
    9195
    92         stars[Ntycho].duR = atof (&line[69]);
    93         stars[Ntycho].duD = atof (&line[75]);
    94        
    95         stars[Ntycho].P   = 0;
    96         stars[Ntycho].dP  = 0;
    97 
    98         stars[Ntycho].detID   = 0;
    99         stars[Ntycho].imageID = 0;
     96        stars[Ntycho].average.duR = atof (&line[69]);
     97        stars[Ntycho].average.duD = atof (&line[75]);
    10098
    10199        /* Tycho uses J2000 equinox and 1991.25 epoch for coordinates */
    102100        /* the magnitudes have no temporal information */
    103         stars[Ntycho].t   = TychoEpoch;
    104         stars[Ntycho].found = -1;
    105      
    106         stars[Ntycho].X  = 0;
    107         stars[Ntycho].Y  = 0;
    108         stars[Ntycho].fx = 0;
    109         stars[Ntycho].fy = 0;
    110         stars[Ntycho].df = 0;
     101        stars[Ntycho].measure.t   = TychoEpoch;
    111102
    112103        /* one pass of addstar does either r or b */
    113104        if (photcode == TYCHO_B) {
    114           stars[Ntycho].M    = atof (&line[110]);
    115           stars[Ntycho].dM    = atof (&line[117]);
    116           stars[Ntycho].code = TYCHO_B;
     105          stars[Ntycho].measure.M        = atof (&line[110]);
     106          stars[Ntycho].measure.dM      = atof (&line[117]);
     107          stars[Ntycho].measure.photcode = TYCHO_B;
    117108        } else {
    118           stars[Ntycho].M    = atof (&line[123]);
    119           stars[Ntycho].dM    = atof (&line[130]);
    120           stars[Ntycho].code = TYCHO_V;
     109          stars[Ntycho].measure.M        = atof (&line[123]);
     110          stars[Ntycho].measure.dM      = atof (&line[130]);
     111          stars[Ntycho].measure.photcode = TYCHO_V;
    121112        }       
    122113     
  • trunk/Ohana/src/addstar/src/getusno.c

    r17439 r21508  
    110110      if (buf[1] > iDEC1) continue;
    111111
    112       memset (&stars[Nusno], 0, sizeof(Stars));
    113       stars[Nusno].R     = buf[0]/360000.0;
    114       stars[Nusno].D     = buf[1]/360000.0 - 90.0;
    115       stars[Nusno].dM    = NAN;
    116       stars[Nusno].t     = 0;
    117       stars[Nusno].found = -1;
     112      InitStar (&stars[Nusno]);
    118113
    119       stars[Nusno].detID   = 0;
    120       stars[Nusno].imageID = 0;
    121 
    122       stars[Nusno].X  = 0;
    123       stars[Nusno].Y  = 0;
    124       stars[Nusno].fx = 0;
    125       stars[Nusno].fy = 0;
    126       stars[Nusno].df = 0;
     114      stars[Nusno].average.R     = buf[0]/360000.0;
     115      stars[Nusno].average.D     = buf[1]/360000.0 - 90.0;
     116      stars[Nusno].measure.dM    = NAN;
    127117
    128118      /* one pass of addstar does either r or b */
    129119      if (photcode == USNO_RED) {
    130         stars[Nusno].code = USNO_RED;
    131         stars[Nusno].M     = fabs (0.1*(buf[2] - 1000*((int)(buf[2]/1000))));
     120        stars[Nusno].measure.photcode = USNO_RED;
     121        stars[Nusno].measure.M        = fabs (0.1*(buf[2] - 1000*((int)(buf[2]/1000))));
    132122      }
    133123      if (photcode == USNO_BLUE) {     
    134         stars[Nusno].code = USNO_BLUE;
    135         stars[Nusno].M     = fabs (0.1*((int)(buf[2] - 1000000*((int)(buf[2]/1000000))) / 1000));
     124        stars[Nusno].measure.photcode = USNO_BLUE;
     125        stars[Nusno].measure.M        = fabs (0.1*((int)(buf[2] - 1000000*((int)(buf[2]/1000000))) / 1000));
    136126      }
    137127      Nusno ++;
  • trunk/Ohana/src/addstar/src/getusnob.c

    r17439 r21508  
    125125      /* USNO coords are reported for J2000 / epoch 2000.0 */
    126126      /* extract the basic stellar data */
    127       memset (&stars[Nusno], 0, sizeof(Stars));
    128       stars[Nusno].R   = buf[0]/360000.0;
    129       stars[Nusno].D   = buf[1]/360000.0 - 90.0;
     127      InitStar (&stars[Nusno]);
     128
     129      stars[Nusno].average.R   = buf[0]/360000.0;
     130      stars[Nusno].average.D   = buf[1]/360000.0 - 90.0;
    130131
    131132      /* XXX uR cos(D) or just uR ??? */
    132       stars[Nusno].uR  = 2.0 * ((buf[2]       % 10000) - 5000);
    133       stars[Nusno].uD  = 2.0 * ((buf[2]/10000 % 10000) - 5000);
     133      stars[Nusno].average.uR  = 2.0 * ((buf[2]       % 10000) - 5000);
     134      stars[Nusno].average.uD  = 2.0 * ((buf[2]/10000 % 10000) - 5000);
    134135
    135       stars[Nusno].duR = (buf[3]      % 1000);
    136       stars[Nusno].duD = (buf[3]/1000 % 1000);
     136      stars[Nusno].average.duR = (buf[3]      % 1000);
     137      stars[Nusno].average.duD = (buf[3]/1000 % 1000);
    137138
    138       stars[Nusno].dR  = 0.001 * (buf[4]      % 1000);
    139       stars[Nusno].dD  = 0.001 * (buf[4]/1000 % 1000);
     139      stars[Nusno].average.dR  = 0.001 * (buf[4]      % 1000);
     140      stars[Nusno].average.dD  = 0.001 * (buf[4]/1000 % 1000);
    140141
    141       stars[Nusno].P   = 0;
    142       stars[Nusno].dP  = 0;
     142      stars[Nusno].average.P   = 0;
     143      stars[Nusno].average.dP  = 0;
    143144
    144145      /* USNO magnitude errors are reported as a fixed 0.3 mag */
    145       stars[Nusno].dM    = 0.3;
    146       stars[Nusno].found = -1;
    147      
    148       stars[Nusno].detID   = 0;
    149       stars[Nusno].imageID = 0;
    150 
    151       stars[Nusno].X  = 0;
    152       stars[Nusno].Y  = 0;
    153       stars[Nusno].fx = 0;
    154       stars[Nusno].fy = 0;
    155       stars[Nusno].df = 0;
     146      stars[Nusno].measure.dM  = 0.3;
    156147
    157148      /* USNO-B uses J2000 equinox and 2000.0 epoch for coordinates */
    158149      /* the magnitudes have no temporal information */
    159       stars[Nusno].   = USNOepoch;
     150      stars[Nusno].measure.t   = USNOepoch;
    160151
    161152      /* one pass of addstar does r, b, or n */
     
    172163          m2 = 0;
    173164      }
    174       stars[Nusno].code = photcode;
     165      stars[Nusno].measure.photcode = photcode;
    175166
    176167      /* if two mags are available, get an average */
     
    180171        mag = (m1) ? m1 : m2;
    181172      }
    182       stars[Nusno].M = (mag == 0.0) ? 32.0 : mag;
     173      stars[Nusno].measure.M = (mag == 0.0) ? 32.0 : mag;
    183174
    184175      Nusno ++;
  • trunk/Ohana/src/addstar/src/greference.c

    r6683 r21508  
    33# define LOAD_DR2    1
    44
    5 Stars *grefcat (char *Refcat, SkyRegion *region, int photcode, int *nstars) {
     5Stars *greference (char *Refcat, SkyRegion *region, int photcode, int *nstars) {
    66
    77  int Nstars;
     
    3636  /* get stars from 2MASS for the given region */
    3737  if (!strcasecmp (Refcat, "2MASS")) {
    38     stars = get2mass (region, photcode, LOAD_ALLSKY, &Nstars);
     38    // stars = get2mass (region, photcode, LOAD_ALLSKY, &Nstars);
     39    fprintf (stderr, "2MASS load via addstar is deprecated: use load2mass\n");
     40    exit (2);
    3941  }
    4042 
    4143  /* get stars from 2MASS for the given region */
    4244  if (!strcasecmp (Refcat, "2MASS-ALLSKY")) {
    43     stars = get2mass (region, photcode, LOAD_ALLSKY, &Nstars);
     45    // stars = get2mass (region, photcode, LOAD_ALLSKY, &Nstars);
     46    fprintf (stderr, "2MASS load via addstar is deprecated: use load2mass\n");
     47    exit (2);
    4448  }
    4549 
    4650  /* get stars from 2MASS for the given region */
    4751  if (!strcasecmp (Refcat, "2MASS-DR2")) {
    48     stars = get2mass (region, photcode, LOAD_DR2, &Nstars);
     52    // stars = get2mass (region, photcode, LOAD_DR2, &Nstars);
     53    fprintf (stderr, "2MASS load via addstar is deprecated: use load2mass\n");
     54    exit (2);
    4955  }
    5056 
  • trunk/Ohana/src/addstar/src/grefstars.c

    r19823 r21508  
    2121    if (line[0] == 0) continue;
    2222    if (line[0] == '#') continue;
    23     dparse (&stars[N].R,  1, line);
    24     dparse (&stars[N].D,  2, line);
    25     dparse (&stars[N].M,  3, line);
    26     dparse (&stars[N].dM, 4, line);
    27     stars[N].R = ohana_normalize_angle (stars[N].R);
    28     stars[N].t = 0;
    29     stars[N].code = photcode;
    30     stars[N].found = FALSE;
    31     stars[N].detID   = 0;
    32     stars[N].imageID = 0;
    3323
    34     stars[N].X  = 0;
    35     stars[N].Y  = 0;
    36     stars[N].fx = 0;
    37     stars[N].fy = 0;
    38     stars[N].df = 0;
     24    InitStar (&stars[N]);
     25
     26    dparse (&stars[N].average.R,  1, line);
     27    dparse (&stars[N].average.D,  2, line);
     28    stars[N].average.R = ohana_normalize_angle (stars[N].average.R);
     29
     30    fparse (&stars[N].measure.M,  3, line);
     31    fparse (&stars[N].measure.dM, 4, line);
     32
     33    stars[N].measure.photcode = photcode;
    3934
    4035    CHECK_REALLOCATE (stars, Stars, NSTARS, N+1, 100);
     
    4338  return (stars);
    4439}
    45 
    46 /* stars.found is set here to FALSE.
    47    find_match_refstars uses stars.found to identify the seq number of the
    48    star which is found.  it requires an initial value of -1 XXX
    49 */
  • trunk/Ohana/src/addstar/src/load2mass_as_rawdata.c

    r17439 r21508  
    140140        ALLOCATE (stars[Nstars+2], Stars, 1);
    141141
    142         stars[Nstars+0][0].R = tstars[j].R;
    143         stars[Nstars+0][0].D = tstars[j].D;
    144         stars[Nstars+1][0].R = tstars[j].R;
    145         stars[Nstars+1][0].D = tstars[j].D;
    146         stars[Nstars+2][0].R = tstars[j].R;
    147         stars[Nstars+2][0].D = tstars[j].D;
     142        InitStar (stars[Nstars+0]);
     143        InitStar (stars[Nstars+1]);
     144        InitStar (stars[Nstars+2]);
     145
     146        stars[Nstars+0][0].average.R = tstars[j].R;
     147        stars[Nstars+0][0].average.D = tstars[j].D;
     148        stars[Nstars+1][0].average.R = tstars[j].R;
     149        stars[Nstars+1][0].average.D = tstars[j].D;
     150        stars[Nstars+2][0].average.R = tstars[j].R;
     151        stars[Nstars+2][0].average.D = tstars[j].D;
    148152        get2mass_3star_full (&stars[Nstars], &buffer[offset], Nbyte - offset);
    149         // get2mass_star (&stars[Nstars], &buffer[offset], Nbyte - offset);
    150153
    151154        tstars[j].flag = TRUE;
  • trunk/Ohana/src/addstar/src/load2mass_catalog.c

    r16810 r21508  
    2020    // XXX for now, the output objects will have limited astrometric interpretation...
    2121    // XXX every 3 stars represents 3 measurements and 1 average
    22     catalog[0].average[Nave].R     = stars[i].R;
    23     catalog[0].average[Nave].D     = stars[i].D;
     22    catalog[0].average[Nave].R     = stars[i].average.R;
     23    catalog[0].average[Nave].D     = stars[i].average.D;
    2424    catalog[0].average[Nave].dR    = 0;
    2525    catalog[0].average[Nave].dD    = 0;
     
    3737    catalog[0].average[Nave].measureOffset = Nmeas;
    3838    catalog[0].average[Nave].missingOffset = -1;
    39     catalog[0].average[Nave].code          = 0;
     39    catalog[0].average[Nave].flags         = 0;
    4040
    4141    for (j = 0; j < Nsec; j++) {
    42       catalog[0].secfilt[Nave*Nsec+j].M  = NAN;
    43       catalog[0].secfilt[Nave*Nsec+j].dM = NAN;
    44       catalog[0].secfilt[Nave*Nsec+j].Xm = NAN_S_SHORT;
     42      catalog[0].secfilt[Nave*Nsec+j].M     = NAN;
     43      catalog[0].secfilt[Nave*Nsec+j].dM    = NAN;
     44      catalog[0].secfilt[Nave*Nsec+j].Xm    = NAN_S_SHORT;
     45      catalog[0].secfilt[Nave*Nsec+j].M_20  = NAN_S_SHORT;
     46      catalog[0].secfilt[Nave*Nsec+j].M_80  = NAN_S_SHORT;
     47      catalog[0].secfilt[Nave*Nsec+j].Ncode = 0;
     48      catalog[0].secfilt[Nave*Nsec+j].Nused = 0;
    4549    }
    4650
    4751    // we now have the min chisq row. use this to supply the other filter values....
    4852    for (j = 0; j < 3; j++) {
     53      catalog[0].measure[Nmeas]           = stars[i+j].measure;
     54
    4955      catalog[0].measure[Nmeas].dR        = 0.0;
    5056      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;
     57      catalog[0].measure[Nmeas].dt        = NAN_S_SHORT;
     58
     59      // XXX what about averef?
    7160
    7261      catalog[0].average[Nave].Nmeasure++;
  • trunk/Ohana/src/addstar/src/replace_match.c

    r16810 r21508  
    77  /* search for entry and replace values M, dM, R, D */
    88  for (i = 0; i < average[0].Nmeasure; i++) {
    9     if (measure[i].photcode != star[0].code) continue;
    10     measure[i].dR = 3600.0*(average[0].R - star[0].R);
    11     measure[i].dD = 3600.0*(average[0].D - star[0].D);
    12     measure[i].M  = star[0].M;
    13     measure[i].dM = star[0].dM;
     9    if (measure[i].photcode != star[0].measure.photcode) continue;
     10    measure[i].dR = 3600.0*(average[0].R - star[0].average.R);
     11    measure[i].dD = 3600.0*(average[0].D - star[0].average.D);
     12    measure[i].M  = star[0].measure.M;
     13    measure[i].dM = star[0].measure.dM;
    1414    star[0].found = average[0].measureOffset + i;
    1515    return (TRUE);
  • trunk/Ohana/src/addstar/src/sky_tessalation.c

    r21055 r21508  
    281281  image[0].NY = NY;
    282282
    283   image[0].code = 1; // this needs to be set more sensibly
     283  image[0].photcode = 1; // this needs to be set more sensibly
    284284
    285285  image[0].Mx   = xv[0];  image[0].My   = yv[0];
     
    433433  rectangle[0].NX = NX;
    434434  rectangle[0].NY = NY;
    435   rectangle[0].code = 1; // this needs to be set more sensibly
     435  rectangle[0].photcode = 1; // this needs to be set more sensibly
    436436
    437437  return (TRUE);
     
    477477  rectangle[0].NX = NX;
    478478  rectangle[0].NY = NY;
    479   rectangle[0].code = 1; // this needs to be set more sensibly
     479  rectangle[0].photcode = 1; // this needs to be set more sensibly
    480480
    481481  return (TRUE);
     
    511511      output[N].NX = NX;
    512512      output[N].NY = NY;
    513       output[N].code = input[0].code;
     513      output[N].photcode = input[0].photcode;
    514514
    515515      output[N].coords.crpix1 = input[0].coords.crpix1 - i*NX;
  • trunk/Ohana/src/getstar/src/ReadImageFiles.c

    r19259 r21508  
    6464      /* find image rootname */
    6565      name = filebasename (file[i]);
    66       snprintf (image[N].name, DVO_IMAGE_NAME_LEN, name);
     66      snprintf (image[N].name, DVO_IMAGE_NAME_LEN, "%s", name);
    6767      free (name);
    6868
  • trunk/Ohana/src/getstar/src/ReadImageHeader.c

    r20184 r21508  
    112112  image[0].Mcal = 0.0;
    113113  image[0].Xm   = NAN_S_SHORT;
    114   image[0].code = 0;
     114  image[0].flags = 0;
    115115
    116116  return (TRUE);
  • trunk/Ohana/src/getstar/src/write_getstar_ps1_dev_0.c

    r16810 r21508  
    4646    output[i].D        = average[i].D;
    4747
    48     output[i].code     = average[i].code;
     48    output[i].code     = average[i].flags;
    4949    output[i].photcode = code_c0;
    5050
  • trunk/Ohana/src/getstar/src/write_getstar_ps1_dev_1.c

    r16810 r21508  
    4949    output[i].P        = average[i].P;
    5050
    51     output[i].code     = average[i].code;
     51    output[i].code     = average[i].flags;
    5252    output[i].photcode = code_c0;
    5353
  • trunk/Ohana/src/getstar/src/write_getstar_ps1_dev_2.c

    r16810 r21508  
    5555    output[i].dP       = average[i].dP;
    5656
    57     output[i].code     = average[i].code;
     57    output[i].code     = average[i].flags;
    5858    output[i].photcode = code_c0;
    5959
  • trunk/Ohana/src/imregister/imphot/modify.c

    r7080 r21508  
    1313    if (options.modify) {
    1414      if (!strcasecmp (options.ModifyEntry, "and")) {
    15         image[i].code &= atoi (options.ModifyValue);
     15        image[i].flags &= atoi (options.ModifyValue);
    1616      }
    1717      if (!strcasecmp (options.ModifyEntry, "or")) {
    18         image[i].code |= atoi (options.ModifyValue);
     18        image[i].flags |= atoi (options.ModifyValue);
    1919      }
    2020      if (!strcasecmp (options.ModifyEntry, "xor")) {
    21         image[i].code ^= atoi (options.ModifyValue);
     21        image[i].flags ^= atoi (options.ModifyValue);
    2222      }
    2323      if (!strcasecmp (options.ModifyEntry, "=")) {
    24         image[i].code = atoi (options.ModifyValue);
     24        image[i].flags = atoi (options.ModifyValue);
    2525      }
    2626    }
  • trunk/Ohana/src/imregister/imphot/output.c

    r14590 r21508  
    3939     
    4040    fprintf (stdout, "%s %s %s  %7.4f %7.4f  %7.4f %5d %02x\n", image[i].name, photstr, timestr,
    41              image[i].Mcal, image[i].dMcal, image[i].secz, image[i].nstar, image[i].code);
     41             image[i].Mcal, image[i].dMcal, image[i].secz, image[i].nstar, image[i].flags);
    4242    free (timestr);
    4343  }
  • trunk/Ohana/src/imregister/imphot/subset.c

    r12332 r21508  
    2424    if (!status && criteria.Ntimes) continue;
    2525    if (criteria.PhotcodeSelect && (image[i].photcode != criteria.photcode)) continue;
    26     if (criteria.CodeSelect     && (image[i].code != criteria.Code)) continue;
     26    if (criteria.CodeSelect     && (image[i].flags != criteria.Code)) continue;
    2727    if (criteria.NameSelect     && strncasecmp (image[i].name, criteria.Name, NameSelectLength)) continue;
    2828
  • trunk/Ohana/src/libautocode/Makefile.Targets

    r19185 r21508  
    1 
    21AOBJS = \
    32$(ASRC)/coords.$(ARCH).o \
     
    98$(ASRC)/average-ps1-dev-1.$(ARCH).o \
    109$(ASRC)/average-ps1-dev-2.$(ARCH).o \
     10$(ASRC)/average-ps1-v1.$(ARCH).o \
    1111$(ASRC)/secfilt.$(ARCH).o \
    1212$(ASRC)/secfilt-loneos.$(ARCH).o \
     
    1616$(ASRC)/secfilt-ps1-dev-1.$(ARCH).o \
    1717$(ASRC)/secfilt-ps1-dev-2.$(ARCH).o \
     18$(ASRC)/secfilt-ps1-v1.$(ARCH).o \
    1819$(ASRC)/measure.$(ARCH).o \
    1920$(ASRC)/measure-loneos.$(ARCH).o \
     
    2324$(ASRC)/measure-ps1-dev-1.$(ARCH).o \
    2425$(ASRC)/measure-ps1-dev-2.$(ARCH).o \
     26$(ASRC)/measure-ps1-v1.$(ARCH).o \
    2527$(ASRC)/missing.$(ARCH).o \
    2628$(ASRC)/photcode.$(ARCH).o \
     
    2931$(ASRC)/photcode-ps1-dev-2.$(ARCH).o \
    3032$(ASRC)/photcode-ps1-dev-3.$(ARCH).o \
     33$(ASRC)/photcode-ps1-v1.$(ARCH).o \
    3134$(ASRC)/image.$(ARCH).o \
    3235$(ASRC)/image-loneos.$(ARCH).o \
     
    3740$(ASRC)/image-ps1-dev-2.$(ARCH).o \
    3841$(ASRC)/image-ps1-dev-3.$(ARCH).o \
     42$(ASRC)/image-ps1-v1.$(ARCH).o \
    3943$(ASRC)/regimage.$(ARCH).o \
    4044$(ASRC)/detreg.$(ARCH).o \
    4145$(ASRC)/photreg.$(ARCH).o \
    4246$(ASRC)/photreg-old.$(ARCH).o \
    43 $(ASRC)/ps1_dev_0.$(ARCH).o \
    44 $(ASRC)/ps1_dev_1.$(ARCH).o \
    45 $(ASRC)/smpdata.$(ARCH).o \
     47$(ASRC)/cmf-ps1-dev-0.$(ARCH).o \
     48$(ASRC)/cmf-ps1-dev-1.$(ARCH).o \
     49$(ASRC)/cmf-ps1-v1.$(ARCH).o \
     50$(ASRC)/cmf-smpdata.$(ARCH).o \
    4651$(ASRC)/getstar-ps1-dev-0.$(ARCH).o \
    4752$(ASRC)/getstar-ps1-dev-1.$(ARCH).o \
     
    4954$(ASRC)/spectrum.$(ARCH).o \
    5055$(ASRC)/spectrum-ascii.$(ARCH).o \
    51 $(ASRC)/Stars.$(ARCH).o \
    5256$(ASRC)/GSCRegion.$(ARCH).o \
    5357$(ASRC)/AddstarClientOptions.$(ARCH).o \
     
    6367$(AINC)/average-ps1-dev-1.h \
    6468$(AINC)/average-ps1-dev-2.h \
     69$(AINC)/average-ps1-v1.h \
    6570$(AINC)/secfilt.h \
    6671$(AINC)/secfilt-loneos.h \
     
    7075$(AINC)/secfilt-ps1-dev-1.h \
    7176$(AINC)/secfilt-ps1-dev-2.h \
     77$(AINC)/secfilt-ps1-v1.h \
    7278$(AINC)/measure.h \
    7379$(AINC)/measure-loneos.h \
     
    7783$(AINC)/measure-ps1-dev-1.h \
    7884$(AINC)/measure-ps1-dev-2.h \
     85$(AINC)/measure-ps1-v1.h \
    7986$(AINC)/missing.h \
    8087$(AINC)/photcode.h \
     
    8390$(AINC)/photcode-ps1-dev-2.h \
    8491$(AINC)/photcode-ps1-dev-3.h \
     92$(AINC)/photcode-ps1-v1.h \
    8593$(AINC)/image.h \
    8694$(AINC)/image-loneos.h \
     
    9199$(AINC)/image-ps1-dev-2.h \
    92100$(AINC)/image-ps1-dev-3.h \
     101$(AINC)/image-ps1-v1.h \
    93102$(AINC)/regimage.h \
    94103$(AINC)/detreg.h \
    95104$(AINC)/photreg.h \
    96105$(AINC)/photreg-old.h \
    97 $(AINC)/ps1_dev_0.h \
    98 $(AINC)/ps1_dev_1.h \
     106$(AINC)/cmf-ps1-dev-0.h \
     107$(AINC)/cmf-ps1-dev-1.h \
     108$(AINC)/cmf-ps1-v1.h \
     109$(AINC)/cmf-smpdata.h \
    99110$(AINC)/getstar-ps1-dev-0.h \
    100111$(AINC)/getstar-ps1-dev-1.h \
    101112$(AINC)/getstar-ps1-dev-2.h \
    102 $(AINC)/smpdata.h \
    103113$(AINC)/spectrum.h \
    104114$(AINC)/spectrum-ascii.h \
    105 $(AINC)/Stars.h \
    106115$(AINC)/GSCRegion.h \
    107116$(AINC)/AddstarClientOptions.h \
    108117$(AINC)/SkyRegion.h
     118
     119# $(ASRC)/Stars.$(ARCH).o
     120# $(AINC)/Stars.h
     121
  • trunk/Ohana/src/libautocode/def/Stars.d

    r16810 r21508  
    22EXTNAME STARS
    33TYPE    BINTABLE
    4 SIZE    248
     4SIZE    278
    55
    6 FIELD     X,                X,          double,    x coordinate on image,            pixels
    7 FIELD     Y,                Y,          double,    y coordinate on image,            pixels
    8 FIELD     dX,               dX,         double,    x coordinate error,               pixels
    9 FIELD     dY,               dY,         double,    y coordinate error,               pixels
     6* FIELD     Xccd,             X,          double,    x coordinate on image,          pixels
     7* FIELD     Yccd,             Y,          double,    y coordinate on image,          pixels
     8* FIELD     dXccd,            dX,         double,    x coordinate error,                     pixels
     9* FIELD     dYccd,            dY,         double,    y coordinate error,             pixels
     10* FIELD     posangle,         POSANGLE,   float
     11* FIELD     pltscale,         PLTSCALE,   float
    1012FIELD     R,                R,          double,    ra coordinate on sky,             decimal degrees
    1113FIELD     D,                D,          double,    dec coordinate on sky,            decimal degrees
     
    1820FIELD     P,                PAR,        double,    parallax,                         milliarcsec
    1921FIELD     dP,               PAR_ERR,    double,    parallax error,                   milliarcsec
    20 FIELD     M,                M,          double,    instrumental mag
    21 FIELD     dM,               DM,         double,    error on mag
    22 FIELD     dMcal,            DMCAL,      double,    systematic error on mag
    23 FIELD     sky,              SKY,        double,    local sky counts
    24 FIELD     dsky,             dSKY,       double,    local sky error counts
    25 FIELD     fx,               FX,         double,    object FWHM x-dir,                pixels?
    26 FIELD     fy,               FY,         double,    object FWHM y-dir,                pixels?
    27 FIELD     df,               DF,         double,    object position angle,            degrees
    28 # FIELD     Mgal,             MGAL,       double,    alternative (galaxy) magnitude
    29 FIELD     Map,              MAP,        double,    alternative (aperture) magnitude
     22
     23* FIELD     M,                M,          double,    instrumental mag
     24* FIELD     dM,               DM,         double,    error on mag
     25* FIELD     dMcal,            DMCAL,      double,    systematic error on mag
     26* FIELD     Sky,              SKY,        double,    local sky counts
     27* FIELD     dSky,             dSKY,       double,    local sky error counts
     28* FIELD     fx,               FX,         double,    object FWHM x-dir,              pixels?
     29* FIELD     fy,               FY,         double,    object FWHM y-dir,              pixels?
     30* FIELD     df,               DF,         double,    object position angle,          degrees
     31* FIELD     Mcal,             MCAL,       float,     image cal magnitude
     32* FIELD     Map,              MAP,        double,    alternative (aperture) magnitude
    3033FIELD     Mpeak,            MPEAK,      double,    alternative (peak) magnitude
    31 FIELD     detID,            ID,         int,       detection identifier
    32 FIELD     imageID,          IMAGE_ID,   int,       image identifier
     34* FIELD     detID,            ID,         int,       detection identifier
     35* FIELD     imageID,          IMAGE_ID,   int,       image identifier
    3336FIELD     found,            FOUND,      int,       found in database catalog?
    34 FIELD     t,                T,          e_time,    date/time of exposure (UNIX)
    35 FIELD     dt,               EXPTIME,    float,     exposure time,                    2.5*log(exptime)
    36 FIELD     psfChisq,         PSF_CHISQ,  float
    37 FIELD     crNsigma,         CR_NSIGMA,  float
    38 FIELD     extNsigma,        EXT_NSIGMA, float
    39 FIELD     psfQual,          PSF_QUAL,   float
    40 FIELD     Mcal,             MCAL,       float,     image cal mag,                    mag
    41 FIELD     airmass,          AIRMASS,    float,     (airmass - 1),                    airmass
    42 FIELD     az,               AZ,         float,     azimuth
    43 FIELD     code,             CODE,       short
    44 FIELD     nFrames,          N_FRAMES,   short
    45 FIELD     flags,            FLAGS,      short
    46 FIELD     dophot,           DOPHOT,     char,      dophot type code
    47 FIELD     dummy,            DUMMY,      char
    48 
    49 # XXX I'm going to need azimuth (or load from image header?)
     37* FIELD     t,                T,          e_time,    date/time of exposure (UNIX)
     38* FIELD     t_msec,           T_MSEC,     short,     milliseconds of exposure
     39* FIELD     dt,               EXPTIME,    float,     exposure time,                    2.5*log(exptime)
     40* FIELD     psfQual,          PSF_QUAL,   float
     41* FIELD     psfChisq,         PSF_CHISQ,  float
     42* FIELD     psfNdof,          PSF_NDOF,   int
     43* FIELD     psfNpix,          PSF_NPIX,   int
     44* FIELD     crNsigma,         CR_NSIGMA,  float
     45* FIELD     extNsigma,        EXT_NSIGMA, float
     46* FIELD     Mxx,              MOMENTS_XX, float,     second moment
     47* FIELD     Mxy,              MOMENTS_XY, float,     second moment
     48* FIELD     Myy,              MOMENTS_YY, float,     second moment
     49* FIELD     airmass,          AIRMASS,    float,     (airmass - 1),                  airmass
     50* FIELD     az,             AZ,         float,     azimuth
     51* FIELD     photcode,         CODE,       short
     52* FIELD     nFrames,          N_FRAMES,   short
     53* FIELD     photFlags,        FLAGS,      short
     54FIELD     dummy,            DUMMY,      char[2]
    5055
    5156# double:   24 * 8 : 192
     
    5863# define down the types to floats where reasonable (all but R,D)?
    5964# R,D should be in ICRS, J2000, epoch 2000 : precess as needed, apply p-m as needed
     65
     66# XXX I'd like to merge this with Measure, but need to be careful about addstarClient -> addstarServer
     67# XXX extend photFlags to match actual psphot output
  • trunk/Ohana/src/libautocode/def/average.d

    r16810 r21508  
    22EXTNAME      DVO_AVERAGE
    33TYPE         BINTABLE
    4 SIZE         80
     4SIZE         94
    55DESCRIPTION  DVO Average Object Table
    66
    77# elements of data structure / FITS table
    88
    9 FIELD R,              RA,         double,           RA,                           decimal degrees
    10 FIELD D,              DEC,        double,           DEC,                          decimal degrees
    11 FIELD dR,             RA_ERR,     float,            RA error                      arcsec
    12 FIELD dD,             DEC_ERR,    float,            DEC error                     arcsec
     9FIELD R,              RA,          double,          RA,                           decimal degrees
     10FIELD D,              DEC,         double,          DEC,                          decimal degrees
     11FIELD dR,             RA_ERR,      float,           RA error                      arcsec
     12FIELD dD,             DEC_ERR,     float,           DEC error                     arcsec
     13                                   
     14FIELD uR,             U_RA,        float,           RA*cos(D) proper-motion,      arcsec/year
     15FIELD uD,             U_DEC,       float,           DEC proper-motion,            arcsec/year
     16FIELD duR,            V_RA_ERR,    float,           RA*cos(D) p-m error,          arcsec/year
     17FIELD duD,            V_DEC_ERR,   float,           DEC p-m error,                arcsec/year
     18FIELD P,              PAR,         float,           parallax,                     arcsec
     19FIELD dP,             PAR_ERR,     float,           parallax error,               arcsec
    1320
    14 FIELD uR,             U_RA,       float,            RA*cos(D) proper-motion,      arcsec/year
    15 FIELD uD,             U_DEC,      float,            DEC proper-motion,            arcsec/year
    16 FIELD duR,            V_RA_ERR,   float,            RA*cos(D) p-m error,          arcsec/year
    17 FIELD duD,            V_DEC_ERR,  float,            DEC p-m error,                arcsec/year
    18 FIELD P,              PAR,        float,            parallax,                     arcsec
    19 FIELD dP,             PAR_ERR,    float,            parallax error,               arcsec
     21FIELD Xp,             SIGMA_POS,   short,           position scatter,             1/100 arcsec
     22FIELD ChiSq,          CHISQ_POS,   float,           astrometry analysis chisq
     23FIELD Npos,           NUMBER_POS,  unsigned short,  number of detections used for astrometry
    2024
    21 FIELD Xp,             SIGMA_POS,   short,           position scatter,             1/100 arcsec
     25# this limits us to a max of 64k measurements per object
    2226FIELD Nmeasure,       NMEASURE,    unsigned short,  number of psf measurements
    2327FIELD Nmissing,       NMISSING,    unsigned short,  number of missings
    2428FIELD Nextend,        NEXTEND,     unsigned short,  number of extended measurements
    25 FIELD measureOffset,  OFF_MEASURE, int,             offset to first psf measurement
    26 FIELD missingOffset,  OFF_MISSING, int,             offset to first missing obs
    27 FIELD extendOffset,   OFF_EXTEND,  int,             offset to first extended measurement
    2829
    29 FIELD code,           code,       unsigned short,   ID code (star; ghost; etc)
    30 FIELD dummy,          DUMMY,      char[2],          padding
     30FIELD measureOffset,  OFF_MEASURE, int,             offset to first psf measurement
     31FIELD missingOffset,  OFF_MISSING, int,             offset to first missing obs
     32FIELD extendOffset,   OFF_EXTEND,  int,             offset to first extended measurement
    3133
    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.
     34# 'flags' was called 'code' prior to 2009.02.07
     35FIELD flags,          FLAGS,       uint32_t,        average object flags (star; ghost; etc)
    4036
    41 FIELD objID,          OBJ_ID,    unsigned int,   unique ID for object in table
    42 FIELD catID,          CAT_ID,    unsigned int,   unique ID for table in which object was first realized
     37# objID + catID gives a unique ID for all objects in the database
     38FIELD objID,          OBJ_ID,      unsigned int,    unique ID for object in table
     39FIELD catID,          CAT_ID,      unsigned int,    unique ID for table in which object was first realized
     40FIELD extID,          EXT_ID,      uint64_t,        external ID for object (eg PSPS objID)
    4341
    4442# this structure should only be used for internal representations
     
    4745# the index for the secfilt table is just Nsecfilt times the index for the average table.
    4846
    49 # the DVO object IDs are generated internally and are not equivalent to the PSPS object IDs
    50 # probably need to add position chisq
    51 
    52 # XXX include the number of measurements used to determine the positional information?
     47# *** 20090206 : new fields : ChiSq, Npos, flags (was code, uint16_t), extID
  • trunk/Ohana/src/libautocode/def/image.d

    r20936 r21508  
    4040# 40 bytes
    4141
    42 FIELD     name,             NAME,                 char[128],      name of original image
     42FIELD     name,             NAME,                 char[121],      name of original image
    4343FIELD     detection_limit,  DETECTION_LIMIT,      unsigned char,  detection limit,           10*mag
    4444FIELD     saturation_limit, SATURATION_LIMIT,     unsigned char,  saturation limit,          10*mag
     
    4747FIELD     fwhm_y,           FWHM_Y,               unsigned char,  PSF y width,               25*arcsec
    4848FIELD     trate,            TRATE,                unsigned char,  scan rate,                 100 usec/pixel
    49 FIELD     code,             CODE,                 char,           image quality flag
    5049FIELD     ccdnum,           CCDNUM,               unsigned char,  CCD ID number
     50FIELD     flags,            FLAGS,                unsigned int,   image quality flags
    5151FIELD     imageID,          IMAGE_ID,             unsigned int,   internal image ID
    52 
    53 # XXX do we want to use this to handle mosaics?
    54 # FIELD           parentID,         PARENT_ID,            unsigned int,   associated ref image
     52FIELD     parentID,         PARENT_ID,            unsigned int,   associated ref image
    5553FIELD     externID,         EXTERN_ID,            unsigned int,   external image ID
    5654FIELD     sourceID,         SOURCE_ID,            unsigned short, analysis source ID
     
    7371FIELD     Myyyy,            MYYYY,                short,          Mrel polyterm
    7472# 40 bytes
     73
     74# *** 20090206 : new fields : parentID, flags (was code char), changed name to 121 bytes.
  • trunk/Ohana/src/libautocode/def/measure-panstarrs-dev-0.d

    r15511 r21508  
    4646
    4747# do we need more resolution than a short? should this be a log?
    48 FIELD qPSF,           PSF_QF,       short,          psf coverage/quality factor
     48FIELD psfQual,        PSF_QF,       short,          psf coverage/quality factor
    4949
    5050FIELD dophot,         DOPHOT,       char,           dophot type
  • trunk/Ohana/src/libautocode/def/measure-panstarrs-dev-1.d

    r15511 r21508  
    4646
    4747# do we need more resolution than a short? should this be a log?
    48 FIELD qPSF,           PSF_QF,       short,          psf coverage/quality factor
     48FIELD psfQual,        PSF_QF,       short,          psf coverage/quality factor
    4949
    5050FIELD dophot,         DOPHOT,       char,           dophot type
  • trunk/Ohana/src/libautocode/def/measure-ps1-dev-1.d

    r16810 r21508  
    3333
    3434# do we need more resolution than a short? should this be a log?
    35 FIELD qPSF,           PSF_QF,       float,          psf coverage/quality factor
     35FIELD psfQual,        PSF_QF,       float,          psf coverage/quality factor
    3636FIELD psfChisq,       PSF_CHISQ,    float,          psf coverage/quality factor
    3737FIELD crNsigma,       CR_NSIGMA,    float,          psf coverage/quality factor
  • trunk/Ohana/src/libautocode/def/measure-ps1-dev-2.d

    r16810 r21508  
    3434
    3535# do we need more resolution than a short? should this be a log?
    36 FIELD qPSF,           PSF_QF,       float,          psf coverage/quality factor
     36FIELD psfQual,        PSF_QF,       float,          psf coverage/quality factor
    3737FIELD psfChisq,       PSF_CHISQ,    float,          psf fit chisq
    3838FIELD crNsigma,       CR_NSIGMA,    float,          Nsigma deviation towards CR
  • trunk/Ohana/src/libautocode/def/measure.d

    r16810 r21508  
    22EXTNAME      DVO_MEASURE
    33TYPE         BINTABLE
    4 SIZE         112
     4SIZE         146
    55DESCRIPTION  DVO Detection Measurement Table
    66
    7 FIELD dR,             D_RA,         float,          RA offset,                    arcsec
    8 FIELD dD,             D_DEC,        float,          DEC offset,                   arcsec
    9 FIELD M,              MAG,          float,          catalog mag,                  mag
    10 FIELD Mcal,           M_CAL,        float,          image cal mag,                mag
    11 FIELD Map,            M_APER,       float,          aperture mag,                 mag
    12 FIELD dM,             MAG_ERR,      float,          mag error,                    mag
    13 FIELD dMcal,          MAG_CAL_ERR,  float,          systematic calibration error, mag
    14 FIELD dt,             M_TIME,       float,          exposure time,                2.5*log(exptime)
     7FIELD dR,             D_RA,         float,          RA offset,                      arcsec
     8FIELD dD,             D_DEC,        float,          DEC offset,                     arcsec
     9FIELD M,              MAG,          float,          catalog mag,                    mag
     10FIELD Mcal,           M_CAL,        float,          image cal mag,                  mag
     11FIELD Map,            M_APER,       float,          aperture mag,                   mag
     12FIELD dM,             MAG_ERR,      float,          mag error,                      mag
     13FIELD dMcal,          MAG_CAL_ERR,  float,          systematic calibration error,   mag
     14FIELD dt,             M_TIME,       float,          exposure time,                  2.5*log(exptime)
    1515
    1616# note that with airmass = 1.0 / cos(90 - alt), we have full alt/az representation
    17 FIELD airmass,        AIRMASS,      float,          (airmass - 1),                airmass
     17FIELD airmass,        AIRMASS,      float,          (airmass - 1),                  airmass
    1818FIELD az,             AZ,           float,          telescope azimuth
    1919
    2020# new field elements needed for Pan-STARRS:
    21 FIELD Xccd,           X_CCD,        float,          X coord on chip,               pixels
    22 FIELD Yccd,           Y_CCD,        float,          Y coord on chip,               pixels
     21FIELD Xccd,           X_CCD,        float,          X coord on chip,                pixels
     22FIELD Yccd,           Y_CCD,        float,          Y coord on chip,                pixels
    2323
    2424# could these be packed into fewer bits?
    25 FIELD Sky,            SKY_FLUX,     float,          local estimate of sky flux,    counts/sec
    26 FIELD dSky,           SKY_FLUX_ERR, float,          local estimate of sky flux,    counts/sec
     25FIELD Sky,            SKY_FLUX,     float,          local estimate of sky flux,     counts/sec
     26FIELD dSky,           SKY_FLUX_ERR, float,          local estimate of sky flux,     counts/sec
    2727
    28 FIELD t,              TIME,         unsigned int,   time in seconds (UNIX)
     28FIELD t,              TIME,         int,            time in seconds (UNIX)
     29FIELD t_msec,         TIME_MSEC,    unsigned short, time fraction of second,        milliseconds
    2930FIELD averef,         AVE_REF,      unsigned int,   reference to average entry     
    3031
    31 # Pan-STARRS uses a 64-bit detection ID.  keep this in two 32 bit ints for backwards compatibility?
    3232FIELD detID,          DET_ID,       unsigned int,   detection ID
    3333FIELD imageID,        IMAGE_ID,     unsigned int,   reference to DVO image ID
     34FIELD objID,          OBJ_ID,       unsigned int,   unique ID for object in table
     35FIELD catID,          CAT_ID,       unsigned int,   unique ID for table in which object was first realized
     36
     37# PSPS uses a 64-bit detection ID
     38FIELD extID,          EXT_ID,       uint64_t,       external ID (eg PSPS detID)
    3439
    3540# do we need more resolution than a short? should this be a log?
    36 FIELD qPSF,           PSF_QF,       float,          psf coverage/quality factor
     41FIELD psfQual,        PSF_QF,       float,          psf coverage/quality factor
    3742FIELD psfChisq,       PSF_CHISQ,    float,          psf fit chisq
     43FIELD psfNdof,        PSF_NDOF,     int,            psf degrees of freedom
     44FIELD psfNpix,        PSF_NPIX,     int,            psf number of pixels
    3845FIELD crNsigma,       CR_NSIGMA,    float,          Nsigma deviation towards CR
    3946FIELD extNsigma,      EXT_NSIGMA,   float,          Nsigma deviation towards EXT
    4047
    41 FIELD FWx,            FWHM_MAJOR,   short,          object fwhm major axis,       1/100 of arcsec
    42 FIELD FWy,            FWHM_MINOR,   short,          object fwhm minor axis,       1/100 of arcsec
    43 FIELD theta,          PSF_THETA,    short,          angle wrt ccd X dir,          (0xffff/360) deg
     48# model shape parameters
     49FIELD FWx,            FWHM_MAJOR,   short,          object fwhm major axis,         1/100 of pixels
     50FIELD FWy,            FWHM_MINOR,   short,          object fwhm minor axis,         1/100 of pixels
     51FIELD theta,          PSF_THETA,    short,          angle wrt ccd X dir,            (0xffff/360) deg
     52
     53# moments
     54FIELD Mxx,            MXX,          short,          second moments in pixel coords, 1/100 of pixels^2
     55FIELD Mxy,            MXY,          short,          second moments in pixel coords, 1/100 of pixels^2
     56FIELD Myy,            MYY,          short,          second moments in pixel coords, 1/100 of pixels^2
     57
     58# convert this to error in pixels on load?
     59FIELD dXccd,          X_CCD_ERR,    short,          X coord error on chip,          1/100 of pixels
     60FIELD dYccd,          Y_CCD_ERR,    short,          Y coord error on chip,          1/100 of pixels
     61
     62FIELD posangle,       POSANGLE,     short,          position angle sky to chip,     (0xffff/360) deg
     63FIELD pltscale,       PLTSCALE,     float,          plate scale,                    arcsec/pixel
     64
    4465FIELD photcode,       PHOTCODE,     unsigned short, photcode
     66FIELD dbFlags,        DB_FLAGS,     unsigned int,   flags supplied by analysis in database
     67FIELD photFlags,      PHOT_FLAGS,   unsigned int,   flags supplied by photometry program
    4568
    46 # convert this to error in arcsec on load?
    47 FIELD dXccd,          X_CCD_ERR,    short,          X coord error on chip,         pixels
    48 FIELD dYccd,          Y_CCD_ERR,    short,          Y coord error on chip,         pixels
     69# *** 20090206 : new fields : t_msec, extID, Mxx, Mxy, Myy, posangle,
     70#                psfNdof, psfNpix, Map_small; deprecated dophot.
     71#                Changed dbFlags, photFlags : uint16_t to uint64_t
    4972
    50 FIELD dbFlags,        DB_FLAGS,     unsigned short, flags for various uses 
    51 FIELD photFlags,      PHOT_FLAGS,   unsigned short, flags supplied by photometry program
    52 
    53 FIELD stargal,        STAR_GAL,     char,           star-galaxy separator
    54 
    55 # absorb these into photFlags?
    56 FIELD dophot,         DOPHOT,       char,           dophot type
    57 
    58 FIELD dummy,          DUMMY,        char[6],        padding
     73# XXX unsigned int values are probably not being saved in the FITS file correctly: no BZERO, BSCALE
  • trunk/Ohana/src/libautocode/def/secfilt.d

    r12332 r21508  
    22EXTNAME      DVO_SECFILT
    33TYPE         BINTABLE
    4 SIZE         16
     4SIZE         18
    55DESCRIPTION  DVO SecFilt : Secondary Filter Data
    66
     
    1111FIELD  Ncode, NCODE,    short,                number of detections in band
    1212FIELD  Nused, NUSED,    short,                number of detections used in average
    13 FIELD  dummy, JUNK,     short,                place holder
     13FIELD  M_20,  MAG_20,   short,                lower 20percent mag,      millimags
     14FIELD  M_80,  MAG_80,   short,                upper 20percent mag,      millimags
     15
     16# *** 20090206 : new fields : M_20, M_80; dropped dummy
  • trunk/Ohana/src/libautocode/doc/autocode.txt

    r3515 r21508  
     1
     22009.02.07
     3
     4The autocode tables currently use type names which are ambiguous in
     5terms of their actual sizes in bits.  I've added the intNN_t and
     6uintNN_t types -- this requires --use-gnu99 with configure
     7
     8see libdvo/doc/notes.txt for instructions on adding new dvo catalog formats
     9
     102007.00.00
    111
    212This directory contains a collection of autocoded FITS I/O routines
  • trunk/Ohana/src/libautocode/generate

    r7080 r21508  
    114114       
    115115        # rawshort is a short without byteswapping
     116        # rawshort is a patch for old photreg tables
    116117
    117118        $pt1 = 0;
     
    124125        if ($type eq "int")           { $pt1 = "J"; }
    125126        if ($type eq "unsigned int")  { $pt1 = "J"; }
    126         if ($type eq "e_time")        { $pt1 = "J"; }
     127
     128        if ($type eq "int8_t")        { $pt1 = "B"; }
     129        if ($type eq "uint8_t")       { $pt1 = "B"; }
     130        if ($type eq "int16_t")       { $pt1 = "I"; }
     131        if ($type eq "uint16_t")      { $pt1 = "I"; }
     132        if ($type eq "int32_t")       { $pt1 = "J"; }
     133        if ($type eq "uint32_t")      { $pt1 = "J"; }
     134
     135        # FITS tables do not allow for 64bit integers.  we need to
     136        # write these by splitting the value into high and low 32 bit values
     137        if ($type eq "int64_t")       { $pt1 = "J"; $Np = 2*$Np; }
     138        if ($type eq "uint64_t")      { $pt1 = "J"; $Np = 2*$Np; }
     139
    127140        if ($type eq "float")         { $pt1 = "E"; }
    128141        if ($type eq "double")        { $pt1 = "D"; }
    129142
     143        # special 'elixir' types:
     144        if ($type eq "e_time")        { $pt1 = "J"; }
    130145        if ($type eq "e_void")        { $pt1 = "B"; $Np = 8*$Np; }
    131146        # e_void is a 64 bit pointer, cast to size_t.  its value is not loaded
     
    146161        printf FILE "%-20s 1.0, 0.0);\n", "\"$unit[$i]\", ";
    147162    }
    148 
    149163}
    150164
     
    217231        if ($type eq "int")           { $pt1 = sprintf "I%s", $length; }
    218232        if ($type eq "unsigned int")  { $pt1 = sprintf "I%s", $length; }
    219         if ($type eq "e_time")        { $pt1 = sprintf "I%s", $length; }
     233
     234        if ($type eq "int8_t")        { $pt1 = sprintf "I%s", $length; }
     235        if ($type eq "uint8_t")       { $pt1 = sprintf "I%s", $length; }
     236        if ($type eq "int16_t")       { $pt1 = sprintf "I%s", $length; }
     237        if ($type eq "uint16_t")      { $pt1 = sprintf "I%s", $length; }
     238        if ($type eq "int32_t")       { $pt1 = sprintf "I%s", $length; }
     239        if ($type eq "uint32_t")      { $pt1 = sprintf "I%s", $length; }
     240
     241        # FITS tables do not allow for 64bit integers.  we need to
     242        # write these by splitting the value into high and low 32 bit values
     243        if ($type eq "int64_t")       { $pt1 = sprintf "I%s", $length; }
     244        if ($type eq "uint64_t")      { $pt1 = sprintf "I%s", $length; }
     245
    220246        if ($type eq "float")         { $pt1 = sprintf "F%s", $length; }
    221247        if ($type eq "double")        { $pt1 = sprintf "F%s", $length; }
    222248
     249        # special 'elixir' types:
     250        if ($type eq "e_time")        { $pt1 = sprintf "I%s", $length; }
    223251        if ($type eq "e_void")        { $pt1 = sprintf "I%s", $length; }
    224252
     
    283311        if ($type eq "unsigned char") { $N +=   $Np; next; }
    284312        if ($type eq "rawshort")      { $N += 2*$Np; next; }
     313
    285314        if ($type eq "short")         { $T = "BYTE"; $n = 2; }
    286315        if ($type eq "unsigned short"){ $T = "BYTE"; $n = 2; }
    287316        if ($type eq "int")           { $T = "WORD"; $n = 4; }
    288317        if ($type eq "unsigned int")  { $T = "WORD"; $n = 4; }
     318
     319        if ($type eq "int8_t")        { $N +=   $Np; next; }
     320        if ($type eq "uint8_t")       { $N +=   $Np; next; }
     321        if ($type eq "int16_t")       { $T = "BYTE"; $n = 2; }
     322        if ($type eq "uint16_t")      { $T = "BYTE"; $n = 2; }
     323        if ($type eq "int32_t")       { $T = "WORD"; $n = 4; }
     324        if ($type eq "uint32_t")      { $T = "WORD"; $n = 4; }
     325
     326        # FITS tables do not allow for 64bit integers.  we need to
     327        # write these by splitting the value into high and low 32 bit values
     328        if ($type eq "int64_t")       { $T = "WORD"; $n = 4; $Np = 2*$Np; }
     329        if ($type eq "uint64_t")      { $T = "WORD"; $n = 4; $Np = 2*$Np; }
     330
     331        if ($type eq "float")         { $T = "WORD"; $n = 4; }
     332        if ($type eq "double")        { $T = "DBLE"; $n = 8; }
     333
     334        # special 'elixir' types:
    289335        if ($type eq "e_time")        { $T = "WORD"; $n = 4; }
    290336        if ($type eq "e_void")        { $T = "DBLE"; $n = 8; }
    291         if ($type eq "float")         { $T = "WORD"; $n = 4; }
    292         if ($type eq "double")        { $T = "DBLE"; $n = 8; }
     337
    293338        if (!$n) { die "unknown type $type"; }
    294339        for ($j = 0; $j < $Np; $j++) {
     
    318363        if ($type eq "int")            { $Nbytes += 4*$Np; $valid = 1; }
    319364        if ($type eq "unsigned int")   { $Nbytes += 4*$Np; $valid = 1; }
     365
     366        if ($type eq "int8_t")         { $Nbytes += 1*$Np; $valid = 1; }
     367        if ($type eq "uint8_t")        { $Nbytes += 1*$Np; $valid = 1; }
     368        if ($type eq "int16_t")        { $Nbytes += 2*$Np; $valid = 1; }
     369        if ($type eq "uint16_t")       { $Nbytes += 2*$Np; $valid = 1; }
     370        if ($type eq "int32_t")        { $Nbytes += 4*$Np; $valid = 1; }
     371        if ($type eq "uint32_t")       { $Nbytes += 4*$Np; $valid = 1; }
     372
     373        # FITS tables do not allow for 64bit integers.  we need to
     374        # write these by splitting the value into high and low 32 bit values
     375        if ($type eq "int64_t")        { $Nbytes += 8*$Np; $valid = 1; }
     376        if ($type eq "uint64_t")       { $Nbytes += 8*$Np; $valid = 1; }
     377
     378        if ($type eq "float")          { $Nbytes += 4*$Np; $valid = 1; }
     379        if ($type eq "double")         { $Nbytes += 8*$Np; $valid = 1; }
     380
     381        # special 'elixir' types:
    320382        if ($type eq "e_time")         { $Nbytes += 4*$Np; $valid = 1; }
    321383        if ($type eq "e_void")         { $Nbytes += 8*$Np; $valid = 1; }
    322         if ($type eq "float")          { $Nbytes += 4*$Np; $valid = 1; }
    323         if ($type eq "double")         { $Nbytes += 8*$Np; $valid = 1; }
    324384        if (!$valid) { die "unknown type $type"; }
    325385    }
  • trunk/Ohana/src/libdvo/Makefile

    r17419 r21508  
    3131$(DESTINC)/ps1_dev_1_defs.h \
    3232$(DESTINC)/ps1_dev_2_defs.h \
    33 $(DESTINC)/ps1_dev_3_defs.h
     33$(DESTINC)/ps1_dev_3_defs.h \
     34$(DESTINC)/ps1_v1_defs.h
    3435
    3536INCS = $(DEFS) $(DESTINC)/dvo.h $(DESTINC)/autocode.h
     
    6566$(SRC)/dvo_convert_PS1_DEV_2.$(ARCH).o \
    6667$(SRC)/dvo_convert_PS1_DEV_3.$(ARCH).o \
     68$(SRC)/dvo_convert_PS1_V1.$(ARCH).o \
    6769$(SRC)/skyregion_io.$(ARCH).o    \
    6870$(SRC)/skyregion_gsc.$(ARCH).o    \
  • trunk/Ohana/src/libdvo/doc/notes.txt

    r12332 r21508  
    22Adding a new dvo catalog format.  Assume the new format name is 'foo'.
    33
    4 1) create the autocode definition files for average, measure, secfilt, image
    5    these files must be a subset of the internal versions of these same
    6    tables.  if you intend to add fields which don't exist in the
    7    internal tables, you must update the internal tables as well.  the
    8    naming convention is: average-foo.d, etc.
     41) create the autocode definition files for average, measure, secfilt,
     5   image, and photcode.  these files must be a subset of the internal
     6   versions of these same tables.  if you intend to add fields which
     7   don't exist in the internal tables, you must update the internal
     8   tables as well.  the naming convention is: average-foo.d, etc.
    99
    10102) add the new definition files to libautocode/Makefile.Targets (both
     
    2222 (libdvo/src/dvo_catalog.c).  The name should be "FOO".
    2323
    24 6) add entry for structure size in dvo_catalog_load_raw
    25    (libdvo/src/dvo_catalog_raw.c), since this is not available from
    26    the header.
     246) in libdvo/src/dvo_catalog_raw.c, update the FORMAT_CASE lists to
     25   include the new STRUCT name.
    2726
    28 7) add entries in ReadRawAverage, WriteRawAverage, ReadRawMeasure,
    29    WriteRawMeasure, ReadRawSecFilt, WriteRawSecFilt.  Make sure to use
    30    the new STRUCT names. the conversion function gfit_convert_Foo will
    31    be automatically generated.
     277) create a new conversion file dvo_convert_foo.c and define the
     28   internal to Foo conversions.
    3229
    33 8) add entry in WriteRawAverage, making sure to use the new STRUCT
    34    name. the conversion function gfit_convert_Foo will be
    35    automatically generated. 
     308) add the new format to the list of FORMAT conversion in dvo_convert.c.
    3631
    37 9) create a new conversion file dvo_convert_foo.c and define the
    38    internal to Foo conversions.
     329) any changes to the internal format need to be reflected in the
     33   functions in the dvo_convert_*.c files.  These files are defined so
     34   that changed fields are sequential in the functions.  This should
     35   make is easy to identify the new changes needed.
     36
     3710) add the new format to the section at the end of dvo_image.c
     38
     3911) add the new format to the dvo_image_raw.c
     40
     4112) add the photcode format conversions to libdvo/src/LoadPhotcodesFITS.c
     42
     4312) switch the output photcode format conversion ina libdvo/src/SavePhotcodesFITS.c
     44
     4513) Add the conversion functions to the header file libdvo/include/foo_defs.h
    3946
    4047* Note some esoteric format issues: 
     
    5461    keywords.
    5562
     63----
     64
     6520090207 : adding PS1_V1
     66
     67measure:
     68 new fields : t_msec, extID, Mxx, Mxy, Myy, dTccd; deprecated dophot
     69 dbFlags, photFlags : uint16_t to uint64_t
     70
     71average:
     72 new fields : ChiSq, Npos, flags (was code, uint16_t), extID
     73
     74secfilt:
     75 new fields : M_20, M_80; dropped dummy
     76
     77image:
     78 new fields : parentID, flags (was code char), changed name to 121 bytes.
     79
     80photcode:
     81 new fields : NONE
     82
     83** parentID was added to enable easy lookups from chip->fpa for mosaic
     84   astrometry.  In old databases, this conversion was done by making
     85   the match via the time and photcode.  This conversion needs to be
     86   done on load...
  • trunk/Ohana/src/libdvo/include/dvo.h

    r21153 r21508  
    1818              DVO_FORMAT_PS1_DEV_1,
    1919              DVO_FORMAT_PS1_DEV_2,
    20               DVO_FORMAT_PS1_DEV_3
     20              DVO_FORMAT_PS1_DEV_3,
     21              DVO_FORMAT_PS1_V1
    2122} DVOTableFormat;
    2223
     
    407408# include "ps1_dev_2_defs.h"
    408409# include "ps1_dev_3_defs.h"
     410# include "ps1_v1_defs.h"
    409411
    410412/*** DVO image db I/O Functions ***/
     
    444446void sort_image_subset (Image *image, int *subset, int N);
    445447void sort_coords_index (double *X, double *Y, int *S, int N);
    446 void sort_stars_ra (Stars *stars, int N);
    447448void sort_regions (SkyRegion *region, int N);
    448449
  • trunk/Ohana/src/libdvo/src/LoadPhotcodesFITS.c

    r17190 r21508  
    4040  gfits_scan (&db.theader, "EXTNAME", "%s", 1, extname);
    4141
    42   if (!strcmp (extname, "DVO_PHOTCODE") || !strcmp (extname, "DVO_PHOTCODE_ELIXIR")) {
     42  if (!strcmp (extname, "DVO_PHOTCODE")) {
     43    PhotCode_Elixir *photcode_elixir = gfits_table_get_PhotCode_Elixir (&db.ftable, &Ncode, &db.swapped);
     44    photcode = PhotCode_Elixir_To_Internal (photcode_elixir, Ncode);
     45    free (photcode_elixir);
     46  }
     47
     48  if (!strcmp (extname, "DVO_PHOTCODE_ELIXIR")) {
    4349    PhotCode_Elixir *photcode_elixir = gfits_table_get_PhotCode_Elixir (&db.ftable, &Ncode, &db.swapped);
    4450    photcode = PhotCode_Elixir_To_Internal (photcode_elixir, Ncode);
     
    6268    photcode = PhotCode_PS1_DEV_3_To_Internal (photcode_ps1_dev_3, Ncode);
    6369    free (photcode_ps1_dev_3);
     70  }
     71
     72  if (!strcmp (extname, "DVO_PHOTCODE_PS1_V1")) {
     73    PhotCode_PS1_V1 *photcode_ps1_v1 = gfits_table_get_PhotCode_PS1_V1 (&db.ftable, &Ncode, &db.swapped);
     74    photcode = PhotCode_PS1_V1_To_Internal (photcode_ps1_v1, Ncode);
     75    free (photcode_ps1_v1);
    6476  }
    6577
  • trunk/Ohana/src/libdvo/src/SavePhotcodesFITS.c

    r17190 r21508  
    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_3 *photcode_output = PhotCode_Internal_To_PS1_DEV_3 (table[0].code, table[0].Ncode);
     31  PhotCode_PS1_V1 *photcode_output = PhotCode_Internal_To_PS1_V1 (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_3 (&db.ftable, photcode_output, table[0].Ncode);
     35  gfits_table_set_PhotCode_PS1_V1 (&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

    r20981 r21508  
    5252  if (!strcasecmp (catformat, "PS1_DEV_1"))       return (DVO_FORMAT_PS1_DEV_1);
    5353  if (!strcasecmp (catformat, "PS1_DEV_2"))       return (DVO_FORMAT_PS1_DEV_2);
     54  if (!strcasecmp (catformat, "PS1_V1"))          return (DVO_FORMAT_PS1_V1);
    5455  return (DVO_FORMAT_UNDEF);
    5556}
  • trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c

    r20982 r21508  
    8686      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
    8787      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
     88      FORMAT_CASE (PS1_V1,    PS1_V1);
    8889
    8990    default:
     
    271272  if (catalog[0].catformat == DVO_FORMAT_PS1_DEV_1)       gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_DEV_1");
    272273  if (catalog[0].catformat == DVO_FORMAT_PS1_DEV_2)       gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_DEV_2");
     274  if (catalog[0].catformat == DVO_FORMAT_PS1_V1)          gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_V1");
    273275
    274276  /* rewind file pointers and truncate file */
     
    366368      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
    367369      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
     370      FORMAT_CASE (PS1_V1,    PS1_V1);
    368371
    369372    default:
     
    412415      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
    413416      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
     417      FORMAT_CASE (PS1_V1,    PS1_V1);
    414418
    415419    default:
     
    462466      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
    463467      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
     468      FORMAT_CASE (PS1_V1,    PS1_V1);
    464469
    465470    default:
     
    508513      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
    509514      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
     515      FORMAT_CASE (PS1_V1,    PS1_V1);
    510516
    511517    default:
     
    558564      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
    559565      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
     566      FORMAT_CASE (PS1_V1,    PS1_V1);
    560567
    561568    default:
     
    604611      FORMAT_CASE (PS1_DEV_1, PS1_DEV_1);
    605612      FORMAT_CASE (PS1_DEV_2, PS1_DEV_2);
     613      FORMAT_CASE (PS1_V1,    PS1_V1);
    606614
    607615    default:
  • trunk/Ohana/src/libdvo/src/dvo_convert.c

    r19185 r21508  
    4949  CONVERT_FORMAT ("DVO_AVERAGE_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
    5050  CONVERT_FORMAT ("DVO_AVERAGE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
     51  CONVERT_FORMAT ("DVO_AVERAGE_PS1_V1",          PS1_V1,          PS1_V1);
    5152# undef CONVERT_FORMAT
    5253
     
    7980      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
    8081      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
     82      FORMAT_CASE (PS1_V1,          PS1_V1);
    8183# undef FORMAT_CASE
    8284
     
    122124  CONVERT_FORMAT ("DVO_MEASURE_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
    123125  CONVERT_FORMAT ("DVO_MEASURE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
     126  CONVERT_FORMAT ("DVO_MEASURE_PS1_V1",          PS1_V1,          PS1_V1);
    124127# undef CONVERT_FORMAT
    125128
     
    152155      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
    153156      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
     157      FORMAT_CASE (PS1_V1,          PS1_V1);
    154158# undef FORMAT_CASE
    155159
     
    195199  CONVERT_FORMAT ("DVO_SECFILT_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
    196200  CONVERT_FORMAT ("DVO_SECFILT_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
     201  CONVERT_FORMAT ("DVO_SECFILT_PS1_V1",          PS1_V1,          PS1_V1);
    197202# undef CONVERT_FORMAT
    198203
     
    225230      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
    226231      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
     232      FORMAT_CASE (PS1_V1,          PS1_V1);
    227233# undef FORMAT_CASE
    228234
     
    288294  CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
    289295  CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
    290   CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_3",       PS1_DEV_3,       PS1_DEV_3);
     296  CONVERT_FORMAT ("DVO_IMAGE_PS1_V1",          PS1_V1,          PS1_V1);
     297
     298  // XXX Not sure this was ever actually used -- it was not complete...
     299  // CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_3",       PS1_DEV_3,       PS1_DEV_3);
     300
    291301# undef CONVERT_FORMAT
    292302
     
    322332      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
    323333      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
    324       FORMAT_CASE (PS1_DEV_3,       PS1_DEV_3);
     334      FORMAT_CASE (PS1_V1,          PS1_V1);
     335
     336      // XXX not sure this was actually used: it was incomplete
     337      // FORMAT_CASE (PS1_DEV_3,       PS1_DEV_3);
    325338# undef FORMAT_CASE
    326339
     
    372385      FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
    373386      FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
    374       FORMAT_CASE (PS1_DEV_3,       PS1_DEV_3);
     387      FORMAT_CASE (PS1_V1,          PS1_V1);
     388
     389      // XXX not sure this was used, it was incomplete
     390      // FORMAT_CASE (PS1_DEV_3,       PS1_DEV_3);
     391
    375392# undef FORMAT_CASE
    376393
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c

    r19185 r21508  
    1515    out[i].M          = in[i].M;
    1616    out[i].Mcal       = in[i].Mcal;
    17     out[i].Map        = in[i].Mgal;
    1817    out[i].dM         = in[i].dM;
    1918    out[i].dt         = in[i].dt;
     
    2827    out[i].detID      = in[i].detID;
    2928    out[i].imageID    = in[i].imageID;
    30     out[i].qPSF       = in[i].qPSF;
     29    out[i].psfQual    = in[i].psfQual;
    3130    out[i].psfChisq   = in[i].psfChisq;
    3231    out[i].crNsigma   = in[i].crNsigma;
     
    4039    out[i].dbFlags    = in[i].dbFlags;
    4140    out[i].photFlags  = in[i].photFlags;
    42     out[i].stargal    = in[i].stargal;
    43     out[i].dophot     = in[i].dophot;
     41
     42    // changed or added for PS1_DEV_2
     43    out[i].Map        = in[i].Mgal;
     44    out[i].dMcal      = 0;
     45
     46    // changed or added for PS1_V1
     47    out[i].photFlags  = in[i].photFlags | (in[i].dophot << 16);
     48    out[i].t_msec     = 0;
     49    out[i].extID      = 0;
     50    out[i].objID      = 0;
     51    out[i].catID      = 0;
     52    out[i].Mxx        = 0.0;
     53    out[i].Mxy        = 0.0;
     54    out[i].Myy        = 0.0;
     55    out[i].posangle   = 0;
     56    out[i].pltscale   = 0;
     57    out[i].psfNdof    = 0;
     58    out[i].psfNpix    = 0;
    4459  }
    4560  return (out);
     
    5873    out[i].M          = in[i].M;
    5974    out[i].Mcal       = in[i].Mcal;
    60     out[i].Mgal       = in[i].Map;
    6175    out[i].dM         = in[i].dM;
    6276    out[i].dt         = in[i].dt;
     
    7185    out[i].detID      = in[i].detID;
    7286    out[i].imageID    = in[i].imageID;
    73     out[i].qPSF       = in[i].qPSF;
     87    out[i].psfQual    = in[i].psfQual;
    7488    out[i].psfChisq   = in[i].psfChisq;
    7589    out[i].crNsigma   = in[i].crNsigma;
     
    8296    out[i].dYccd      = in[i].dYccd;
    8397    out[i].dbFlags    = in[i].dbFlags;
    84     out[i].photFlags  = in[i].photFlags;
    85     out[i].stargal    = in[i].stargal;
    86     out[i].dophot     = in[i].dophot;
     98
     99    // changed or added for PS1_DEV_2
     100    out[i].Mgal       = in[i].Map;
     101
     102    // changed or added for PS1_V1
     103    out[i].photFlags  = in[i].photFlags & 0x0000ffff;
     104    out[i].dophot     = in[i].photFlags >> 16;
    87105  }
    88106  return (out);
     
    101119    out[i].D             = in[i].D;     
    102120    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;
    108121    out[i].dR            = in[i].dR;
    109122    out[i].dD            = in[i].dD;
     
    116129    out[i].objID         = in[i].objID;
    117130    out[i].catID         = in[i].catID;
     131
     132    // changed or added for PS1_DEV_2
     133    out[i].Nmeasure      = in[i].Nm;     
     134    out[i].Nmissing      = in[i].Nn;     
     135    out[i].measureOffset = in[i].offset;
     136    out[i].missingOffset = in[i].missing;
     137    out[i].Nextend       = 0;
     138    out[i].extendOffset  = 0;
     139
     140    // changed or added for PS1_V1
     141    out[i].flags         = in[i].code;   
     142    out[i].ChiSq         = 0.0;
     143    out[i].Npos          = 0.0;
     144    out[i].extID         = 0;
    118145  }
    119146  return (out);
     
    129156
    130157  for (i = 0; i < Nvalues; i++) {
    131     out[i].R        = in[i].R;     
    132     out[i].D        = in[i].D;     
    133     out[i].Xp       = in[i].Xp;     
    134     out[i].Nm       = in[i].Nmeasure;     
    135     out[i].Nn       = in[i].Nmissing;     
    136     out[i].code     = in[i].code;   
    137     out[i].offset   = in[i].measureOffset;
    138     out[i].missing  = in[i].missingOffset;
    139     out[i].dR       = in[i].dR;
    140     out[i].dD       = in[i].dD;
    141     out[i].uR       = in[i].uR;
    142     out[i].uD       = in[i].uD;
    143     out[i].duR      = in[i].duR;
    144     out[i].duD      = in[i].duD;
    145     out[i].P        = in[i].P;
    146     out[i].dP       = in[i].dP;
    147     out[i].objID    = in[i].objID;
    148     out[i].catID    = in[i].catID;
     158    out[i].R             = in[i].R;     
     159    out[i].D             = in[i].D;     
     160    out[i].Xp            = in[i].Xp;     
     161    out[i].dR            = in[i].dR;
     162    out[i].dD            = in[i].dD;
     163    out[i].uR            = in[i].uR;
     164    out[i].uD            = in[i].uD;
     165    out[i].duR           = in[i].duR;
     166    out[i].duD           = in[i].duD;
     167    out[i].P             = in[i].P;
     168    out[i].dP            = in[i].dP;
     169    out[i].objID         = in[i].objID;
     170    out[i].catID         = in[i].catID;
     171
     172    // changed or added for PS1_DEV_2
     173    out[i].Nm            = in[i].Nmeasure;     
     174    out[i].Nn            = in[i].Nmissing;     
     175    out[i].offset        = in[i].measureOffset;
     176    out[i].missing       = in[i].missingOffset;
     177
     178    // changed or added for PS1_V1
     179    out[i].code          = in[i].flags;   
    149180  }
    150181  return (out);
     
    164195    out[i].Ncode = in[i].Ncode;
    165196    out[i].Nused = in[i].Nused;
     197
     198    // changed or added for PS1_V1
     199    out[i].M_20  = 0;     
     200    out[i].M_80  = 0;     
    166201 }
    167202  return (out);
     
    218253    out[i].fwhm_y           = in[i].fwhm_y;
    219254    out[i].trate            = in[i].trate;
    220     out[i].code             = in[i].code;
    221255    out[i].ccdnum           = in[i].ccdnum;
    222256    out[i].imageID          = in[i].imageID;
     
    237271    out[i].Mxyyy            = in[i].Mxyyy;
    238272    out[i].Myyyy            = in[i].Myyyy;
     273
     274    // changed or added for PS1_DEV_2
     275    out[i].externID         = 0;
     276    out[i].sourceID         = 0;
     277
     278    // changed or added for PS1_V1
     279    out[i].flags            = in[i].code;
     280    out[i].parentID         = 0;
    239281  }
    240282  return (out);
     
    275317    out[i].fwhm_y           = in[i].fwhm_y;
    276318    out[i].trate            = in[i].trate;
    277     out[i].code             = in[i].code;
    278319    out[i].ccdnum           = in[i].ccdnum;
    279320    out[i].imageID          = in[i].imageID;
     
    294335    out[i].Mxyyy            = in[i].Mxyyy;
    295336    out[i].Myyyy            = in[i].Myyyy;
     337
     338    // changed or added for PS1_V1
     339    out[i].code             = in[i].flags;
     340  }
     341  return (out);
     342}
     343
     344PhotCode *PhotCode_PS1_DEV_1_To_Internal (PhotCode_PS1_DEV_1 *in, int Nvalues) {
     345
     346  int i;
     347  PhotCode *out;
     348
     349  ALLOCATE (out, PhotCode, Nvalues);
     350
     351  for (i = 0; i < Nvalues; i++) {
     352    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
     353    out[i].name[31] = 0; // force termination
     354
     355    out[i].code  = in[i].code;         
     356    out[i].type  = in[i].type;         
     357    out[i].C     = in[i].C;           
     358    out[i].dC    = in[i].dC;           
     359    out[i].dX    = in[i].dX;           
     360    out[i].K     = in[i].K;           
     361    out[i].c1    = in[i].c1;           
     362    out[i].c2    = in[i].c2;           
     363    out[i].equiv = in[i].equiv;       
     364    out[i].Nc    = in[i].Nc;           
     365    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
     366
     367    out[i].astromErrMagScale = in[i].astromErrMagScale;
     368    out[i].photomErrSys      = in[i].photomErrSys;
     369
     370    // changed or added for PS1_DEV_2
     371    out[i].astromErrSys      = 0.0;
     372    out[i].astromErrScale    = 0.0;
     373
     374    // changed or added for PS1_V1 (also PS1_DEV_3, deprecated)
     375    out[i].photomPoorMask      = 0;
     376    out[i].photomBadMask       = 0;
     377    out[i].astromPoorMask      = 0;
     378    out[i].astromBadMask       = 0;
    296379  }
    297380  return (out);
     
    323406    out[i].astromErrMagScale = out[i].astromErrMagScale;
    324407    out[i].photomErrSys      = out[i].photomErrSys;
    325 
    326   }
    327   return (out);
    328 }
    329 
    330 PhotCode *PhotCode_PS1_DEV_1_To_Internal (PhotCode_PS1_DEV_1 *in, int Nvalues) {
    331 
    332   int i;
    333   PhotCode *out;
    334 
    335   ALLOCATE (out, PhotCode, Nvalues);
    336 
    337   for (i = 0; i < Nvalues; i++) {
    338     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    339     out[i].name[31] = 0; // force termination
    340 
    341     out[i].code  = in[i].code;         
    342     out[i].type  = in[i].type;         
    343     out[i].C     = in[i].C;           
    344     out[i].dC    = in[i].dC;           
    345     out[i].dX    = in[i].dX;           
    346     out[i].K     = in[i].K;           
    347     out[i].c1    = in[i].c1;           
    348     out[i].c2    = in[i].c2;           
    349     out[i].equiv = in[i].equiv;       
    350     out[i].Nc    = in[i].Nc;           
    351 
    352     // not defined in PS1_DEV_1
    353     out[i].astromErrSys      = 0.0;
    354     out[i].astromErrScale    = 0.0;
    355     out[i].astromErrMagScale = in[i].astromErrMagScale;
    356     out[i].photomErrSys      = in[i].photomErrSys;
    357 
    358     memcpy (out[i].X, in[i].X, 4*sizeof(float));           
    359 
    360     out[i].photomPoorMask      = 0;
    361     out[i].photomBadMask       = 0;
    362     out[i].astromPoorMask      = 0;
    363     out[i].astromBadMask       = 0;
    364   }
    365   return (out);
    366 }
     408  }
     409  return (out);
     410}
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c

    r19185 r21508  
    2929    out[i].detID      = in[i].detID;
    3030    out[i].imageID    = in[i].imageID;
    31     out[i].qPSF       = in[i].qPSF;
     31    out[i].psfQual    = in[i].psfQual;
    3232    out[i].psfChisq   = in[i].psfChisq;
    3333    out[i].crNsigma   = in[i].crNsigma;
     
    4040    out[i].dYccd      = in[i].dYccd;
    4141    out[i].dbFlags    = in[i].dbFlags;
    42     out[i].photFlags  = in[i].photFlags;
    43     out[i].stargal    = in[i].stargal;
    44     out[i].dophot     = in[i].dophot;
     42
     43    // changed or added for PS1_V1
     44    out[i].photFlags  = in[i].photFlags | (in[i].dophot << 16);
     45    out[i].t_msec     = 0;
     46    out[i].extID      = 0;
     47    out[i].objID      = 0;
     48    out[i].catID      = 0;
     49    out[i].Mxx        = 0.0;
     50    out[i].Mxy        = 0.0;
     51    out[i].Myy        = 0.0;
     52    out[i].posangle   = 0;
     53    out[i].pltscale   = 0;
     54    out[i].psfNdof    = 0;
     55    out[i].psfNpix    = 0;
    4556  }
    4657  return (out);
     
    7384    out[i].detID      = in[i].detID;
    7485    out[i].imageID    = in[i].imageID;
    75     out[i].qPSF       = in[i].qPSF;
     86    out[i].psfQual    = in[i].psfQual;
    7687    out[i].psfChisq   = in[i].psfChisq;
    7788    out[i].crNsigma   = in[i].crNsigma;
     
    8495    out[i].dYccd      = in[i].dYccd;
    8596    out[i].dbFlags    = in[i].dbFlags;
    86     out[i].photFlags  = in[i].photFlags;
    87     out[i].stargal    = in[i].stargal;
    88     out[i].dophot     = in[i].dophot;
     97
     98    // changed or added for PS1_V1
     99    out[i].photFlags  = in[i].photFlags & 0x0000ffff;
     100    out[i].dophot     = in[i].photFlags >> 16;
    89101  }
    90102  return (out);
     
    114126    out[i].Nmissing      = in[i].Nmissing;     
    115127    out[i].Nextend       = in[i].Nextend;     
    116     out[i].code          = in[i].code;   
    117128    out[i].measureOffset = in[i].measureOffset;
    118129    out[i].missingOffset = in[i].missingOffset;
     
    120131    out[i].objID         = in[i].objID;
    121132    out[i].catID         = in[i].catID;
     133
     134    // changed or added for PS1_V1
     135    out[i].flags         = in[i].code;   
     136    out[i].ChiSq         = 0.0;
     137    out[i].Npos          = 0.0;
     138    out[i].extID         = 0;
    122139  }
    123140  return (out);
     
    147164    out[i].Nmissing      = in[i].Nmissing;     
    148165    out[i].Nextend       = in[i].Nextend;     
    149     out[i].code          = in[i].code;   
    150166    out[i].measureOffset = in[i].measureOffset;
    151167    out[i].missingOffset = in[i].missingOffset;
     
    153169    out[i].objID         = in[i].objID;
    154170    out[i].catID         = in[i].catID;
     171
     172    // changed or added for PS1_V1
     173    out[i].code          = in[i].flags;   
    155174  }
    156175  return (out);
     
    170189    out[i].Ncode = in[i].Ncode;
    171190    out[i].Nused = in[i].Nused;
     191
     192    // changed or added for PS1_V1
     193    out[i].M_20  = 0;     
     194    out[i].M_80  = 0;     
    172195 }
    173196  return (out);
     
    201224    memcpy (&out[i].coords, &in[i].coords, sizeof(Coords));
    202225
    203     strncpy (out[i].name, in[i].name, 63); // out[128], int[64]
     226    strncpy (out[i].name, in[i].name, 63); // out[121], int[64]
    204227    out[i].name[63] = 0; // force termination
    205228
     
    224247    out[i].fwhm_y           = in[i].fwhm_y;
    225248    out[i].trate            = in[i].trate;
    226     out[i].code             = in[i].code;
    227249    out[i].ccdnum           = in[i].ccdnum;
    228250    out[i].imageID          = in[i].imageID;
     
    245267    out[i].Mxyyy            = in[i].Mxyyy;
    246268    out[i].Myyyy            = in[i].Myyyy;
     269
     270    // changed or added for PS1_V1
     271    out[i].flags            = in[i].code;
     272    out[i].parentID         = 0;
    247273  }
    248274  return (out);
     
    259285    memcpy (&out[i].coords, &in[i].coords, sizeof(Coords));
    260286
    261     strncpy (out[i].name, in[i].name, 63); // in[128], out[64]
     287    strncpy (out[i].name, in[i].name, 63); // in[121], out[64]
    262288    out[i].name[63] = 0; // force termination
    263289
     
    282308    out[i].fwhm_y           = in[i].fwhm_y;
    283309    out[i].trate            = in[i].trate;
    284     out[i].code             = in[i].code;
    285310    out[i].ccdnum           = in[i].ccdnum;
    286311    out[i].imageID          = in[i].imageID;
     
    303328    out[i].Mxyyy            = in[i].Mxyyy;
    304329    out[i].Myyyy            = in[i].Myyyy;
    305   }
    306   return (out);
    307 }
    308 
    309 PhotCode_PS1_DEV_2 *PhotCode_Internal_To_PS1_DEV_2 (PhotCode *in, int Nvalues) {
    310 
    311   int i;
    312   PhotCode_PS1_DEV_2 *out;
    313 
    314   ALLOCATE (out, PhotCode_PS1_DEV_2, Nvalues);
     330
     331    // changed or added for PS1_V1
     332    out[i].code             = in[i].flags;
     333  }
     334  return (out);
     335}
     336
     337PhotCode *PhotCode_PS1_DEV_2_To_Internal (PhotCode_PS1_DEV_2 *in, int Nvalues) {
     338
     339  int i;
     340  PhotCode *out;
     341
     342  ALLOCATE (out, PhotCode, Nvalues);
    315343
    316344  for (i = 0; i < Nvalues; i++) {
     
    334362    out[i].astromErrMagScale = in[i].astromErrMagScale;
    335363    out[i].photomErrSys      = in[i].photomErrSys;
    336   }
    337   return (out);
    338 }
    339 
    340 PhotCode *PhotCode_PS1_DEV_2_To_Internal (PhotCode_PS1_DEV_2 *in, int Nvalues) {
    341 
    342   int i;
    343   PhotCode *out;
    344 
    345   ALLOCATE (out, PhotCode, Nvalues);
     364
     365    // changed or added for PS1_V1 (also PS1_DEV_3, deprecated)
     366    out[i].photomPoorMask      = 0;
     367    out[i].photomBadMask       = 0;
     368    out[i].astromPoorMask      = 0;
     369    out[i].astromBadMask       = 0;
     370  }
     371  return (out);
     372}
     373
     374PhotCode_PS1_DEV_2 *PhotCode_Internal_To_PS1_DEV_2 (PhotCode *in, int Nvalues) {
     375
     376  int i;
     377  PhotCode_PS1_DEV_2 *out;
     378
     379  ALLOCATE (out, PhotCode_PS1_DEV_2, Nvalues);
    346380
    347381  for (i = 0; i < Nvalues; i++) {
     
    365399    out[i].astromErrMagScale = in[i].astromErrMagScale;
    366400    out[i].photomErrSys      = in[i].photomErrSys;
    367 
    368     out[i].photomPoorMask      = 0;
    369     out[i].photomBadMask       = 0;
    370     out[i].astromPoorMask      = 0;
    371     out[i].astromBadMask       = 0;
    372   }
    373   return (out);
    374 }
     401  }
     402  return (out);
     403}
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_3.c

    r19185 r21508  
    33/* convert PS1_DEV_3 formats to internal formats */
    44
    5 // XXX EAM I am not yet ready to commit to a full PS1_DEV_3 release, but I am providing image and photcode conversion
     5// We only provide image and photcode conversion
    66
    77Image *Image_PS1_DEV_3_ToInternal (Image_PS1_DEV_3 *in, int Nvalues) {
     
    3838    out[i].fwhm_y           = in[i].fwhm_y;
    3939    out[i].trate            = in[i].trate;
    40     out[i].code             = in[i].code;
    4140    out[i].ccdnum           = in[i].ccdnum;
    4241    out[i].imageID          = in[i].imageID;
     
    5958    out[i].Mxyyy            = in[i].Mxyyy;
    6059    out[i].Myyyy            = in[i].Myyyy;
     60
     61    // changed or added for PS1_V1
     62    out[i].flags            = in[i].code;
     63    out[i].parentID         = 0;
    6164  }
    6265  return (out);
     
    9699    out[i].fwhm_y           = in[i].fwhm_y;
    97100    out[i].trate            = in[i].trate;
    98     out[i].code             = in[i].code;
    99101    out[i].ccdnum           = in[i].ccdnum;
    100102    out[i].imageID          = in[i].imageID;
     
    117119    out[i].Mxyyy            = in[i].Mxyyy;
    118120    out[i].Myyyy            = in[i].Myyyy;
     121
     122    // changed or added for PS1_V1
     123    out[i].code             = in[i].flags;
     124  }
     125  return (out);
     126}
     127
     128PhotCode *PhotCode_PS1_DEV_3_To_Internal (PhotCode_PS1_DEV_3 *in, int Nvalues) {
     129
     130  int i;
     131  PhotCode *out;
     132
     133  ALLOCATE (out, PhotCode, Nvalues);
     134
     135  for (i = 0; i < Nvalues; i++) {
     136    strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
     137    out[i].name[31] = 0; // force termination
     138
     139    out[i].code  = in[i].code;         
     140    out[i].type  = in[i].type;         
     141    out[i].C     = in[i].C;           
     142    out[i].dC    = in[i].dC;           
     143    out[i].dX    = in[i].dX;           
     144    out[i].K     = in[i].K;           
     145    out[i].c1    = in[i].c1;           
     146    out[i].c2    = in[i].c2;           
     147    out[i].equiv = in[i].equiv;       
     148    out[i].Nc    = in[i].Nc;           
     149    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
     150
     151    out[i].astromErrSys      = in[i].astromErrSys;
     152    out[i].astromErrScale    = in[i].astromErrScale;
     153    out[i].astromErrMagScale = in[i].astromErrMagScale;
     154    out[i].photomErrSys      = in[i].photomErrSys;
     155
     156    out[i].photomPoorMask      = in[i].photomPoorMask;
     157    out[i].photomBadMask       = in[i].photomBadMask;
     158    out[i].astromPoorMask      = in[i].astromPoorMask;
     159    out[i].astromBadMask       = in[i].astromBadMask;
    119160  }
    120161  return (out);
     
    157198}
    158199
    159 PhotCode *PhotCode_PS1_DEV_3_To_Internal (PhotCode_PS1_DEV_3 *in, int Nvalues) {
    160 
    161   int i;
    162   PhotCode *out;
    163 
    164   ALLOCATE (out, PhotCode, Nvalues);
    165 
    166   for (i = 0; i < Nvalues; i++) {
    167     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    168     out[i].name[31] = 0; // force termination
    169 
    170     out[i].code  = in[i].code;         
    171     out[i].type  = in[i].type;         
    172     out[i].C     = in[i].C;           
    173     out[i].dC    = in[i].dC;           
    174     out[i].dX    = in[i].dX;           
    175     out[i].K     = in[i].K;           
    176     out[i].c1    = in[i].c1;           
    177     out[i].c2    = in[i].c2;           
    178     out[i].equiv = in[i].equiv;       
    179     out[i].Nc    = in[i].Nc;           
    180     memcpy (out[i].X, in[i].X, 4*sizeof(float));           
    181 
    182     out[i].astromErrSys      = in[i].astromErrSys;
    183     out[i].astromErrScale    = in[i].astromErrScale;
    184     out[i].astromErrMagScale = in[i].astromErrMagScale;
    185     out[i].photomErrSys      = in[i].photomErrSys;
    186 
    187     out[i].photomPoorMask      = in[i].photomPoorMask;
    188     out[i].photomBadMask       = in[i].photomBadMask;
    189     out[i].astromPoorMask      = in[i].astromPoorMask;
    190     out[i].astromBadMask       = in[i].astromBadMask;
    191   }
    192   return (out);
    193 }
  • trunk/Ohana/src/libdvo/src/dvo_convert_elixir.c

    r19185 r21508  
    1010
    1111  for (i = 0; i < Nvalues; i++) {
     12    out[i].FWx      = in[i].FWx;
     13    out[i].t        = in[i].t;
     14    out[i].averef   = in[i].averef;
     15
     16    // changed for PANSTARRS_DEV_0
    1217    out[i].dR       = (in[i].dR      == NAN_S_SHORT) ? NAN : in[i].dR     * 0.01;
    1318    out[i].dD       = (in[i].dD      == NAN_S_SHORT) ? NAN : in[i].dD     * 0.01;
     
    1621    out[i].dt       = (in[i].dt      == NAN_S_SHORT) ? NAN : in[i].dt     * 0.001;
    1722    out[i].Mcal     = (in[i].Mcal    == NAN_S_SHORT) ? NAN : in[i].Mcal   * 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
    2123    out[i].Map      = (in[i].Mgal    == NAN_S_SHORT) ? NAN : in[i].Mgal   * 0.001;
    2224    out[i].airmass  = (in[i].airmass == NAN_S_SHORT) ? NAN : in[i].airmass* 0.001;
    23     out[i].FWx      = in[i].FWx;
    2425    out[i].FWy      = in[i].fwy * in[i].FWx * 0.01;
    2526    out[i].theta    = in[i].theta*(0x10000 / 0x100);
    26     out[i].dophot   = in[i].dophot;
    2727    out[i].photcode = in[i].source;
    28     out[i].t        = in[i].t;
    29     out[i].averef   = in[i].averef;
    30     out[i].dbFlags  = in[i].flags;
    3128   
    32     /* these can be determined if needed / desired */
    33     out[i].Xccd     = 0;
    34     out[i].Yccd     = 0;
    35     out[i].dXccd    = 0;
    36     out[i].dYccd    = 0;
    37 
    38     /* these do not have a corresponding value */
     29    // added for PANSTARRS_DEV_0
     30    out[i].Xccd      = 0;  // determine on-the-fly
     31    out[i].Yccd      = 0;  // determine on-the-fly
     32    out[i].dXccd     = 0;
     33    out[i].dYccd     = 0;
    3934    out[i].az        = 0;
    40     out[i].stargal   = 0;
    4135    out[i].Sky       = 0;
    4236    out[i].dSky      = 0;
    43     out[i].qPSF      = 0;
     37    out[i].psfQual   = 0;
    4438    out[i].psfChisq  = 0;
    4539    out[i].crNsigma  = 0;
    4640    out[i].extNsigma = 0;
    47     out[i].photFlags = 0;
    48 
    49     /* XXX add these later */
    50     out[i].detID = 0;
    51     out[i].imageID = 0;
     41    out[i].detID     = 0;  // determine on-the-fly
     42    out[i].imageID   = 0;  // determine on-the-fly
     43
     44    // changed or added for PS1_DEV_1 (2008.02.26)
     45    out[i].dbFlags    = in[i].flags;
     46    out[i].detID      = 0;
     47    out[i].imageID    = 0;
     48
     49    // changed or added for PS1_DEV_2
     50    out[i].Map        = in[i].Mgal;
     51    out[i].dMcal      = 0;
     52
     53    // changed or added for PS1_V1
     54    out[i].photFlags  = in[i].dophot << 16;
     55    out[i].t_msec     = 0;
     56    out[i].extID      = 0;
     57    out[i].objID      = 0;
     58    out[i].catID      = 0;
     59    out[i].Mxx        = 0.0;
     60    out[i].Mxy        = 0.0;
     61    out[i].Myy        = 0.0;
     62    out[i].posangle   = 0;
     63    out[i].pltscale   = 0;
     64    out[i].psfNdof    = 0;
     65    out[i].psfNpix    = 0;
    5266  }
    5367  return (out);
     
    6377
    6478  for (i = 0; i < Nvalues; i++) {
     79    out[i].FWx     = in[i].FWx;
     80    out[i].t       = in[i].t;
     81    out[i].averef  = in[i].averef;
     82
     83    // changed for PANSTARRS_DEV_0
    6584    out[i].dR       = isnan(in[i].dR     ) ? NAN_S_SHORT : in[i].dR      *  100.0;
    6685    out[i].dD       = isnan(in[i].dD     ) ? NAN_S_SHORT : in[i].dD      *  100.0;
     
    7190    out[i].Mgal     = isnan(in[i].Map    ) ? NAN_S_SHORT : in[i].Map     * 1000.0;
    7291    out[i].airmass  = isnan(in[i].airmass) ? NAN_S_SHORT : in[i].airmass * 1000.0;
     92    out[i].fwy      = in[i].FWy * 100.0 / in[i].FWx;
     93    out[i].theta    = in[i].theta*(0x100/ 0x10000);
     94    out[i].source   = in[i].photcode;
    7395
    7496    if (out[i].M < 0) {
     
    7698    }
    7799
    78     out[i].FWx     = in[i].FWx;
    79     out[i].fwy     = in[i].FWy * 100.0 / in[i].FWx;
    80     out[i].theta   = in[i].theta*(0x100/ 0x10000);
    81     out[i].dophot  = in[i].dophot;
    82     out[i].source  = in[i].photcode;
    83     out[i].t       = in[i].t;
    84     out[i].averef  = in[i].averef;
     100    // changed or added for PS1_DEV_1 (2008.02.26)
    85101    out[i].flags   = in[i].dbFlags;
     102
     103    // changed or added for PS1_V1
     104    out[i].dophot  = in[i].photFlags >> 16;
    86105  }
    87106  return (out);
     
    101120    out[i].D             = in[i].D;     
    102121    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 
    109     /* these don't exist in Elixir */
     122
     123    // changed for PANSTARRS_DEV_0 (moved from Average to Measure)
     124    primary[0][i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
     125    primary[0][i].dM    = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM * 0.001;     
     126    primary[0][i].Xm    = in[i].Xm;     
     127
     128    primary[0][i].Ncode = 0;     
     129    primary[0][i].Nused = 0;
     130
     131    // added for PANSTARRS_DEV_0
    110132    out[i].dR      = 0;
    111133    out[i].dD      = 0;
     
    116138    out[i].P       = 0;
    117139    out[i].dP      = 0;
    118 
    119     /* XXX add these later */
    120     out[i].objID   = 0;
    121     out[i].catID   = 0;
    122 
    123     primary[0][i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
    124     primary[0][i].dM    = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM * 0.001;     
    125     primary[0][i].Xm    = in[i].Xm;     
    126     primary[0][i].Ncode = 0;     
    127     primary[0][i].Nused = 0;
     140    out[i].objID   = 0; // determine on-the-fly
     141    out[i].catID   = 0; // determine on-the-fly
     142
     143    // changed or added for PS1_DEV_2
     144    out[i].Nmeasure      = in[i].Nm;     
     145    out[i].Nmissing      = in[i].Nn;     
     146    out[i].measureOffset = in[i].offset;
     147    out[i].missingOffset = in[i].missing;
     148    out[i].Nextend       = 0;
     149    out[i].extendOffset  = 0;
     150
     151    // changed or added for PS1_V1
     152    out[i].flags         = in[i].code;   
     153    out[i].ChiSq         = 0.0;
     154    out[i].Npos          = 0.0;
     155    out[i].extID         = 0;
    128156  }
    129157  return (out);
     
    142170    out[i].D       = in[i].D;     
    143171    out[i].Xp      = in[i].Xp;     
    144     out[i].Nm      = in[i].Nmeasure;     
    145     out[i].Nn      = in[i].Nmissing;     
    146     out[i].code    = in[i].code;   
    147     out[i].offset  = in[i].measureOffset;
    148     out[i].missing = in[i].missingOffset;
    149 
     172
     173    // changed for PANSTARRS_DEV_0 (moved from Average to Measure)
    150174    out[i].M       = isnan(primary[i].M)  ? NAN_S_SHORT : primary[i].M   * 1000.0;
    151175    out[i].dM      = isnan(primary[i].dM) ? NAN_S_SHORT : primary[i].dM  * 1000.0;
    152176    out[i].Xm      = primary[i].Xm;     
     177
     178    // changed or added for PS1_DEV_2
     179    out[i].Nm      = in[i].Nmeasure;     
     180    out[i].Nn      = in[i].Nmissing;     
     181    out[i].offset  = in[i].measureOffset;
     182    out[i].missing = in[i].missingOffset;
     183
     184    // changed or added for PS1_V1
     185    out[i].code    = in[i].flags;   
    153186  }
    154187  return (out);
     
    164197
    165198  for (i = 0; i < Nvalues; i++) {
     199    out[i].Xm    = in[i].Xm;     
     200
     201    // added or changed for PANSTARRS_DEV_0
    166202    out[i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M   * 0.001;
    167203    out[i].dM    = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM  * 0.001;
    168     out[i].Xm    = in[i].Xm;     
    169204    out[i].Ncode = 0;
    170205    out[i].Nused = 0;
     206
     207    // changed or added for PS1_V1
     208    out[i].M_20  = 0;     
     209    out[i].M_80  = 0;     
    171210  }
    172211  return (out);
     
    182221
    183222  for (i = 0; i < Nvalues; i++) {
     223    out[i].Xm    = in[i].Xm;     
     224
     225    // added or changed for PANSTARRS_DEV_0
    184226    out[i].M     = isnan(in[i].M)  ? NAN_S_SHORT : in[i].M   * 1000.0;
    185227    out[i].dM    = isnan(in[i].dM) ? NAN_S_SHORT : in[i].dM  * 1000.0;
    186     out[i].Xm    = in[i].Xm;     
    187228  }
    188229  return (out);
     
    207248    out[i].NX               = in[i].NX;
    208249    out[i].NY               = in[i].NY;
    209     out[i].secz             = (in[i].secz     == NAN_S_SHORT) ? NAN : in[i].secz     * 0.001;
    210     out[i].apmifit          = (in[i].apmifit  == NAN_S_SHORT) ? NAN : in[i].apmifit  * 0.001;
    211     out[i].dapmifit         = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001;
    212     out[i].Mcal             = (in[i].Mcal     == NAN_S_SHORT) ? NAN : in[i].Mcal     * 0.001;
    213     out[i].dMcal            = (in[i].dMcal    == NAN_S_SHORT) ? NAN : in[i].dMcal    * 0.001;
    214250    out[i].Xm               = in[i].Xm;
    215251    out[i].photcode         = in[i].source;
     
    221257    out[i].fwhm_y           = in[i].fwhm_y;
    222258    out[i].trate            = in[i].trate;
    223     out[i].code             = in[i].code;
    224259    out[i].ccdnum           = in[i].ccdnum;
    225260
     
    240275    out[i].Myyyy            = in[i].Myyyy;
    241276
    242     /* XXX add these later */
    243     out[i].imageID = 0;
    244 
    245     // not available in ELIXIR
     277    // added or changed for PANSTARRS_DEV_0
     278    out[i].secz             = (in[i].secz     == NAN_S_SHORT) ? NAN : in[i].secz     * 0.001;
     279    out[i].apmifit          = (in[i].apmifit  == NAN_S_SHORT) ? NAN : in[i].apmifit  * 0.001;
     280    out[i].dapmifit         = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001;
     281    out[i].Mcal             = (in[i].Mcal     == NAN_S_SHORT) ? NAN : in[i].Mcal     * 0.001;
     282    out[i].dMcal            = (in[i].dMcal    == NAN_S_SHORT) ? NAN : in[i].dMcal    * 0.001;
    246283    out[i].sidtime          = NAN;
    247284    out[i].latitude         = NAN;
     285    out[i].imageID          = 0; // determine on-the-fly
     286
     287    // changed or added for PS1_DEV_2
     288    out[i].externID         = 0;
     289    out[i].sourceID         = 0;
     290
     291    // changed or added for PS1_V1
     292    out[i].flags            = in[i].code;
     293    out[i].parentID         = 0;
    248294  }
    249295  return (out);
     
    268314    out[i].NX               = in[i].NX;
    269315    out[i].NY               = in[i].NY;
    270     out[i].secz             = isnan(in[i].secz    ) ? NAN_S_SHORT : in[i].secz     * 1000.0;
    271     out[i].apmifit          = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit  * 1000.0;
    272     out[i].dapmifit         = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0;
    273     out[i].Mcal             = isnan(in[i].Mcal    ) ? NAN_S_SHORT : in[i].Mcal     * 1000.0;
    274     out[i].dMcal            = isnan(in[i].dMcal   ) ? NAN_S_SHORT : in[i].dMcal    * 1000.0;
     316
    275317    out[i].Xm               = in[i].Xm;
    276318    out[i].source           = in[i].photcode;
     
    282324    out[i].fwhm_y           = in[i].fwhm_y;
    283325    out[i].trate            = in[i].trate;
    284     out[i].code             = in[i].code;
    285326    out[i].ccdnum           = in[i].ccdnum;
    286327
     
    300341    out[i].Mxyyy            = in[i].Mxyyy;
    301342    out[i].Myyyy            = in[i].Myyyy;
    302   }
    303   return (out);
    304 }
    305 
    306 PhotCode_Elixir *PhotCode_Internal_To_Elixir (PhotCode *in, int Nvalues) {
    307 
    308   int i;
    309   PhotCode_Elixir *out;
    310 
    311   ALLOCATE (out, PhotCode_Elixir, Nvalues);
     343
     344    // added or changed for PANSTARRS_DEV_0
     345    out[i].secz             = isnan(in[i].secz    ) ? NAN_S_SHORT : in[i].secz     * 1000.0;
     346    out[i].apmifit          = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit  * 1000.0;
     347    out[i].dapmifit         = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0;
     348    out[i].Mcal             = isnan(in[i].Mcal    ) ? NAN_S_SHORT : in[i].Mcal     * 1000.0;
     349    out[i].dMcal            = isnan(in[i].dMcal   ) ? NAN_S_SHORT : in[i].dMcal    * 1000.0;
     350
     351    // changed or added for PS1_V1
     352    out[i].code             = in[i].flags;
     353  }
     354  return (out);
     355}
     356
     357PhotCode *PhotCode_Elixir_To_Internal (PhotCode_Elixir *in, int Nvalues) {
     358
     359  int i;
     360  PhotCode *out;
     361
     362  ALLOCATE (out, PhotCode, Nvalues);
    312363
    313364  for (i = 0; i < Nvalues; i++) {
     
    326377    out[i].Nc    = in[i].Nc;           
    327378    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
    328   }
    329   return (out);
    330 }
    331 
    332 PhotCode *PhotCode_Elixir_To_Internal (PhotCode_Elixir *in, int Nvalues) {
    333 
    334   int i;
    335   PhotCode *out;
    336 
    337   ALLOCATE (out, PhotCode, Nvalues);
     379
     380    // changed or added for PS1_DEV_1
     381    out[i].astromErrMagScale = 0.0;
     382    out[i].photomErrSys      = 0.0;
     383
     384    // changed or added for PS1_DEV_2
     385    out[i].astromErrSys      = 0.0;
     386    out[i].astromErrScale    = 0.0;
     387
     388    // changed or added for PS1_V1 (also PS1_DEV_3, deprecated)
     389    out[i].photomPoorMask      = 0;
     390    out[i].photomBadMask       = 0;
     391    out[i].astromPoorMask      = 0;
     392    out[i].astromBadMask       = 0;
     393  }
     394  return (out);
     395}
     396
     397PhotCode_Elixir *PhotCode_Internal_To_Elixir (PhotCode *in, int Nvalues) {
     398
     399  int i;
     400  PhotCode_Elixir *out;
     401
     402  ALLOCATE (out, PhotCode_Elixir, Nvalues);
    338403
    339404  for (i = 0; i < Nvalues; i++) {
     
    352417    out[i].Nc    = in[i].Nc;           
    353418    memcpy (out[i].X, in[i].X, 4*sizeof(float));           
    354 
    355     // not defined in Elixir:
    356     out[i].astromErrSys      = 0.0;
    357     out[i].astromErrScale    = 0.0;
    358     out[i].astromErrMagScale = 0.0;
    359     out[i].photomErrSys      = 0.0;
    360 
    361     out[i].photomPoorMask      = 0;
    362     out[i].photomBadMask       = 0;
    363     out[i].astromPoorMask      = 0;
    364     out[i].astromBadMask       = 0;
    365   }
    366   return (out);
    367 }
     419  }
     420  return (out);
     421}
  • trunk/Ohana/src/libdvo/src/dvo_convert_loneos.c

    r19185 r21508  
    1010
    1111  for (i = 0; i < Nvalues; i++) {
    12     out[i].dR        = (in[i].dR      == NAN_S_SHORT) ? NAN : in[i].dR     * 0.01;
    13     out[i].dD        = (in[i].dD      == NAN_S_SHORT) ? NAN : in[i].dD     * 0.01;
    14     out[i].M         = (in[i].M       == NAN_S_SHORT) ? NAN : in[i].M      * 0.001;
    15     out[i].dM        = (in[i].dM      == NAN_U_CHAR)  ? NAN : in[i].dM     * 0.001;
    16     out[i].Mcal      = (in[i].Mcal    == NAN_S_SHORT) ? NAN : in[i].Mcal   * 0.001;
    17     out[i].dophot    = in[i].dophot;
    18     out[i].photcode  = in[i].source;
    19     out[i].t         = in[i].t;
    20 
    21     /* flags and averef are now split */
     12    out[i].t        = in[i].t;
     13
     14    // added or changed for ELIXIR
    2215    out[i].averef    =  in[i].averef & 0x00ffffff;
    2316    out[i].dbFlags   = (in[i].averef & 0xff000000) >> 24;
    24 
    25     /* these values don't exist in the Loneos format */
    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;
     17    out[i].t         = in[i].t;
    3018    out[i].dt        = 0;
    3119    out[i].airmass   = 0;
     20    out[i].FWy       = 0;
     21    out[i].FWx       = 0;
     22    out[i].theta     = 0;
     23
     24    // changed for PANSTARRS_DEV_0
     25    out[i].dR       = (in[i].dR      == NAN_S_SHORT) ? NAN : in[i].dR     * 0.01;
     26    out[i].dD       = (in[i].dD      == NAN_S_SHORT) ? NAN : in[i].dD     * 0.01;
     27    out[i].M        = (in[i].M       == NAN_S_SHORT) ? NAN : in[i].M      * 0.001;
     28    out[i].dM       = (in[i].dM      == NAN_U_CHAR)  ? NAN : in[i].dM     * 0.001;
     29    out[i].Mcal     = (in[i].Mcal    == NAN_S_SHORT) ? NAN : in[i].Mcal   * 0.001;
     30    out[i].Map      = (in[i].M       == NAN_S_SHORT) ? NAN : in[i].M      * 0.001;
     31    out[i].photcode = in[i].source;
     32   
     33    // added for PANSTARRS_DEV_0
     34    out[i].Xccd      = 0;  // determine on-the-fly
     35    out[i].Yccd      = 0;  // determine on-the-fly
     36    out[i].dXccd     = 0;
     37    out[i].dYccd     = 0;
    3238    out[i].az        = 0;
    33     out[i].FWx       = 0;
    34     out[i].FWy       = 0;
    35     out[i].theta     = 0;
    36     out[i].stargal   = 0;
    3739    out[i].Sky       = 0;
    3840    out[i].dSky      = 0;
    39     out[i].qPSF      = 0;
     41    out[i].psfQual   = 0;
    4042    out[i].psfChisq  = 0;
    4143    out[i].crNsigma  = 0;
    4244    out[i].extNsigma = 0;
    43     out[i].photFlags = 0;
    44 
    45     /* these can be determined if needed / desired */
    46     out[i].Xccd     = 0;
    47     out[i].Yccd     = 0;
    48     out[i].dXccd    = 0;
    49     out[i].dYccd    = 0;
    50 
    51     /* XXX add these later */
    52     out[i].detID = 0;
    53     out[i].imageID = 0;
     45    out[i].detID     = 0;  // determine on-the-fly
     46    out[i].imageID   = 0;  // determine on-the-fly
     47
     48    // changed or added for PS1_DEV_1 (2008.02.26)
     49    out[i].detID      = 0;
     50    out[i].imageID    = 0;
     51
     52    // changed or added for PS1_DEV_2
     53    out[i].dMcal      = 0;
     54
     55    // changed or added for PS1_V1
     56    out[i].photFlags  = in[i].dophot << 16;
     57    out[i].t_msec     = 0;
     58    out[i].extID      = 0;
     59    out[i].objID      = 0;
     60    out[i].catID      = 0;
     61    out[i].Mxx        = 0.0;
     62    out[i].Mxy        = 0.0;
     63    out[i].Myy        = 0.0;
     64    out[i].posangle   = 0;
     65    out[i].pltscale   = 0;
     66    out[i].psfNdof    = 0;
     67    out[i].psfNpix    = 0;
    5468  }
    5569  return (out);
     
    6579
    6680  for (i = 0; i < Nvalues; i++) {
     81
     82    // changed for PANSTARRS_DEV_0
    6783    out[i].dR     = isnan(in[i].dR     ) ? NAN_S_SHORT : in[i].dR      *  100.0;
    6884    out[i].dD     = isnan(in[i].dD     ) ? NAN_S_SHORT : in[i].dD      *  100.0;
     
    7086    out[i].dM     = isnan(in[i].dM     ) ? NAN_U_CHAR  : in[i].dM      * 1000.0;
    7187    out[i].Mcal   = isnan(in[i].Mcal   ) ? NAN_S_SHORT : in[i].Mcal    * 1000.0;
    72     out[i].dophot = in[i].dophot;
    7388    out[i].source = in[i].photcode;
    7489    out[i].t      = in[i].t;
     
    7691    /* flags and averef are merged in Loneos */
    7792    out[i].averef =  (in[i].averef & 0x00ffffff) | (in[i].dbFlags << 24);
     93
     94    // changed or added for PS1_V1
     95    out[i].dophot  = in[i].photFlags >> 16;
    7896  }
    7997  return (out);
     
    93111    out[i].D             = in[i].D;     
    94112    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;
    100 
    101     /* these don't exist in Loneos */
     113
     114    // added for ELIXIR
     115    primary[0][i].dM    = NAN;
     116
     117    // changed for PANSTARRS_DEV_0 (moved from Average to Measure)
     118    primary[0][i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
     119    primary[0][i].Xm    = in[i].Xm;     
     120    primary[0][i].Ncode = 0;     
     121    primary[0][i].Nused = 0;
     122
     123    // added for PANSTARRS_DEV_0
    102124    out[i].dR      = 0;
    103125    out[i].dD      = 0;
     
    108130    out[i].P       = 0;
    109131    out[i].dP      = 0;
    110 
    111     /* XXX add these later */
    112     out[i].objID   = 0;
    113     out[i].catID   = 0;
    114 
    115     primary[0][i].M  = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M  * 0.001;     
    116     primary[0][i].Xm = in[i].Xm;     
    117     primary[0][i].dM = NAN;
    118     primary[0][i].Ncode = 0;     
    119     primary[0][i].Nused = 0;
     132    out[i].objID   = 0; // determine on-the-fly
     133    out[i].catID   = 0; // determine on-the-fly
     134
     135    // changed or added for PS1_DEV_2
     136    out[i].Nmeasure      = in[i].Nm;     
     137    out[i].Nmissing      = in[i].Nn;     
     138    out[i].measureOffset = in[i].offset;
     139    out[i].missingOffset = in[i].missing;
     140    out[i].Nextend       = 0;
     141    out[i].extendOffset  = 0;
     142
     143    // changed or added for PS1_V1
     144    out[i].flags         = in[i].code;   
     145    out[i].ChiSq         = 0.0;
     146    out[i].Npos          = 0.0;
     147    out[i].extID         = 0;
    120148  }
    121149  return (out);
     
    134162    out[i].D       = in[i].D;     
    135163    out[i].Xp      = in[i].Xp;     
     164
     165    // changed for PANSTARRS_DEV_0 (moved from Average to Measure)
     166    out[i].M       = isnan(primary[i].M)  ? NAN_S_SHORT : primary[i].M   * 1000.0;
     167    out[i].Xm      = primary[i].Xm;     
     168
     169    // changed or added for PS1_DEV_2
    136170    out[i].Nm      = in[i].Nmeasure;     
    137171    out[i].Nn      = in[i].Nmissing;     
    138     out[i].code    = in[i].code;   
    139172    out[i].offset  = in[i].measureOffset;
    140173    out[i].missing = in[i].missingOffset;
    141174
    142     out[i].M       = isnan(primary[i].M)  ? NAN_S_SHORT : primary[i].M   * 1000.0;
    143     out[i].Xm      = primary[i].Xm;     
     175    // changed or added for PS1_V1
     176    out[i].code    = in[i].flags;   
    144177  }
    145178  return (out);
     
    155188
    156189  for (i = 0; i < Nvalues; i++) {
     190    out[i].Xm    = in[i].Xm;     
     191
     192    // added for ELIXIR
     193    out[i].dM    = NAN;
     194
     195    // added or changed for PANSTARRS_DEV_0
    157196    out[i].M     = (in[i].M  == NAN_S_SHORT) ? NAN : in[i].M * 0.001;
    158     out[i].Xm    = in[i].Xm;     
    159     out[i].dM    = NAN;
    160197    out[i].Ncode = 0;
    161198    out[i].Nused = 0;
     199
     200    // changed or added for PS1_V1
     201    out[i].M_20  = 0;     
     202    out[i].M_80  = 0;     
    162203  }
    163204  return (out);
     
    173214
    174215  for (i = 0; i < Nvalues; i++) {
     216    out[i].Xm   = in[i].Xm;     
     217
     218    // added or changed for PANSTARRS_DEV_0
    175219    out[i].M    = isnan(in[i].M)  ? NAN_S_SHORT : in[i].M * 1000.0;
    176     out[i].Xm   = in[i].Xm;     
    177220  }
    178221  return (out);
     
    197240    out[i].NX               = in[i].NX;
    198241    out[i].NY               = in[i].NY;
    199 
    200     out[i].secz             = (in[i].secz     == NAN_S_SHORT) ? NAN : in[i].secz     * 0.001;
    201     out[i].apmifit          = (in[i].apmifit  == NAN_S_SHORT) ? NAN : in[i].apmifit  * 0.001;
    202     out[i].dapmifit         = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001;
    203     out[i].Mcal             = (in[i].Mcal     == NAN_S_SHORT) ? NAN : in[i].Mcal     * 0.001;
    204     out[i].dMcal            = (in[i].dMcal    == NAN_S_SHORT) ? NAN : in[i].dMcal    * 0.001;
    205242
    206243    out[i].Xm               = in[i].Xm;
     
    213250    out[i].fwhm_y           = in[i].fwhm_y;
    214251    out[i].trate            = in[i].trate;
    215     out[i].code             = in[i].code;
    216252    out[i].ccdnum           = in[i].ccdnum;
     253
    217254    out[i].order            = in[i].order;
    218255    out[i].Mx               = in[i].Mx;
     
    231268    out[i].Myyyy            = in[i].Myyyy;
    232269
    233     /* XXX add these later */
    234     out[i].imageID = 0;
     270    // added or changed for PANSTARRS_DEV_0
     271    out[i].secz             = (in[i].secz     == NAN_S_SHORT) ? NAN : in[i].secz     * 0.001;
     272    out[i].apmifit          = (in[i].apmifit  == NAN_S_SHORT) ? NAN : in[i].apmifit  * 0.001;
     273    out[i].dapmifit         = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001;
     274    out[i].Mcal             = (in[i].Mcal     == NAN_S_SHORT) ? NAN : in[i].Mcal     * 0.001;
     275    out[i].dMcal            = (in[i].dMcal    == NAN_S_SHORT) ? NAN : in[i].dMcal    * 0.001;
     276    out[i].sidtime          = NAN;
     277    out[i].latitude         = NAN;
     278    out[i].imageID          = 0; // determine on-the-fly
     279
     280    // changed or added for PS1_DEV_2
     281    out[i].externID         = 0;
     282    out[i].sourceID         = 0;
     283
     284    // changed or added for PS1_V1
     285    out[i].flags            = in[i].code;
     286    out[i].parentID         = 0;
    235287  }
    236288  return (out);
     
    255307    out[i].NX               = in[i].NX;
    256308    out[i].NY               = in[i].NY;
    257 
    258     out[i].secz             = isnan(in[i].secz    ) ? NAN_S_SHORT : in[i].secz     * 1000.0;
    259     out[i].apmifit          = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit  * 1000.0;
    260     out[i].dapmifit         = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0;
    261     out[i].Mcal             = isnan(in[i].Mcal    ) ? NAN_S_SHORT : in[i].Mcal     * 1000.0;
    262     out[i].dMcal            = isnan(in[i].dMcal   ) ? NAN_S_SHORT : in[i].dMcal    * 1000.0;
    263309
    264310    out[i].Xm               = in[i].Xm;
     
    271317    out[i].fwhm_y           = in[i].fwhm_y;
    272318    out[i].trate            = in[i].trate;
    273     out[i].code             = in[i].code;
    274319    out[i].ccdnum           = in[i].ccdnum;
     320
    275321    out[i].order            = in[i].order;
    276322    out[i].Mx               = in[i].Mx;
     
    288334    out[i].Mxyyy            = in[i].Mxyyy;
    289335    out[i].Myyyy            = in[i].Myyyy;
    290   }
    291   return (out);
    292 }
     336
     337    // added or changed for PANSTARRS_DEV_0
     338    out[i].secz             = isnan(in[i].secz    ) ? NAN_S_SHORT : in[i].secz     * 1000.0;
     339    out[i].apmifit          = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit  * 1000.0;
     340    out[i].dapmifit         = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0;
     341    out[i].Mcal             = isnan(in[i].Mcal    ) ? NAN_S_SHORT : in[i].Mcal     * 1000.0;
     342    out[i].dMcal            = isnan(in[i].dMcal   ) ? NAN_S_SHORT : in[i].dMcal    * 1000.0;
     343
     344    // changed or added for PS1_V1
     345    out[i].code             = in[i].flags;
     346  }
     347  return (out);
     348}
  • trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c

    r19185 r21508  
    1616    out[i].Mcal       = in[i].Mcal;
    1717
    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;
    2118    out[i].airmass    = in[i].airmass;
    2219    out[i].az         = in[i].az;
     
    2522    out[i].FWy        = in[i].FWy;
    2623    out[i].theta      = in[i].theta;
    27     out[i].dophot     = in[i].dophot;
    2824    out[i].photcode   = in[i].photcode;
    2925    out[i].t          = in[i].t;
    3026    out[i].averef     = in[i].averef;
    31     out[i].dbFlags    = in[i].flags;
    3227    out[i].Xccd       = in[i].Xccd;
    3328    out[i].Yccd       = in[i].Yccd;
    3429    out[i].dXccd      = in[i].dXccd;
    3530    out[i].dYccd      = in[i].dYccd;
    36     out[i].stargal    = in[i].stargal;
    3731    out[i].Sky        = in[i].Sky;
    3832    out[i].dSky       = in[i].dSky;
    39     out[i].qPSF       = (in[i].qPSF == NAN_S_SHORT) ? NAN : in[i].qPSF;
     33
     34    // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture
     35    // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
     36
     37    // changed or added for PS1_DEV_1 (2008.02.26)
     38    out[i].psfQual    = (in[i].psfQual == NAN_S_SHORT) ? NAN : in[i].psfQual;
     39    out[i].dbFlags    = in[i].flags;
    4040    out[i].detID      = in[i].detID_lo;
    4141    out[i].imageID    = in[i].imageID_lo;
    42 
    43     // these don't have a correspondence
    44     out[i].psfChisq  = 0;
    45     out[i].crNsigma  = 0;
    46     out[i].extNsigma = 0;
    47     out[i].photFlags = 0;
     42    out[i].psfChisq   = 0;
     43    out[i].crNsigma   = 0;
     44    out[i].extNsigma  = 0;
     45
     46    // changed or added for PS1_DEV_2
     47    out[i].Map        = in[i].Mgal;
     48    out[i].dMcal      = 0;
     49
     50    // changed or added for PS1_V1
     51    out[i].photFlags  = in[i].dophot << 16;
     52    out[i].t_msec     = 0;
     53    out[i].extID      = 0;
     54    out[i].objID      = 0;
     55    out[i].catID      = 0;
     56    out[i].Mxx        = 0.0;
     57    out[i].Mxy        = 0.0;
     58    out[i].Myy        = 0.0;
     59    out[i].posangle   = 0;
     60    out[i].pltscale   = 0;
     61    out[i].psfNdof    = 0;
     62    out[i].psfNpix    = 0;
    4863  }
    4964  return (out);
     
    6479    out[i].dM         = in[i].dM;
    6580    out[i].Mcal       = in[i].Mcal;
    66     out[i].Mgal       = in[i].Map;
    6781    out[i].airmass    = in[i].airmass;
    6882    out[i].az         = in[i].az;
     
    7185    out[i].FWy        = in[i].FWy;
    7286    out[i].theta      = in[i].theta;
    73     out[i].dophot     = in[i].dophot;
    7487    out[i].photcode   = in[i].photcode;
    7588    out[i].t          = in[i].t;
    7689    out[i].averef     = in[i].averef;
    77     out[i].flags      = in[i].dbFlags;
    7890    out[i].Xccd       = in[i].Xccd;
    7991    out[i].Yccd       = in[i].Yccd;
    8092    out[i].dXccd      = in[i].dXccd;
    8193    out[i].dYccd      = in[i].dYccd;
    82     out[i].stargal    = in[i].stargal;
    8394    out[i].Sky        = in[i].Sky;
    8495    out[i].dSky       = in[i].dSky;
    85     out[i].qPSF       = isnan(in[i].qPSF) ? NAN_S_SHORT : in[i].qPSF;
     96
     97    // changed or added for PS1_DEV_1 (2008.02.26)
     98    out[i].flags      = in[i].dbFlags;
     99    out[i].psfQual    = isnan(in[i].psfQual) ? NAN_S_SHORT : in[i].psfQual;
    86100    out[i].detID_hi   = 0;
    87101    out[i].detID_lo   = in[i].detID;
    88102    out[i].imageID_hi = 0;
    89103    out[i].imageID_lo = in[i].imageID;
     104
     105    // changed or added for PS1_DEV_2
     106    out[i].Mgal       = in[i].Map;
     107
     108    // changed or added for PS1_V1
     109    // out[i].photFlags  = in[i].photFlags & 0x0000ffff; (only dophot pre PS1_DEV_1)
     110    out[i].dophot     = in[i].photFlags >> 16;
    90111  }
    91112  return (out);
     
    105126    out[i].D             = in[i].D;     
    106127    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;
    112128    out[i].dR            = in[i].dR;
    113129    out[i].dD            = in[i].dD;
     
    120136    out[i].objID         = in[i].objID;
    121137    out[i].catID         = in[i].catID;
     138
     139    // changed or added for PS1_DEV_2
     140    out[i].Nmeasure      = in[i].Nm;     
     141    out[i].Nmissing      = in[i].Nn;     
     142    out[i].measureOffset = in[i].offset;
     143    out[i].missingOffset = in[i].missing;
     144    out[i].Nextend       = 0;
     145    out[i].extendOffset  = 0;
     146
     147    // changed or added for PS1_V1
     148    out[i].flags         = in[i].code;   
     149    out[i].ChiSq         = 0.0;
     150    out[i].Npos          = 0.0;
     151    out[i].extID         = 0;
    122152  }
    123153  return (out);
     
    137167    out[i].D        = in[i].D;     
    138168    out[i].Xp       = in[i].Xp;     
    139     out[i].Nm       = in[i].Nmeasure;     
    140     out[i].Nn       = in[i].Nmissing;     
    141     out[i].code     = in[i].code;   
    142     out[i].offset   = in[i].measureOffset;
    143     out[i].missing  = in[i].missingOffset;
    144169    out[i].dR       = in[i].dR;
    145170    out[i].dD       = in[i].dD;
     
    152177    out[i].objID    = in[i].objID;
    153178    out[i].catID    = in[i].catID;
     179
     180    // changed or added for PS1_DEV_2
     181    out[i].Nm       = in[i].Nmeasure;     
     182    out[i].Nn       = in[i].Nmissing;     
     183    out[i].offset   = in[i].measureOffset;
     184    out[i].missing  = in[i].missingOffset;
     185
     186    // changed or added for PS1_V1
     187    out[i].code          = in[i].flags;   
    154188  }
    155189  return (out);
     
    170204    out[i].Ncode = in[i].Ncode;
    171205    out[i].Nused = in[i].Nused;
     206
     207    // changed or added for PS1_V1
     208    out[i].M_20  = 0;     
     209    out[i].M_80  = 0;     
    172210 }
    173211  return (out);
     
    226264    out[i].fwhm_y           = in[i].fwhm_y;
    227265    out[i].trate            = in[i].trate;
    228     out[i].code             = in[i].code;
    229266    out[i].ccdnum           = in[i].ccdnum;
    230     out[i].imageID          = in[i].imageID_lo;
    231267
    232268    out[i].order            = in[i].order;
     
    245281    out[i].Mxyyy            = in[i].Mxyyy;
    246282    out[i].Myyyy            = in[i].Myyyy;
     283
     284    // changed or added for PS1_DEV_1
     285    out[i].imageID          = in[i].imageID_lo;
     286
     287    // changed or added for PS1_DEV_2
     288    out[i].externID         = 0;
     289    out[i].sourceID         = 0;
     290
     291    // changed or added for PS1_V1
     292    out[i].flags            = in[i].code;
     293    out[i].parentID         = 0;
    247294  }
    248295  return (out);
     
    283330    out[i].fwhm_y           = in[i].fwhm_y;
    284331    out[i].trate            = in[i].trate;
    285     out[i].code             = in[i].code;
    286332    out[i].ccdnum           = in[i].ccdnum;
    287     out[i].imageID_hi       = 0;
    288     out[i].imageID_lo       = in[i].imageID;
    289333
    290334    out[i].order            = in[i].order;
     
    303347    out[i].Mxyyy            = in[i].Mxyyy;
    304348    out[i].Myyyy            = in[i].Myyyy;
    305   }
    306   return (out);
    307 }
     349
     350    // changed or added for PS1_DEV_1
     351    out[i].imageID_hi       = 0;
     352    out[i].imageID_lo       = in[i].imageID;
     353
     354    // changed or added for PS1_V1
     355    out[i].code             = in[i].flags;
     356  }
     357  return (out);
     358}
  • trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c

    r19185 r21508  
    1616    out[i].Mcal       = in[i].Mcal;
    1717
    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;
    2118    out[i].airmass    = in[i].airmass;
    2219    out[i].az         = in[i].az;
     
    2522    out[i].FWy        = in[i].FWy;
    2623    out[i].theta      = in[i].theta;
    27     out[i].dophot     = in[i].dophot;
    2824    out[i].photcode   = in[i].photcode;
    2925    out[i].t          = in[i].t;
    3026    out[i].averef     = in[i].averef;
    31     out[i].dbFlags    = in[i].flags;
    3227    out[i].Xccd       = in[i].Xccd;
    3328    out[i].Yccd       = in[i].Yccd;
    3429    out[i].dXccd      = in[i].dXccd;
    3530    out[i].dYccd      = in[i].dYccd;
    36     out[i].stargal    = in[i].stargal;
    3731    out[i].Sky        = in[i].Sky;
    3832    out[i].dSky       = in[i].dSky;
    39     out[i].qPSF       = (in[i].qPSF == NAN_S_SHORT) ? NAN : in[i].qPSF;
     33
     34    // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture
     35    // magnitudes.  Most uses of Mgal in the past were actually aperture (isophotal) mags
     36
     37    // changed or added for PS1_DEV_1 (2008.02.26)
     38    out[i].psfQual    = (in[i].psfQual == NAN_S_SHORT) ? NAN : in[i].psfQual;
     39    out[i].dbFlags    = in[i].flags;
    4040    out[i].detID      = in[i].detID_lo;
    4141    out[i].imageID    = in[i].imageID_lo;
    42 
    43     // these don't have a correspondence
    44     out[i].psfChisq  = 0;
    45     out[i].crNsigma  = 0;
    46     out[i].extNsigma = 0;
    47     out[i].photFlags = 0;
     42    out[i].psfChisq   = 0;
     43    out[i].crNsigma   = 0;
     44    out[i].extNsigma  = 0;
     45
     46    // changed or added for PS1_DEV_2
     47    out[i].Map        = in[i].Mgal;
     48    out[i].dMcal      = 0;
     49
     50    // changed or added for PS1_V1
     51    out[i].photFlags  = in[i].dophot << 16;
     52    out[i].t_msec     = 0;
     53    out[i].extID      = 0;
     54    out[i].objID      = 0;
     55    out[i].catID      = 0;
     56    out[i].Mxx        = 0.0;
     57    out[i].Mxy        = 0.0;
     58    out[i].Myy        = 0.0;
     59    out[i].posangle   = 0;
     60    out[i].pltscale   = 0;
     61    out[i].psfNdof    = 0;
     62    out[i].psfNpix    = 0;
    4863  }
    4964  return (out);
     
    6479    out[i].dM         = in[i].dM;
    6580    out[i].Mcal       = in[i].Mcal;
    66     out[i].Mgal       = in[i].Map;
    6781    out[i].airmass    = in[i].airmass;
    6882    out[i].az         = in[i].az;
     
    7185    out[i].FWy        = in[i].FWy;
    7286    out[i].theta      = in[i].theta;
    73     out[i].dophot     = in[i].dophot;
    7487    out[i].photcode   = in[i].photcode;
    7588    out[i].t          = in[i].t;
    7689    out[i].averef     = in[i].averef;
    77     out[i].flags      = in[i].dbFlags;
    7890    out[i].Xccd       = in[i].Xccd;
    7991    out[i].Yccd       = in[i].Yccd;
    8092    out[i].dXccd      = in[i].dXccd;
    8193    out[i].dYccd      = in[i].dYccd;
    82     out[i].stargal    = in[i].stargal;
    8394    out[i].Sky        = in[i].Sky;
    8495    out[i].dSky       = in[i].dSky;
    85     out[i].qPSF       = isnan(in[i].qPSF) ? NAN_S_SHORT : in[i].qPSF;
     96
     97    // changed or added for PS1_DEV_1 (2008.02.26)
     98    out[i].flags      = in[i].dbFlags;
     99    out[i].psfQual    = isnan(in[i].psfQual) ? NAN_S_SHORT : in[i].psfQual;
    86100    out[i].detID_hi   = 0;
    87101    out[i].detID_lo   = in[i].detID;
    88102    out[i].imageID_hi = 0;
    89103    out[i].imageID_lo = in[i].imageID;
     104
     105    // changed or added for PS1_DEV_2
     106    out[i].Mgal       = in[i].Map;
     107
     108    // changed or added for PS1_V1
     109    // out[i].photFlags  = in[i].photFlags & 0x0000ffff; (only dophot pre PS1_DEV_1)
     110    out[i].dophot     = in[i].photFlags >> 16;
    90111  }
    91112  return (out);
     
    105126    out[i].D             = in[i].D;     
    106127    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;
    112128    out[i].dR            = in[i].dR;
    113129    out[i].dD            = in[i].dD;
     
    120136    out[i].objID         = in[i].objID;
    121137    out[i].catID         = in[i].catID;
     138
     139    // changed or added for PS1_DEV_2
     140    out[i].Nmeasure      = in[i].Nm;     
     141    out[i].Nmissing      = in[i].Nn;     
     142    out[i].measureOffset = in[i].offset;
     143    out[i].missingOffset = in[i].missing;
     144    out[i].Nextend       = 0;
     145    out[i].extendOffset  = 0;
     146
     147    // changed or added for PS1_V1
     148    out[i].flags         = in[i].code;   
     149    out[i].ChiSq         = 0.0;
     150    out[i].Npos          = 0.0;
     151    out[i].extID         = 0;
    122152  }
    123153  return (out);
     
    137167    out[i].D        = in[i].D;     
    138168    out[i].Xp       = in[i].Xp;     
    139     out[i].Nm       = in[i].Nmeasure;     
    140     out[i].Nn       = in[i].Nmissing;     
    141     out[i].code     = in[i].code;   
    142     out[i].offset   = in[i].measureOffset;
    143     out[i].missing  = in[i].missingOffset;
    144169    out[i].dR       = in[i].dR;
    145170    out[i].dD       = in[i].dD;
     
    152177    out[i].objID    = in[i].objID;
    153178    out[i].catID    = in[i].catID;
     179
     180    // changed or added for PS1_DEV_2
     181    out[i].Nm       = in[i].Nmeasure;     
     182    out[i].Nn       = in[i].Nmissing;     
     183    out[i].offset   = in[i].measureOffset;
     184    out[i].missing  = in[i].missingOffset;
     185
     186    // changed or added for PS1_V1
     187    out[i].code          = in[i].flags;   
    154188  }
    155189  return (out);
     
    170204    out[i].Ncode = in[i].Ncode;
    171205    out[i].Nused = in[i].Nused;
     206
     207    // changed or added for PS1_V1
     208    out[i].M_20  = 0;     
     209    out[i].M_80  = 0;     
    172210 }
    173211  return (out);
     
    226264    out[i].fwhm_y           = in[i].fwhm_y;
    227265    out[i].trate            = in[i].trate;
    228     out[i].code             = in[i].code;
    229266    out[i].ccdnum           = in[i].ccdnum;
    230     out[i].imageID          = in[i].imageID_lo;
    231267
    232268    out[i].order            = in[i].order;
     
    245281    out[i].Mxyyy            = in[i].Mxyyy;
    246282    out[i].Myyyy            = in[i].Myyyy;
     283
     284    // changed or added for PS1_DEV_1
     285    out[i].imageID          = in[i].imageID_lo;
     286
     287    // changed or added for PS1_DEV_2
     288    out[i].externID         = 0;
     289    out[i].sourceID         = 0;
     290
     291    // changed or added for PS1_V1
     292    out[i].flags            = in[i].code;
     293    out[i].parentID         = 0;
    247294  }
    248295  return (out);
     
    283330    out[i].fwhm_y           = in[i].fwhm_y;
    284331    out[i].trate            = in[i].trate;
    285     out[i].code             = in[i].code;
    286332    out[i].ccdnum           = in[i].ccdnum;
    287     out[i].imageID_hi       = 0;
    288     out[i].imageID_lo       = in[i].imageID;
    289333
    290334    out[i].order            = in[i].order;
     
    303347    out[i].Mxyyy            = in[i].Mxyyy;
    304348    out[i].Myyyy            = in[i].Myyyy;
    305   }
    306   return (out);
    307 }
     349
     350    // changed or added for PS1_DEV_1
     351    out[i].imageID_hi       = 0;
     352    out[i].imageID_lo       = in[i].imageID;
     353
     354    // changed or added for PS1_V1
     355    out[i].code             = in[i].flags;
     356  }
     357  return (out);
     358}
     359
     360// XXX no photcode conversions?  this may be from before we had a photcode FITS table...
     361
  • trunk/Ohana/src/libdvo/src/dvo_image.c

    r19185 r21508  
    196196  if (db[0].format == DVO_FORMAT_PS1_DEV_2)       gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_DEV_2");
    197197  if (db[0].format == DVO_FORMAT_PS1_DEV_3)       gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_DEV_3");
     198  if (db[0].format == DVO_FORMAT_PS1_V1)          gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_V1");
    198199 
    199200  return;
  • trunk/Ohana/src/libdvo/src/dvo_image_raw.c

    r16810 r21508  
    5454  if (db[0].format == DVO_FORMAT_PS1_DEV_1)       ImageSize = sizeof(Image_PS1_DEV_1);
    5555  if (db[0].format == DVO_FORMAT_PS1_DEV_2)       ImageSize = sizeof(Image_PS1_DEV_2);
     56  if (db[0].format == DVO_FORMAT_PS1_DEV_3)       ImageSize = sizeof(Image_PS1_DEV_3);
     57  if (db[0].format == DVO_FORMAT_PS1_V1)          ImageSize = sizeof(Image_PS1_V1);
    5658
    5759  /* check that filesize makes sense */
     
    7880  if (db[0].format == DVO_FORMAT_PS1_DEV_1)       gfits_table_mkheader_Image_PS1_DEV_1 (&db[0].theader);
    7981  if (db[0].format == DVO_FORMAT_PS1_DEV_2)       gfits_table_mkheader_Image_PS1_DEV_2 (&db[0].theader);
     82  if (db[0].format == DVO_FORMAT_PS1_DEV_3)       gfits_table_mkheader_Image_PS1_DEV_3 (&db[0].theader);
     83  if (db[0].format == DVO_FORMAT_PS1_V1)          gfits_table_mkheader_Image_PS1_V1 (&db[0].theader);
    8084   
    8185  /* read data from file */
  • trunk/Ohana/src/libdvo/src/dvosorts.c

    r16040 r21508  
    4646}
    4747
    48 void sort_stars_ra (Stars *stars, int N) {
    49 
    50 # define SWAPFUNC(A,B){ Stars tmp; tmp = stars[A]; stars[A] = stars[B]; stars[B] = tmp; }
    51 # define COMPARE(A,B)(stars[A].R < stars[B].R)
    52 
    53   OHANA_SORT (N, COMPARE, SWAPFUNC);
    54 
    55 # undef SWAPFUNC
    56 # undef COMPARE
    57 
    58 }
    59 
    6048void sort_regions (SkyRegion *region, int N) {
    6149
     
    7058}
    7159
     60# if (0)
     61// deprecated along with Stars as an autocode type
     62void sort_stars_ra (Stars *stars, int N) {
     63
     64# define SWAPFUNC(A,B){ Stars tmp; tmp = stars[A]; stars[A] = stars[B]; stars[B] = tmp; }
     65# define COMPARE(A,B)(stars[A].R < stars[B].R)
     66
     67  OHANA_SORT (N, COMPARE, SWAPFUNC);
     68
     69# undef SWAPFUNC
     70# undef COMPARE
     71
     72}
     73# endif
  • trunk/Ohana/src/libohana/include/ohana.h

    r21153 r21508  
    66# include <time.h>
    77# include <stdlib.h>
     8# include <stdint.h>
    89# include <string.h>
    910# include <sys/socket.h>
  • trunk/Ohana/src/opihi/cmd.data/Makefile

    r17579 r21508  
    2020$(SRC)/accum.$(ARCH).o          \
    2121$(SRC)/applyfit2d.$(ARCH).o     \
    22 $(SRC)/applyfit.$(ARCH).o       \
     22$(SRC)/applyfit1d.$(ARCH).o     \
    2323$(SRC)/box.$(ARCH).o            \
    2424$(SRC)/book.$(ARCH).o           \
     
    2626$(SRC)/center.$(ARCH).o \
    2727$(SRC)/clear.$(ARCH).o          \
    28 $(SRC)/clip.$(ARCH).o           \
     28$(SRC)/imclip.$(ARCH).o         \
    2929$(SRC)/close.$(ARCH).o          \
    3030$(SRC)/concat.$(ARCH).o \
     
    4444$(SRC)/fft1d.$(ARCH).o          \
    4545$(SRC)/fft2d.$(ARCH).o          \
     46$(SRC)/fit1d.$(ARCH).o          \
    4647$(SRC)/fit2d.$(ARCH).o          \
    47 $(SRC)/fit.$(ARCH).o            \
    4848$(SRC)/gaussj.$(ARCH).o \
    4949$(SRC)/gaussdeviate.$(ARCH).o   \
     
    107107$(SRC)/spline_apply.$(ARCH).o   \
    108108$(SRC)/spline_construct.$(ARCH).o \
    109 $(SRC)/stats.$(ARCH).o             \
     109$(SRC)/imstats.$(ARCH).o           \
    110110$(SRC)/style.$(ARCH).o             \
    111111$(SRC)/subraster.$(ARCH).o         \
     
    131131$(SRC)/vroll.$(ARCH).o             \
    132132$(SRC)/vsmooth.$(ARCH).o        \
    133 $(SRC)/vstat.$(ARCH).o             \
     133$(SRC)/vstats.$(ARCH).o            \
    134134$(SRC)/wd.$(ARCH).o                \
    135135$(SRC)/write_vectors.$(ARCH).o     \
  • trunk/Ohana/src/opihi/cmd.data/init.c

    r21064 r21508  
    33int accum            PROTO((int, char **));
    44int applyfit         PROTO((int, char **));
     5int applyfit1d       PROTO((int, char **));
    56int applyfit2d       PROTO((int, char **));
    67int box              PROTO((int, char **));
     
    1112int clear            PROTO((int, char **));
    1213int clip             PROTO((int, char **));
     14int imclip           PROTO((int, char **));
    1315int close_device     PROTO((int, char **));
    1416int concat           PROTO((int, char **));
     
    2931int fft1d            PROTO((int, char **));
    3032int fft2d            PROTO((int, char **));
     33int fit              PROTO((int, char **));
     34int fit1d            PROTO((int, char **));
    3135int fit2d            PROTO((int, char **));
    32 int fit              PROTO((int, char **));
    3336int gaussjordan      PROTO((int, char **));
    3437int gaussdeviate     PROTO((int, char **));
     
    9295int spline_construct_cmd PROTO((int, char **));
    9396int stats            PROTO((int, char **));
     97int imstats          PROTO((int, char **));
    9498int style            PROTO((int, char **));
    9599int subraster        PROTO((int, char **));
     
    113117int vload            PROTO((int, char **));
    114118int vzload           PROTO((int, char **));
    115 int vstat            PROTO((int, char **));
     119int vstats           PROTO((int, char **));
    116120int vroll            PROTO((int, char **));
    117121int vpop             PROTO((int, char **));
     
    124128static Command cmds[] = { 
    125129  {1, "accum",        accum,            "accumulate vector values in another vector"},
    126   {1, "applyfit",     applyfit,         "apply fit to new vector"},
     130  {1, "applyfit",     applyfit1d,       "apply 1-d fit to new vector"},
     131  {1, "applyfit1d",   applyfit1d,       "apply 1-d fit to new vector"},
    127132  {1, "applyfit2d",   applyfit2d,       "apply 2-d fit to new vector"},
     133  {1, "book",         book_command,     "commands to manipulate book/page/word data"},
    128134  {1, "box",          box,              "draw a box on the plot"},
    129   {1, "book",         book_command,     "commands to manipulate book/page/word data"},
     135  {1, "buffers",      list_buffers,     "list the currently allocated buffers (images)"},
     136  {1, "images",       list_buffers,     "list the currently allocated images"},
    130137  {1, "center",       center,           "center image on coords"},
    131   {1, "parity",       parity,           "set image parity"},
    132138  {1, "circstats",    circstats,        "circular statistics"},
    133139  {1, "clear",        clear,            "erase plot"},
    134   {1, "clip",         clip,             "clip values in a buffer to be within a range"},
     140  {1, "clip",         imclip,           "clip values in an image to be within a range"},
    135141  {1, "close",        close_device,     "close the current display device"},
    136   {1, "concat",       concat,           "reduce vector dimension"},
     142  {1, "concat",       concat,           "append values to the end of a vector"},
    137143  {1, "contour",      contour,          "create contour from image"},
    138144  {1, "create",       create,           "create a new vector"},
     145  {1, "vcreate",      create,           "create a new vector"},
    139146  {1, "cumulative",   cumulative,       "build a cumulative histogram from a specific histogram"},
    140147  {1, "cursor",       cursor,           "get coords from cursor"},
     
    143150  {1, "dbconnect",    dbconnect,        "setup mysql db connection"},
    144151  {1, "dbselect",     dbselect,         "extract vectors from mysql database table"},
    145   {1, "delete",       delete,           "delete vectors or matrices"},
     152  {1, "delete",       delete,           "delete vectors or images"},
    146153  {1, "device",       device,           "set / get current graphics device"},
    147   {1, "dimendown",    dimendown,        "convert matrix to vector"},
    148   {1, "dimenup",      dimenup,          "convert vector to matrix"},
    149   {1, "erase",        erase,            "erase objects on an overlay"},
    150   {1, "extract",      extract,          "extract a portion of a buffer into another buffer"},
    151   {1, "fft1d",        fft1d,            "fft on the pixel-stream in an image"},
     154  {1, "dimendown",    dimendown,        "convert image to vector"},
     155  {1, "dimenup",      dimenup,          "convert vector to image"},
     156  {1, "dot",          dot,              "plot a single point"},
     157  {1, "erase",        erase,            "erase objects on an image overlay"},
     158  {1, "extract",      extract,          "extract a portion of a image into another image"},
     159  {1, "fft1d",        fft1d,            "fft on a vector"},
    152160  {1, "fft2d",        fft2d,            "fft on an image"},
    153   {1, "fit",          fit,              "fit polynomial to vector pair"},
     161  {1, "fit",          fit1d,            "fit polynomial to vector pair"},
     162  {1, "fit1d",        fit1d,            "fit polynomial to vector pair"},
    154163  {1, "fit2d",        fit2d,            "fit 2-d polynomial to vector triplet"},
    155   {1, "gaussj",       gaussjordan,      "solve Ax = B (N-D)"},
    156164  {1, "gaussdev",     gaussdeviate,     "generate a gaussian deviate vector"},
    157165  {1, "gaussint",     gaussintegral,    "return the integrated gaussian vector"},
    158   {1, "grid",         grid,             "plot cartesian grid"},
    159   {1, "gridify",      gridify,          "convert vector triplet to buffer"},
     166  {1, "gaussj",       gaussjordan,      "solve Ax = B (N-Dimensional)"},
     167  {1, "grid",         grid,             "plot cartesian grid on graph"},
     168  {1, "gridify",      gridify,          "convert vector triplet to image (same as vgrid?)"},
    160169  {1, "grow",         grow,             "grow a mask"},
    161   {1, "ungridify",    ungridify,        "convert buffer region to vector triplet"},
    162   {1, "header",       header,           "print buffer header"},
     170  {1, "header",       header,           "print image header"},
    163171  {1, "histogram",    histogram,        "generate histogram from vector"},
     172  {1, "imbin",        rebin,            "rebin image data by factor of N"},
     173  {1, "imclip",       imclip,           "clip values in an image to be within a range"},
    164174  {1, "imcut",        imcut,            "linear image cut between arbitrary coords"},
    165   {1, "imhist",       imhist,           "histogram of an image region"},
     175  {1, "imhistogram",  imhist,           "histogram of an image region"},
    166176  {1, "imsmooth",     imsmooth,         "circular gaussian smoothing"},
     177  {1, "imstats",      imstats,          "statistics on a portion of an image"},
    167178  {1, "integrate",    integrate,        "integrate a vector"},
    168179  {1, "interpolate",  interpolate,      "interpolate between vector pairs"},
    169   {1, "jpeg",         jpeg,             "write text line on graph"},
    170   {1, "png",          jpeg,             "write text line on graph"},
    171   {1, "ppm",          jpeg,             "write text line on graph"},
     180  {1, "jpeg",         jpeg,             "convert display image to JPEG"},
    172181  {1, "kern",         kern,             "convolve with 3x3 kernel"},
    173   {1, "keyword",      keyword,          "extract a FITS keyword from buffer header"},
     182  {1, "keyword",      keyword,          "extract a FITS keyword from image header"},
    174183  {1, "labels",       labels,           "define labels for plot"},
    175184  {1, "limits",       limits,           "define plot limits"},
    176   {1, "line",         line,             "plot line"},
    177   {1, "buffers",      list_buffers,     "list the currently allocated buffers"},
    178   {1, "vectors",      list_vectors,     "list vectors"},
    179   {1, "load",         load,             "load an SAOimage style overlay"},
     185  {1, "line",         line,             "plot a line"},
     186  {1, "load",         load,             "load an SAOimage/DS9 style overlay"},
    180187  {1, "lookup",       lookup,           "convert vector via lookup table (vector pair)"},
    181   {1, "mkrgb",        mkrgb,            "convert 3 images to rgb jpeg"},
    182   {1, "mcreate",      mcreate,          "create a matrix"},
     188  {1, "mcreate",      mcreate,          "create an image"},
     189  {1, "imcreate",     mcreate,          "create an image"},
    183190  {1, "medacc",       medacc,           "accumulate vector values in another vector"},
    184   {1, "mget",         mget,             "extract a vector from a matrix"},
     191  {1, "mget",         mget,             "extract a vector from an image"},
     192  {1, "imget",        mget,             "extract a vector from an image"},
    185193  {1, "minterp",      minterp,          "interpolate image pixels"},
    186   {1, "mset",         mset,             "insert a vector in a matrix"},
     194  {1, "iminterp",     minterp,          "interpolate image pixels"},
     195  {1, "mkrgb",        mkrgb,            "convert 3 images to rgb jpeg (use Kapa for better control)"},
     196  {1, "imset",        mset,             "insert a vector in an image"},
     197  {1, "parity",       parity,           "set image parity"},
    187198  {1, "peak",         peak,             "find vector peak in range"},
    188199  {1, "periodogram",  periodogram,      "measure periods in unevenly sampled data"},
    189200  {1, "plot",         plot,             "plot a pair of vectors"},
    190   {1, "dot",          dot,              "plot a single point"},
    191   {1, "point",        point,            "load overlay with single point"},
    192   {1, "ps",           ps,               "define labels for plot"},
     201  {1, "png",          jpeg,             "convert display graphic to PNG"},
     202  {1, "point",        point,            "load image overlay with a single point"},
     203  {1, "ppm",          jpeg,             "convert display graphic to PPM"},
     204  {1, "ps",           ps,               "convert display to PostScript"},
     205  {1, "queuedelete",  queuedelete,      "delete a queue"},
     206  {1, "queuedrop",    queuedrop,        "drop values from queue matching a key"},
     207  {1, "queueinit",    queueinit,        "create an empty queue"},
     208  {1, "queuelist",    queuelist,        "list defined queues"},
     209  {1, "queueload",    queueload,        "load queue from command"},
    193210  {1, "queuepop",     queuepop,         "pop value from queue to variable"},
    194   {1, "queuedrop",    queuedrop,        "drop values from queue matching a key"},
    195211  {1, "queueprint",   queueprint,       "print the contents of a queue"},
    196212  {1, "queuepush",    queuepush,        "push value onto queue"},
    197   {1, "queueinit",    queueinit,        "create an empty queue"},
    198   {1, "queuedelete",  queuedelete,      "delete a queue"},
    199   {1, "queuelist",    queuelist,        "list defined queues"},
    200   {1, "queueload",    queueload,        "load queue from command"},
     213  {1, "queuesize",    queuesize,        "show queue size"},
    201214  {1, "queuesubstr",  queuesubstr,      "bulk replace strings in queue"},
    202   {1, "queuesize",    queuesize,        "show queue size"},
    203215  {1, "rd",           rd,               "load fits image"},
    204216  {1, "rdseg",        rdseg,            "read a segment of an image from a file"},
    205217  {1, "read",         read_vectors,     "read vectors from datafile"},
    206   {1, "rebin",        rebin,            "rebin data by factor of N"},
     218  {1, "rebin",        rebin,            "rebin image data by factor of N"},
    207219  {1, "resize",       resize,           "set graphics/image window size"},
    208220  {1, "roll",         roll,             "roll image to new start point"},
    209221  {1, "rotate",       rotate,           "rotate image"},
    210   {1, "save",         save,             "save an SAOimage style overlay"},
     222  {1, "save",         save,             "save an SAOimage style image overlay"},
    211223  {1, "section",      section,          "define section of graph"},
    212   {1, "set",          set,              "vector math"},
     224  {1, "select",       vect_select,      "selective vector assignment"},
     225  {1, "set",          set,              "image and vector math"},
    213226  {1, "shift",        shift,            "shift data in an image"},
    214227  {1, "sort",         sort_vectors,     "sort list of vectors"},
    215228  {1, "spline.apply", spline_apply_cmd, "apply spline fit to generate an image"},
    216229  {1, "spline.const", spline_construct_cmd, "create spline 2nd deriv. terms"},
    217   {1, "stats",        stats,            "give statistics on a portion of a buffer"},
     230  {1, "stats",        imstats,          "statistics on a portion of an image"},
    218231  {1, "style",        style,            "set the style for graph plots"},
    219232  {1, "subraster",    subraster,        "subraster of fits image"},
    220   {1, "subset",       subset,           "expand vector dimension"},
    221   {1, "svd",          svd,              "singular value decomposition of a matrix"},
     233  {1, "subset",       subset,           "generate a vector from a portion of another vector"},
     234  {1, "svd",          svd,              "singular value decomposition of a matrix (image)"},
    222235  {1, "swapbytes",    swapbytes,        "byte swap thing"},
    223236  {1, "textline",     textline,         "write text line on graph"},
     
    225238  {1, "tvchannel",    tvchannel,        "set the current tv channel"},
    226239  {1, "tvcolors",     tvcolors,         "set the tv colormap"},
    227   {1, "tvcontour",    tvcontour,        "send contour to overlay"},
    228   {1, "tvgrid",       tvgrid,           "wait until return is typed"},
     240  {1, "tvcontour",    tvcontour,        "send contour to image overlay"},
     241  {1, "tvgrid",       tvgrid,           "RA/DEC grid on an image"},
     242  {1, "ungridify",    ungridify,        "convert image region to vector triplet"},
    229243  {1, "uniq",         uniq,             "create a uniq vector subset from a vector"},
    230244  {1, "unsign",       unsign,           "toggle the UNSIGN status"},
    231   {1, "vbin",         vbin,             "bin values in a vector to be within a range"},
     245  {1, "vbin",         vbin,             "rebin vector data by a fector of N"},
    232246  {1, "vclip",        vclip,            "clip values in a vector to be within a range"},
    233   {1, "select",       vect_select,      "selective vector assignment"},
    234   {1, "vgauss",       vgauss,           ""},
    235   {1, "vmaxwell",     vmaxwell,         ""},
    236   {1, "vgrid",        vgrid,            ""},
    237   {1, "vload",        vload,            "load vectors on Kii"},
    238   {1, "vzload",       vzload,           "load vectors on Kii"},
    239   {1, "vstat",        vstat,            "get info from imreg database"},
    240   {1, "vsmooth",      vsmooth,          "gaussian smooth of a vector"},
     247  {1, "vectors",      list_vectors,     "list vectors"},
     248  {1, "vgauss",       vgauss,           "fit a Gaussian to a vector"},
     249  {1, "vgrid",        vgrid,            "generate an image from a triplet of vectors"},
     250  {1, "vhistogram",   histogram,        "generate histogram from vector"},
     251  {1, "vload",        vload,            "load vectors as overlay on image display"},
     252  {1, "vmaxwell",     vmaxwell,         "fit a Maxwellian to a vector"},
     253  {1, "vpop",         vpop,             "remove first element of a vector"},
    241254  {1, "vroll",        vroll,            "roll vector elements"},
    242   {1, "vpop",         vpop,             "remove first element"},
     255  {1, "vsmooth",      vsmooth,          "Gaussian smooth of a vector"},
     256  {1, "vstats",       vstats,           "statistics on a vector"},
     257  {1, "vzload",       vzload,           "load vectors as overlay on image display (scaled points)"},
    243258  {1, "wd",           wd,               "write an image to a file"},
    244259  {1, "write",        write_vectors,    "write vectors to datafile"},
    245   {1, "zap",          zap,              "delete pixels"},
     260  {1, "zap",          zap,              "assign values to pixel regions"},
    246261  {1, "zplot",        zplot,            "plot x y with size scaled by z"},
    247262};
  • trunk/Ohana/src/opihi/dvo/dbExtractAverages.c

    r21153 r21508  
    121121      break;
    122122    case AVE_FLAG:
    123       value.Int = average[0].code;
     123      value.Int = average[0].flags;
    124124      break;
    125125    case AVE_OBJID:
  • trunk/Ohana/src/opihi/dvo/dbExtractImages.c

    r20936 r21508  
    247247      break;
    248248    case IMAGE_FLAG:
    249       value.Int = image[N].code;
     249      value.Int = image[N].flags;
    250250      break;
    251251    case IMAGE_CCDNUM:
  • trunk/Ohana/src/opihi/dvo/dbExtractMeasures.c

    r21153 r21508  
    146146        case MAG_NPHOT:
    147147          if (equiv == NULL) {
    148             value.Int = NAN;
     148            value.Int = 0;
    149149            break;
    150150          }
     
    260260      break;
    261261    case MEAS_OBJFLAGS: /* OK */
    262       value.Int = average[0].code;
     262      value.Int = average[0].flags;
    263263      break;
    264264    // note that these represent the ra displacement relative to the average, not
     
    312312      break;
    313313    case MEAS_DOPHOT: /* OK */
    314       value.Flt = measure[0].dophot;
     314      value.Int = (measure[0].photFlags >> 16);
    315315      break;
    316316    case MEAS_DB_FLAGS: /* ? */
     
    394394      break;
    395395    case MEAS_PSF_QF: /* OK */
    396       value.Flt = measure[0].qPSF;
     396      value.Flt = measure[0].psfQual;
    397397      break;
    398398    case MEAS_PSF_CHISQ: /* OK */
     
    404404    case MEAS_EXT_NSIGMA: /* OK */
    405405      value.Flt = measure[0].extNsigma;
    406       break;
    407     case MEAS_STARGAL: /* OK */
    408       value.Flt = measure[0].stargal;
    409406      break;
    410407
  • trunk/Ohana/src/opihi/dvo/dbFields.c

    r21153 r21508  
    170170  if (!strcasecmp (fieldName, "FWHM_MIN"))   ESCAPE (MEAS_FWHM_MIN,       MAG_NONE, OPIHI_FLT);
    171171  if (!strcasecmp (fieldName, "THETA"))      ESCAPE (MEAS_THETA,          MAG_NONE, OPIHI_FLT);
    172   if (!strcasecmp (fieldName, "DOPHOT"))     ESCAPE (MEAS_DOPHOT,         MAG_NONE, OPIHI_FLT);
     172  if (!strcasecmp (fieldName, "DOPHOT"))     ESCAPE (MEAS_DOPHOT,         MAG_NONE, OPIHI_INT);
    173173  if (!strcasecmp (fieldName, "DB_FLAGS"))   ESCAPE (MEAS_DB_FLAGS,       MAG_NONE, OPIHI_INT);
    174174  if (!strcasecmp (fieldName, "PHOT_FLAGS")) ESCAPE (MEAS_PHOT_FLAGS,     MAG_NONE, OPIHI_INT);
     
    193193  if (!strcasecmp (fieldName, "SKY"))        ESCAPE (MEAS_SKY,            MAG_NONE, OPIHI_FLT);
    194194  if (!strcasecmp (fieldName, "SKY_ERR"))    ESCAPE (MEAS_dSKY,           MAG_NONE, OPIHI_FLT);
    195   if (!strcasecmp (fieldName, "STARGAL"))    ESCAPE (MEAS_STARGAL,        MAG_NONE, OPIHI_FLT);
    196195
    197196  // for words that don't parse, try a photcode
  • trunk/Ohana/src/opihi/dvo/gimages.c

    r21153 r21508  
    220220    if (PixelCoords) {
    221221      gprint (GP_LOG, "%3d %s %6.1f %6.1f %20s %5d %2d %4.2f %6.3f %5.3f %5.3f %4x\n",
    222                Nfound, image[i].name, X, Y, date, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal, image[i].exptime, image[i].code);
     222               Nfound, image[i].name, X, Y, date, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal, image[i].exptime, image[i].flags);
    223223    } else {
    224224      XY_to_RD (&ra, &dec, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords);
    225225      gprint (GP_LOG, "%3d %s %8.4f %8.4f %20s %5d %2d %4.2f %6.3f %5.3f %5.3f %4x\n",
    226                Nfound, image[i].name, ra, dec, date, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal, image[i].exptime, image[i].code);
     226               Nfound, image[i].name, ra, dec, date, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal, image[i].exptime, image[i].flags);
    227227    }
    228228    sprintf (name, "IMAGEx:%d", Nfound);
  • trunk/Ohana/src/opihi/dvo/gstar.c

    r20936 r21508  
    158158        gprint (GP_LOG, "%3d   ",  catalog.average[k].Nmeasure);
    159159        gprint (GP_LOG, "%4.1f ",  0.01*catalog.average[k].Xp);
    160         gprint (GP_LOG, "%5d",     catalog.average[k].code);
     160        gprint (GP_LOG, "%5d",     catalog.average[k].flags);
    161161
    162162        if (FULL_OUTPUT) {
     
    211211            gprint (GP_LOG, "%7.4f ",  catalog.measure[m].dR);
    212212            gprint (GP_LOG, "%7.4f",   catalog.measure[m].dD);
    213             gprint (GP_LOG, "%2d ",    catalog.measure[m].dophot);
     213            gprint (GP_LOG, "%4x ",    catalog.measure[m].photFlags);
    214214            gprint (GP_LOG, "%3x ",    catalog.measure[m].dbFlags);
    215215            gprint (GP_LOG, "%5d ",    catalog.measure[m].photcode);
     
    233233                gprint (GP_LOG, "%d", catalog.measure[m].detID);
    234234                gprint (GP_LOG, "%d", catalog.measure[m].imageID);
    235                 gprint (GP_LOG, "%f", catalog.measure[m].qPSF);
     235                gprint (GP_LOG, "%f", catalog.measure[m].psfQual);
    236236                gprint (GP_LOG, "%f", catalog.measure[m].psfChisq);
    237237                gprint (GP_LOG, "%f", catalog.measure[m].crNsigma);
     
    240240                gprint (GP_LOG, "%f", 0.01*catalog.measure[m].FWy);
    241241                gprint (GP_LOG, "%f", (360.0/(float)0xffff)*catalog.measure[m].theta);
    242 
    243                 gprint (GP_LOG, "%x", catalog.measure[m].photFlags);
    244                 gprint (GP_LOG, "%d", catalog.measure[m].stargal);
    245242            }
    246243            gprint (GP_LOG, "\n");
  • trunk/Ohana/src/opihi/dvo/paverage.c

    r20936 r21508  
    122122    /* project stars to screen display coords */
    123123    for (i = 0; (i < catalog.Naverage) && !interrupt; i++) {
    124       if (IDclip && (average[i].code != IDchoice)) continue;
     124      if (IDclip && (average[i].flags != IDchoice)) continue;
    125125      average[i].R = ohana_normalize_angle (average[i].R);
    126126      while (average[i].R < Rmin) average[i].R += 360.0;
  • trunk/Ohana/src/opihi/dvo/photometry.c

    r17200 r21508  
    22
    33/* match code to measure  */
    4 # define TESTCODE(C,M) \
    5   if (C != NULL) { \
    6     switch (C[0].type) { \
    7     case PHOT_DEP: \
    8     case PHOT_REF: \
    9       if (C[0].code != M.photcode) continue; \
    10       break; \
    11     case PHOT_SEC: \
    12       if (C[0].code != GetPhotcodeEquivCodebyCode (M.photcode)) continue; \
    13       break; \
    14     default: \
    15       break; \
    16   } }
     4# define TESTCODE(C,M)                                                  \
     5  if (C != NULL) {                                                      \
     6    switch (C[0].type) {                                                \
     7      case PHOT_DEP:                                                    \
     8      case PHOT_REF:                                                    \
     9        if (C[0].code != M.photcode) continue;                          \
     10        break;                                                          \
     11      case PHOT_SEC:                                                    \
     12        if (C[0].code != GetPhotcodeEquivCodebyCode (M.photcode)) continue; \
     13        break;                                                          \
     14      default:                                                          \
     15        break;                                                          \
     16    } }
    1717
    1818/* exclusions based on measure.params  */
    19 # define TESTMEASURE(M) \
    20   if (ApplySelections[SelectionParam]) { \
    21     if (TimeSelect && (M.t < tzero)) continue; \
    22     if (TimeSelect && (M.t > tend)) continue; \
    23     if (ErrSelect  && (M.dM > ErrValue)) continue; \
     19# define TESTMEASURE(M)                                                 \
     20  if (ApplySelections[SelectionParam]) {                                \
     21    if (TimeSelect && (M.t < tzero)) continue;                          \
     22    if (TimeSelect && (M.t > tend)) continue;                           \
     23    if (ErrSelect  && (M.dM > ErrValue)) continue;                      \
     24    if (iMagSelect && (PhotInst (&M) < iMagMin)) continue;              \
     25    if (FlagSelect && (M.dbFlags != FlagValue)) continue;               \
    2426    if (TypeSelect && (TypeValue != GetMeasureTypeCode (&M))) continue; \
    25     if (iMagSelect && (PhotInst (&M) < iMagMin)) continue; \
    26     if (FlagSelect && (M.dbFlags != FlagValue)) continue; \
    27   }
    28 
    29 # define SETMAG(MOUT,MEAS,MODE) \
    30   MOUT = NAN; \
    31   if (MODE == MAG_INST) MOUT = PhotInst (&MEAS);  \
    32   if (MODE == MAG_CAT)  MOUT = PhotCat  (&MEAS); \
    33   if (MODE == MAG_SYS)  MOUT = PhotSys  (&MEAS, average, secfilt); \
    34   if (MODE == MAG_REL)  MOUT = PhotRel  (&MEAS, average, secfilt); \
     27  }
     28
     29# define SETMAG(MOUT,MEAS,MODE)                                         \
     30  MOUT = NAN;                                                           \
     31  if (MODE == MAG_INST) MOUT = PhotInst (&MEAS);                        \
     32  if (MODE == MAG_CAT)  MOUT = PhotCat  (&MEAS);                        \
     33  if (MODE == MAG_SYS)  MOUT = PhotSys  (&MEAS, average, secfilt);      \
     34  if (MODE == MAG_REL)  MOUT = PhotRel  (&MEAS, average, secfilt);      \
    3535  if (MODE == MAG_CAL)  MOUT = PhotCal  (&MEAS, average, secfilt, measure, GetPhotcodeEquivbyCode (MEAS.photcode)); \
    3636  if (MODE == MAG_AVE)  MOUT = PhotAve  (GetPhotcodeEquivbyCode (MEAS.photcode), average, secfilt); \
    3737  if (MODE == MAG_REF)  MOUT = PhotRef  (GetPhotcodeEquivbyCode (MEAS.photcode), average, secfilt, measure); \
    38   if (ApplySelections[SelectionParam]) { \
    39     if (MagSelect && (MOUT > MagMax)) continue; \
    40     if (MagSelect && (MOUT < MagMin)) continue; \
     38  if (ApplySelections[SelectionParam]) {                                \
     39    if (MagSelect && (MOUT > MagMax)) continue;                         \
     40    if (MagSelect && (MOUT < MagMin)) continue;                         \
    4141  }
    4242
     
    182182  if (!strcasecmp (parname, "dec"))      param = MEAS_DEC;
    183183  if (!strcasecmp (parname, "mag"))      param = MEAS_MAG;
    184   // if (!strcasecmp (parname, "dmag"))          param = MEAS_dMAG;
    185184  if (!strcasecmp (parname, "airmass"))  param = MEAS_AIRMASS;
    186185  if (!strcasecmp (parname, "exptime"))  param = MEAS_EXPTIME;
     
    190189  if (!strcasecmp (parname, "dD"))       param = MEAS_DEC_OFFSET;
    191190  if (!strcasecmp (parname, "fwhm"))     param = MEAS_FWHM;
    192   // if (!strcasecmp (parname, "dophot"))        param = MEAS_DOPHOT;
    193191  if (!strcasecmp (parname, "FLAGS"))    param = MEAS_DB_FLAGS;
    194192  if (!strcasecmp (parname, "XCCD"))     param = MEAS_XCCD;
     
    198196  if (!strcasecmp (parname, "help")) {
    199197    gprint (GP_ERR, "value may be one of the following:\n");
    200     gprint (GP_ERR, " ra dR dec dD mag dmag Mrel Mcal photcode time fwhm dophot xccd yccd xmosaic ymosaic flags\n");
     198    gprint (GP_ERR, " ra dR dec dD mag dmag Mrel Mcal photcode time fwhm xccd yccd xmosaic ymosaic flags\n");
    201199    gprint (GP_ERR, "value may also be a valid photcode\n");
    202200    gprint (GP_ERR, "photcodes or 'mag' may have optional magnitude type: mag,[Minst, Mcat, Msys, Mrel, Mcal]\n");
     
    311309
    312310  if (VarConfig ("ZERO_PT", "%lf", &ZERO_POINT) == (char *) NULL) {
    313       gprint (GP_ERR, "ZERO_PT undefined in config\n");
    314       return (FALSE);
     311    gprint (GP_ERR, "ZERO_PT undefined in config\n");
     312    return (FALSE);
    315313  }
    316314  SetZeroPoint (ZERO_POINT);
     
    324322
    325323  if (VarConfig ("PHOTCODE_FILE", "%s", MasterPhotcodeFile) == (char *) NULL) {
    326       gprint (GP_ERR, "PHOTCODE_FILE undefined in config\n");
    327       return (FALSE);
     324    gprint (GP_ERR, "PHOTCODE_FILE undefined in config\n");
     325    return (FALSE);
    328326  }
    329327  if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) {
     
    642640      break;
    643641    case AVE_FLAG:
    644       value = average[0].code;
     642      value = average[0].flags;
    645643      break;
    646644    case AVE_MAG:
     
    659657          value = NAN;
    660658          for (i = 0; i < average[0].Nmeasure; i++) {
    661               if (code[0].code != measure[i].photcode) continue;
    662               value = measure[i].M;
     659            if (code[0].code != measure[i].photcode) continue;
     660            value = measure[i].M;
    663661          }
    664662          break;
     
    675673      break;
    676674    case AVE_TYPEFRAC:
    677       value = DetermineTypefrac (average, measure, code);
     675      // value = DetermineTypefrac (average, measure, code);
     676      value = NAN;
    678677      break;
    679678    case AVE_NCODE:
     
    719718    if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[k].photcode))) continue;
    720719    Nc ++;
    721     if (measure[k].dophot != TypefracType) continue;
     720    if ((measure[k].photFlags >> 16) != TypefracType) continue;
    722721    Nt ++;
    723722  }
     
    744743
    745744int GetMeasureTypeCode (Measure *measure) {
    746   switch (measure[0].dophot) {
     745  switch ((measure[0].photFlags >> 16)) {
    747746    case 0:
    748747    case 1:
     
    770769  if (IsDophot) {
    771770   
    772     if (measure[0].dophot == 4) return (FALSE);
     771    if ((measure[0].photFlags >> 16) == 4) return (FALSE);
    773772    return (TRUE);
    774773 
     
    866865  if (ErrSelect) {
    867866    dM = PhotdM (code, average, secfilt);
    868     if (dM > ErrValue) return (NAN);
     867    if (dM > ErrValue) return (FALSE);
    869868  }
    870869 
     
    11371136      value = average[0].D - measure[0].dD / 3600.0;
    11381137      break;
    1139 # if (0)
    1140     case MEAS_dMAG: /* OK */
    1141       value = measure[0].dM;
    1142       break;
    11431138    case MEAS_DOPHOT: /* OK */
    1144       value = measure[0].dophot;
    1145       break;
    1146 # endif
     1139      value = (measure[0].photFlags >> 16);
     1140      break;
    11471141    case MEAS_AIRMASS: /* OK */
    11481142      value = measure[0].airmass;
  • trunk/Ohana/src/opihi/dvo/pmeasure.c

    r20936 r21508  
    192192    /* project stars to screen display coords */
    193193    for (i = 0; (i < catalog.Naverage) && !interrupt; i++) {
    194       if (IDclip && (catalog.average[i].code != IDchoice)) continue;
     194      if (IDclip && (catalog.average[i].flags != IDchoice)) continue;
    195195      catalog.average[i].R = ohana_normalize_angle (catalog.average[i].R);
    196196      while (catalog.average[i].R < Rmin) catalog.average[i].R += 360.0;
  • trunk/Ohana/src/opihi/include/dvoshell.h

    r21153 r21508  
    106106      MEAS_CR_NSIGMA,
    107107      MEAS_EXT_NSIGMA,
    108       MEAS_STARGAL,
    109108};
    110109
  • trunk/Ohana/src/relastro/include/relastro.h

    r21153 r21508  
    6161  short Xm;
    6262  float secz;
    63   char code;
     63  char flags;
    6464  Coords coords;
    6565} Mosaic;
  • trunk/Ohana/src/relastro/src/MosaicOps.c

    r16810 r21508  
    4747    mosaic[Nmosaic].dMcal = 0.0;
    4848    mosaic[Nmosaic].Xm    = 0.0;
    49     mosaic[Nmosaic].code  = image[i].code;
     49    mosaic[Nmosaic].flags  = image[i].flags;
    5050    mosaic[Nmosaic].secz  = image[i].secz;
    5151    mosaic[Nmosaic].coords = image[i].coords;
  • trunk/Ohana/src/relastro/src/UpdateObjects.c

    r17419 r21508  
    169169      // position, consider including the lower-quality detections
    170170
    171       catalog[i].average[j].code &= ~ID_STAR_FEW;
     171      catalog[i].average[j].flags &= ~ID_STAR_FEW;
    172172
    173173      // XXX add the parallax factor range as a criterion as well
  • trunk/Ohana/src/relastro/src/bcatalog.c

    r17212 r21508  
    3636      // XXX define astrometry vs photometry average.dbFlags
    3737      // XXX put photometry flags in secfilt (ie, per average mag?)
    38       subcatalog[0].average[Naverage].code &= ~ID_STAR_FEW;
    39       subcatalog[0].average[Naverage].code &= ~ID_STAR_POOR;
     38      subcatalog[0].average[Naverage].flags &= ~ID_STAR_FEW;
     39      subcatalog[0].average[Naverage].flags &= ~ID_STAR_POOR;
    4040    }
    4141
     
    7070
    7171      /* select measurements by quality */
    72       if (DophotSelect && (catalog[0].measure[offset].dophot != DophotValue)) continue;
     72      // XXX FIX THIS!!
     73      // if (DophotSelect && (catalog[0].measure[offset].dophot != DophotValue)) continue;
    7374
    7475      /* select measurements by quality */
  • trunk/Ohana/src/relastro/src/load_catalogs.c

    r16810 r21508  
    3838      if (RESET) {
    3939        for (j = 0; j < catalog[i].Naverage; j++) {
    40           catalog[i].average[j].code = 0;
     40          catalog[i].average[j].flags = 0;
    4141          m = catalog[i].average[j].measureOffset;
    4242          for (k = 0; k < catalog[i].average[j].Nmeasure; k++) {
  • trunk/Ohana/src/relastro/src/relastro_objects.c

    r17243 r21508  
    4040    if (RESET) {
    4141      for (j = 0; j < catalog.Naverage; j++) {
    42         catalog.average[j].code = 0;
     42        catalog.average[j].flags = 0;
    4343        m = catalog.average[j].measureOffset;
    4444        for (k = 0; k < catalog.average[j].Nmeasure; k++) {
  • trunk/Ohana/src/relastro/src/select_images.c

    r17205 r21508  
    147147      image[nimage] = timage[i];
    148148      /* always allow 'few' images to succeed, if possible */
    149       if (image[nimage].code & ID_IMAGE_FEW) {
    150         image[nimage].code &= ~(ID_IMAGE_FEW | ID_IMAGE_POOR);
     149      if (image[nimage].flags & ID_IMAGE_FEW) {
     150        image[nimage].flags &= ~(ID_IMAGE_FEW | ID_IMAGE_POOR);
    151151      }
    152152      if (RESET) {
     
    154154        assignMcal (&image[nimage], (double *) NULL, -1);
    155155        image[nimage].dMcal = NAN;
    156         image[nimage].code &= ~ID_IMAGE_POOR;
     156        image[nimage].flags &= ~ID_IMAGE_POOR;
    157157      }
    158158      line_number[nimage] = i;
  • trunk/Ohana/src/relphot/include/relphot.h

    r21153 r21508  
    2323  short Xm;
    2424  float secz;
    25   char code;
     25  char flags;
    2626  Coords coords;
    2727} Mosaic;
  • trunk/Ohana/src/relphot/src/GridOps.c

    r20936 r21508  
    369369
    370370      // skip stars marked as BAD
    371       if (catalog[c].average[n].code & STAR_BAD) {
     371      if (catalog[c].average[n].flags & STAR_BAD) {
    372372        Nrel ++;
    373373        continue;
  • trunk/Ohana/src/relphot/src/ImageOps.c

    r20936 r21508  
    244244  if (i == -1) return (NAN);
    245245
    246   if (image[i].code & IMAGE_BAD) return (NAN); 
     246  if (image[i].flags & IMAGE_BAD) return (NAN); 
    247247  value = image[i].Mcal;
    248248  return (value);
     
    285285    /* on PoorImages run, skip good images */
    286286    if (PoorImages) {
    287       bad = image[i].code & (ID_IMAGE_FEW | ID_IMAGE_POOR | ID_IMAGE_SKIP);
     287      bad = image[i].flags & (ID_IMAGE_FEW | ID_IMAGE_POOR | ID_IMAGE_SKIP);
    288288      if (!bad) continue;
    289289    }     
     
    331331      mark = (N < IMAGE_TOOFEW) || (N < IMAGE_GOOD_FRACTION*Nlist[i]);
    332332      if (mark) {
    333         image[i].code |= ID_IMAGE_FEW;
     333        image[i].flags |= ID_IMAGE_FEW;
    334334        Nfew ++;
    335335      } else {
    336         image[i].code &= ~ID_IMAGE_FEW;
     336        image[i].flags &= ~ID_IMAGE_FEW;
    337337      }     
    338338    }
     
    373373
    374374  for (i = N = 0; i < Nimage; i++) {
    375     if (image[i].code & IMAGE_BAD) continue;
     375    if (image[i].flags & IMAGE_BAD) continue;
    376376    mlist[N] = fabs (image[i].Mcal);
    377377    slist[N] = image[i].dMcal;
     
    390390  for (i = 0; i < Nimage; i++) {
    391391    mark = FALSE;
    392     image[i].code &= ~ID_IMAGE_POOR;
     392    image[i].flags &= ~ID_IMAGE_POOR;
    393393    mark = (image[i].dMcal > MaxScatter) || (fabs(image[i].Mcal - MedOffset) > MaxOffset);
    394394    if (mark) {
    395395      Nmark ++;
    396       image[i].code |= ID_IMAGE_POOR;
     396      image[i].flags |= ID_IMAGE_POOR;
    397397    } else {
    398       image[i].code &= ~ID_IMAGE_POOR;
     398      image[i].flags &= ~ID_IMAGE_POOR;
    399399    }
    400400  }
     
    470470  n = 0;
    471471  for (i = 0; i < Nimage; i++) {
    472     if (image[i].code & IMAGE_BAD)  continue;
     472    if (image[i].flags & IMAGE_BAD)  continue;
    473473
    474474    N = 0;
     
    512512  for (i = 0; i < Nimage; i++) {
    513513
    514     if (image[i].code & IMAGE_BAD)  continue;
     514    if (image[i].flags & IMAGE_BAD)  continue;
    515515
    516516    list[n] = pow (10.0, 0.01*image[i].Xm);
     
    540540  for (i = 0; i < Nimage; i++) {
    541541
    542     if (image[i].code & IMAGE_BAD)  continue;
     542    if (image[i].flags & IMAGE_BAD)  continue;
    543543
    544544    list[n] = image[i].Mcal;
     
    568568  for (i = 0; i < Nimage; i++) {
    569569
    570     if (image[i].code & IMAGE_BAD)  continue;
     570    if (image[i].flags & IMAGE_BAD)  continue;
    571571
    572572    list[n] = image[i].dMcal;
  • trunk/Ohana/src/relphot/src/MosaicOps.c

    r20323 r21508  
    6868    mosaic[Nmosaic].dMcal = 0.0;
    6969    mosaic[Nmosaic].Xm    = 0.0;
    70     mosaic[Nmosaic].code  = image[i].code;
     70    mosaic[Nmosaic].flags  = image[i].flags;
    7171    mosaic[Nmosaic].secz  = image[i].secz;
    7272
     
    183183      image[im].dMcal = mosaic[i].dMcal;
    184184      image[im].Xm = mosaic[i].Xm;
    185       image[im].code |= (mosaic[i].code & ID_IMAGE_FEW);
    186       image[im].code |= (mosaic[i].code & ID_IMAGE_POOR);
     185      image[im].flags |= (mosaic[i].flags & ID_IMAGE_FEW);
     186      image[im].flags |= (mosaic[i].flags & ID_IMAGE_POOR);
    187187    }
    188188  }     
     
    306306  if (i == -1) return (NAN);
    307307
    308   if (mosaic[i].code & IMAGE_BAD) return (NAN); 
     308  if (mosaic[i].flags & IMAGE_BAD) return (NAN); 
    309309  value = mosaic[i].Mcal;
    310310  return (value);
     
    343343    /* on PoorImages run, skip good images */
    344344    if (PoorImages) {
    345       bad = mosaic[i].code & (ID_IMAGE_FEW | ID_IMAGE_POOR | ID_IMAGE_SKIP);
     345      bad = mosaic[i].flags & (ID_IMAGE_FEW | ID_IMAGE_POOR | ID_IMAGE_SKIP);
    346346      if (!bad) continue;
    347347    }     
     
    393393      if (mark) {
    394394        fprintf (stderr, "marked image %s (%d), (%d < %d) || (%d < %f*%d)\n", image[imlist[i][0]].name, i, N, IMAGE_TOOFEW, N, IMAGE_GOOD_FRACTION, Nlist[i]);
    395         mosaic[i].code |= ID_IMAGE_FEW;
     395        mosaic[i].flags |= ID_IMAGE_FEW;
    396396        Nfew ++;
    397397      } else {
    398         mosaic[i].code &= ~ID_IMAGE_FEW;
     398        mosaic[i].flags &= ~ID_IMAGE_FEW;
    399399      }
    400400    }
     
    434434  n = 0;
    435435  for (i = 0; i < Nmosaic; i++) {
    436     if (mosaic[i].code & IMAGE_BAD) continue;
     436    if (mosaic[i].flags & IMAGE_BAD) continue;
    437437    list[n] = mosaic[i].Mcal;
    438438    dlist[n] = 1;
     
    462462  for (i = 0; i < Nmosaic; i++) {
    463463
    464     if (mosaic[i].code & IMAGE_BAD) continue;
     464    if (mosaic[i].flags & IMAGE_BAD) continue;
    465465    list[n] = mosaic[i].dMcal;
    466466    dlist[n] = 1;
     
    490490  n = 0;
    491491  for (i = 0; i < Nmosaic; i++) {
    492     if (mosaic[i].code & IMAGE_BAD)  continue;
     492    if (mosaic[i].flags & IMAGE_BAD)  continue;
    493493
    494494    N = 0;
     
    534534  for (i = 0; i < Nmosaic; i++) {
    535535
    536     if (mosaic[i].code & IMAGE_BAD) continue;
     536    if (mosaic[i].flags & IMAGE_BAD) continue;
    537537    list[n] = pow(10.0, 0.01*mosaic[i].Xm);
    538538    dlist[n] = 1;
     
    564564
    565565  for (i = N = 0; i < Nmosaic; i++) {
    566     if (mosaic[i].code & IMAGE_BAD) continue;
     566    if (mosaic[i].flags & IMAGE_BAD) continue;
    567567    mlist[N] = mosaic[i].Mcal;
    568568    slist[N] = mosaic[i].dMcal;
     
    584584    if (mark) {
    585585      Nmark ++;
    586       mosaic[i].code |= ID_IMAGE_POOR;
     586      mosaic[i].flags |= ID_IMAGE_POOR;
    587587    } else {
    588       mosaic[i].code &= ~ID_IMAGE_POOR;
     588      mosaic[i].flags &= ~ID_IMAGE_POOR;
    589589    }
    590590  }
  • trunk/Ohana/src/relphot/src/StarOps.c

    r21153 r21508  
    2626
    2727  ave = catalog[cat].measure[meas].averef;
    28   if (catalog[cat].average[ave].code & STAR_BAD) return (NAN); 
     28  if (catalog[cat].average[ave].flags & STAR_BAD) return (NAN); 
    2929 
    3030  value = catalog[cat].secfilt[PhotNsec*ave+PhotSec].M;
     
    4444
    4545      /* calculate the average value for a single star */
    46       if (catalog[i].average[j].code & STAR_BAD) continue; 
     46      if (catalog[i].average[j].flags & STAR_BAD) continue; 
    4747      m = catalog[i].average[j].measureOffset;
    4848
     
    8989
    9090      if (N <= STAR_TOOFEW) { /* too few measurements */
    91         catalog[i].average[j].code |= ID_STAR_FEW;
     91        catalog[i].average[j].flags |= ID_STAR_FEW;
    9292        Nfew ++;
    9393      } else {
    94         catalog[i].average[j].code &= ~ID_STAR_FEW;
     94        catalog[i].average[j].flags &= ~ID_STAR_FEW;
    9595      }
    9696
     
    208208
    209209          // XXX this is a hack for the 2MASS search; better to save an average value?
    210           if (catalog[i].measure[m].qPSF < 0.85) continue;
     210          if (catalog[i].measure[m].psfQual < 0.85) continue;
    211211
    212212          list[N] = Msys - catalog[i].measure[m].Mcal;
     
    280280  for (i = Ntot = 0; i < Ncatalog; i++) {
    281281    for (j = 0; j < catalog[i].Naverage; j++) {
    282       if (catalog[i].average[j].code & STAR_BAD) continue;
     282      if (catalog[i].average[j].flags & STAR_BAD) continue;
    283283      Xm = catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
    284284      if (Xm == -1) continue;
     
    306306      mark = (dM > MaxScatter) || (Xm == NAN_S_SHORT) || (Chisq > MaxChisq);
    307307      if (mark) {
    308         catalog[i].average[j].code |= ID_STAR_POOR;
     308        catalog[i].average[j].flags |= ID_STAR_POOR;
    309309        Ndel ++;
    310310      } else {
    311         catalog[i].average[j].code &= ~ID_STAR_POOR;
     311        catalog[i].average[j].flags &= ~ID_STAR_POOR;
    312312      }
    313313      Nave ++;
     
    351351
    352352      /* skip bad stars to prevent them from becoming good (on inner sample) */
    353       if (catalog[i].average[j].code & STAR_BAD) continue; 
     353      if (catalog[i].average[j].flags & STAR_BAD) continue; 
    354354
    355355      /* on final processing, skip stars already measured */
     
    448448
    449449      /* calculate the average value for a single star */
    450       if (catalog[i].average[j].code & STAR_BAD) continue; 
     450      if (catalog[i].average[j].flags & STAR_BAD) continue; 
    451451      m = catalog[i].average[j].measureOffset;
    452452
     
    493493
    494494      /* calculate the average value for a single star */
    495       if (catalog[i].average[j].code & STAR_BAD) continue; 
     495      if (catalog[i].average[j].flags & STAR_BAD) continue; 
    496496
    497497      Xm = catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
     
    529529
    530530      /* calculate the average value for a single star */
    531       if (catalog[i].average[j].code & STAR_BAD) continue; 
     531      if (catalog[i].average[j].flags & STAR_BAD) continue; 
    532532
    533533      dM = catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
     
    559559  for (i = 0; i < Ncatalog; i++) {
    560560    for (j = 0; j < catalog[i].Naverage; j++) {
    561       if (catalog[i].average[j].code & STAR_BAD) continue; 
     561      if (catalog[i].average[j].flags & STAR_BAD) continue; 
    562562      dMrel = catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
    563563      bin = dMrel / 0.00025;
     
    590590  for (i = 0; i < Ncatalog; i++) {
    591591    for (j = 0; j < catalog[i].Naverage; j++) {
    592       if (catalog[i].average[j].code & STAR_BAD) continue;
     592      if (catalog[i].average[j].flags & STAR_BAD) continue;
    593593      xlist[N] = catalog[i].secfilt[PhotNsec*j+PhotSec].M;
    594594      value    = catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
  • trunk/Ohana/src/relphot/src/bcatalog.c

    r20323 r21508  
    3434      subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].M  = NAN;
    3535      subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].dM = NAN;
    36       subcatalog[0].average[Naverage].code &= ~ID_STAR_FEW;
    37       subcatalog[0].average[Naverage].code &= ~ID_STAR_POOR;
     36      subcatalog[0].average[Naverage].flags &= ~ID_STAR_FEW;
     37      subcatalog[0].average[Naverage].flags &= ~ID_STAR_POOR;
    3838    }
    3939
     
    5555      /* select measurements by quality */
    5656      // XXX ignore this criterion for REF measurements?
    57       if (DophotSelect && (catalog[0].measure[offset].dophot != DophotValue)) continue;
     57      // XXX chnage this to select by bitflags
     58      if (DophotSelect && ((catalog[0].measure[offset].photFlags >> 16) != DophotValue)) continue;
    5859
    5960      /* select measurements by mag limit */
  • trunk/Ohana/src/relphot/src/plot_scatter.c

    r20193 r21508  
    2323
    2424      /* calculate the average value for a single star */
    25       if (catalog[i].average[j].code & STAR_BAD) continue; 
     25      if (catalog[i].average[j].flags & STAR_BAD) continue; 
    2626      m = catalog[i].average[j].measureOffset;
    2727
  • trunk/Ohana/src/relphot/src/relphot_objects.c

    r21153 r21508  
    4242      Nsecfilt = catalog.Nsecfilt;
    4343      for (j = 0; j < catalog.Naverage; j++) {
    44         catalog.average[j].code = 0;
     44        catalog.average[j].flags = 0;
    4545        for (k = 0; k < Nsecfilt; k++) {
    46           catalog.secfilt[j*Nsecfilt + k].M  = NAN;
    47           catalog.secfilt[j*Nsecfilt + k].dM = NAN;
    48           catalog.secfilt[j*Nsecfilt + k].Xm = NAN_S_SHORT;
     46          catalog.secfilt[j*Nsecfilt + k].M     = NAN;
     47          catalog.secfilt[j*Nsecfilt + k].M_20  = NAN_S_SHORT;
     48          catalog.secfilt[j*Nsecfilt + k].M_80  = NAN_S_SHORT;
     49          catalog.secfilt[j*Nsecfilt + k].dM    = NAN;
     50          catalog.secfilt[j*Nsecfilt + k].Xm    = NAN_S_SHORT;
    4951          catalog.secfilt[j*Nsecfilt + k].Ncode = 0;
    5052          catalog.secfilt[j*Nsecfilt + k].Nused = 0;
    51           catalog.secfilt[j*Nsecfilt + k].dummy = 0;
    5253        }
    5354        m = catalog.average[j].measureOffset;
  • trunk/Ohana/src/relphot/src/select_images.c

    r15509 r21508  
    133133      image[nimage] = timage[i];
    134134      /* always allow 'few' images to succeed, if possible */
    135       if (image[nimage].code & ID_IMAGE_FEW) {
    136         image[nimage].code &= ~(ID_IMAGE_FEW | ID_IMAGE_POOR);
     135      if (image[nimage].flags & ID_IMAGE_FEW) {
     136        image[nimage].flags &= ~(ID_IMAGE_FEW | ID_IMAGE_POOR);
    137137      }
    138138      if (RESET) {
    139139        assignMcal (&image[nimage], (double *) NULL, -1);
    140140        image[nimage].dMcal = NAN;
    141         image[nimage].code &= ~ID_IMAGE_POOR;
     141        image[nimage].flags &= ~ID_IMAGE_POOR;
    142142      }
    143143      line_number[nimage] = i;
  • trunk/Ohana/src/relphot/src/setMrelFinal.c

    r17201 r21508  
    5454  /* clear ID_STAR_POOR, ID_STAR_FEW, ID_MEAS_NOCAL values before writing ??? */
    5555  for (i = 0; i < catalog[0].Naverage; i++) {
    56     catalog[0].average[i].code &= ~ID_STAR_FEW;
    57     catalog[0].average[i].code &= ~ID_STAR_POOR;
     56    catalog[0].average[i].flags &= ~ID_STAR_FEW;
     57    catalog[0].average[i].flags &= ~ID_STAR_POOR;
    5858    m = catalog[0].average[i].measureOffset;
    5959    for (j = 0; j < catalog[0].average[i].Nmeasure; j++, m++) {
     
    102102
    103103      /* skip measurements with sat. dophot values */
    104       if ((pass < 4) && (catalog[0].measure[m].dophot == 10)) goto skip;
     104      // XXX we need to fix this: use the photFlags to ID saturation...
     105      // if ((pass < 4) && (catalog[0].measure[m].dophot == 10)) goto skip;
    105106
    106107      /* skip measurements from BAD images and mosaics */
     
    116117      }
    117118
    118       d1 = (catalog[0].measure[m].dophot == 1);
    119       d2 = (catalog[0].measure[m].dophot == 2);
     119      // d1 = (catalog[0].measure[m].dophot == 1);
     120      // d2 = (catalog[0].measure[m].dophot == 2);
     121      fprintf (stderr, "fix the dophot / type selections!");
     122      abort ();
    120123
    121124      /* skip measurements by measurement error */
  • trunk/Ohana/src/uniphot/src/find_image_sgroups.c

    r7080 r21508  
    2727  for (i = 0; i < Nimage; i++) {
    2828    if (imlink[i].sgroup != NULL) continue;
    29     if (image[i].code & ID_IMAGE_NOCAL) continue;
     29    if (image[i].flags & ID_IMAGE_NOCAL) continue;
    3030
    3131    /* new sgroup, set ref coords */
     
    5252
    5353    for (j = 0; j < Nimage; j++) {
    54       if (image[j].code & ID_IMAGE_NOCAL) continue;
     54      if (image[j].flags & ID_IMAGE_NOCAL) continue;
    5555      if (imlink[j].sgroup != NULL) continue;
    5656
  • trunk/Ohana/src/uniphot/src/find_image_tgroups.c

    r16040 r21508  
    6363      if (image[j].tzero < tmin[i]) continue;
    6464      if (image[j].tzero > tmax[i]) continue;
    65       if (image[j].code & ID_IMAGE_NOCAL) continue;
     65      if (image[j].flags & ID_IMAGE_NOCAL) continue;
    6666     
    6767      group[i].image[Nentry] = &image[j];
  • trunk/Ohana/src/uniphot/src/fit_groups.c

    r12332 r21508  
    1616  for (i = 0; i < Ntgroup; i++) {
    1717    for (j = Nlist = 0; j < tgroup[i].Nimage; j++) {
    18       if (tgroup[i].image[j][0].code & IMAGE_BAD) continue;
     18      if (tgroup[i].image[j][0].flags & IMAGE_BAD) continue;
    1919      sgroup = (Group *) tgroup[i].imlink[j][0].sgroup;
    2020      Mcal = tgroup[i].image[j][0].Mcal;
     
    5454  for (i = 0; i < Nsgroup; i++) {
    5555    for (j = Nlist = 0; j < sgroup[i].Nimage; j++) {
    56       if (sgroup[i].image[j][0].code & IMAGE_BAD) continue;
     56      if (sgroup[i].image[j][0].flags & IMAGE_BAD) continue;
    5757      tgroup = (Group *) sgroup[i].imlink[j][0].tgroup;
    5858      Mcal = sgroup[i].image[j][0].Mcal;
  • trunk/Ohana/src/uniphot/src/subset_images.c

    r12332 r21508  
    1616  for (i = 0; i < Nimage; i++) {
    1717     
    18     image[i].code |= ID_IMAGE_NOCAL;
     18    image[i].flags |= ID_IMAGE_NOCAL;
    1919
    2020    /* select images by photcode */
     
    2727      if (image[i].tzero > TSTOP) continue;
    2828    }
    29     image[i].code &= ~ID_IMAGE_NOCAL;
     29    image[i].flags &= ~ID_IMAGE_NOCAL;
    3030    keep[Nkeep] = i;
    3131    Nkeep ++;
  • trunk/Ohana/src/uniphot/src/update.c

    r19823 r21508  
    1616  /* clear the NOCAL flags */
    1717  for (i = 0; i < Nimage; i++) {
    18     image[i].code &= ~ID_IMAGE_NOCAL;
     18    image[i].flags &= ~ID_IMAGE_NOCAL;
    1919  }
    2020
Note: See TracChangeset for help on using the changeset viewer.