IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37246 for trunk/Ohana


Ignore:
Timestamp:
Aug 12, 2014, 4:10:18 PM (12 years ago)
Author:
eugene
Message:

merge changes from branches/eam_branches/ipp-20140717

Location:
trunk/Ohana
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/addstar/src/ReadStarsFITS.c

    r37036 r37246  
    182182    stars[i].measure.psfNdof    = NAN_S_INT; // not provided by SMPDATA:
    183183    stars[i].measure.psfNpix    = NAN_S_INT; // not provided by SMPDATA:
    184     stars[i].measure.crNsigma   = NAN;       // not provided by SMPDATA:
    185184    stars[i].measure.extNsigma  = NAN;       // not provided by SMPDATA:
    186185
     
    251250    stars[i].measure.psfNdof    = NAN_S_INT; // not provided by PS1_DEV_0:
    252251    stars[i].measure.psfNpix    = NAN_S_INT; // not provided by PS1_DEV_0:
    253     stars[i].measure.crNsigma   = NAN;       // not provided by PS1_DEV_0:
    254252    stars[i].measure.extNsigma  = NAN;        // not provided by PS1_DEV_0:
    255253
     
    323321    stars[i].measure.psfNdof    = NAN_S_INT; // not provided by PS1_DEV_1:
    324322    stars[i].measure.psfNpix    = NAN_S_INT; // not provided by PS1_DEV_1:
    325     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    326323    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    327324
     
    408405    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    409406    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    410     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    411407    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    412408
     
    494490    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    495491    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    496     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    497492    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    498493
     
    572567    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    573568    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    574     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    575569    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    576570
     
    653647    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    654648    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    655     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    656649    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    657650
     
    665658                       
    666659    stars[i].measure.photFlags  = ps1data[i].flags;
     660    stars[i].measure.photFlags2 = ps1data[i].flags2;
    667661
    668662    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     
    738732    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    739733    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    740     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    741734    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    742735
     
    750743                       
    751744    stars[i].measure.photFlags  = ps1data[i].flags;
     745    stars[i].measure.photFlags2 = ps1data[i].flags2;
    752746
    753747    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     
    823817    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    824818    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    825     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    826819    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    827820
     
    835828                       
    836829    stars[i].measure.photFlags  = ps1data[i].flags;
     830    stars[i].measure.photFlags2 = ps1data[i].flags2;
    837831
    838832    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     
    908902    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    909903    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    910     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    911904    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    912905
     
    920913                       
    921914    stars[i].measure.photFlags  = ps1data[i].flags;
     915    stars[i].measure.photFlags2 = ps1data[i].flags2;
    922916
    923917    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     
    10381032    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    10391033    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    1040     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    10411034    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    10421035
     
    10501043                       
    10511044    stars[i].measure.photFlags  = ps1data[i].flags;
     1045    stars[i].measure.photFlags2 = ps1data[i].flags2;
    10521046
    10531047    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     
    11201114    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    11211115    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    1122     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    11231116    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    11241117
     
    11321125                       
    11331126    stars[i].measure.photFlags  = ps1data[i].flags;
     1127    stars[i].measure.photFlags2 = ps1data[i].flags2;
    11341128
    11351129    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     
    12021196    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    12031197    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    1204     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    12051198    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    12061199
     
    12141207                       
    12151208    stars[i].measure.photFlags  = ps1data[i].flags;
     1209    stars[i].measure.photFlags2 = ps1data[i].flags2;
    12161210
    12171211    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     
    12841278    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    12851279    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    1286     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    12871280    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    12881281
     
    12961289                       
    12971290    stars[i].measure.photFlags  = ps1data[i].flags;
     1291    stars[i].measure.photFlags2 = ps1data[i].flags2;
    12981292
    12991293    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     
    13651359    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    13661360    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    1367     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    13681361    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    13691362
     
    13771370                       
    13781371    stars[i].measure.photFlags  = ps1data[i].flags;
     1372    stars[i].measure.photFlags2 = ps1data[i].flags2;
    13791373
    13801374    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     
    14511445    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    14521446    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
    1453     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    14541447    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    14551448
     
    14631456                       
    14641457    stars[i].measure.photFlags  = ps1data[i].flags;
     1458    stars[i].measure.photFlags2 = ps1data[i].flags2;
    14651459
    14661460    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
  • trunk/Ohana/src/addstar/src/mkcmf.c

    r37036 r37246  
    3131static Coords coords;
    3232
     33static char reserved[] =  "Reserved space.  This line can be used to add a new FITS card.";
     34
    3335int main (int argc, char **argv) {
    3436
     
    305307  PutCoords (&coords, &header);
    306308  gfits_modify (&header, "EXTNAME",   "%s", 1, exthead);
     309
     310  int i;
     311  for (i = 1; i < 32; i++) {
     312    gfits_modify_alt (&header, "COMMENT", "%C", i, reserved);
     313  }
    307314
    308315  ftable.header = &theader;
  • trunk/Ohana/src/dvopsps/include/dvopsps.h

    r36188 r37246  
    99
    1010typedef struct {
    11   int imageID;
    12   unsigned int ippDetectID;
     11  uint64_t objID;
    1312  uint64_t detectID;
    1413  uint64_t ippObjID;
    15   uint64_t objID;
    16   int      photcode;
    17   unsigned int flags;
    18   float zp;
    19   float zpErr;
    20   float airMass;
    21   float expTime;
     14  unsigned int ippDetectID;
     15  int imageID;
     16  int catID;
    2217  double ra;
    2318  double dec;
    2419  float raErr;
    2520  float decErr;
     21  float zp;
     22  float telluricExt;
     23  float airmass;
     24  float expTime;
     25
     26  float Mpsf;
     27  float dMpsf;
     28  float Mkron;
     29  float dMkron;
     30  float Map;
     31  float dMap;
     32
     33  unsigned int flags;
    2634} Detections;
    2735
     
    7886     
    7987int    insert_detections_mysql_commit     PROTO((IOBuffer *buffer, MYSQL *mysql));
    80 int    insert_detections_mysql_value      PROTO((IOBuffer *buffer, Average *average, Measure *measure));
     88// int    insert_detections_mysql_value      PROTO((IOBuffer *buffer, Average *average, Measure *measure));
    8189int    insert_detections_mysql_init       PROTO((IOBuffer *buffer));
    8290
    8391int    insert_detections_mysql_array      PROTO((MYSQL *mysql, Detections *detections, int Ndetections));
    8492int    insert_detections_mysql_detvalue   PROTO((IOBuffer *buffer, Detections *detection));
     93int    assign_detection_values            PROTO((Detections *detection, Measure *measure, Average *average));
    8594
    8695int    init_detections                    PROTO(());
  • trunk/Ohana/src/dvopsps/src/DetectionOps.c

    r35578 r37246  
    11# include "dvopsps.h"
    2 # define BZERO_INT16 1.0*0x8000
    3 # define BZERO_INT32 1.0*0x80000000
    4 # define BZERO_INT64 1.0*0x8000000000000000
    52
    63# define GET_COLUMN(OUT,NAME,TYPE)                                      \
     
    4946 
    5047  // need to create and assign to flat-field correction
    51   GET_COLUMN(imageID     , "imageID",     int);
    52   GET_COLUMN(ippDetectID , "ippDetectID", int);
     48  GET_COLUMN(objID       , "objID",       int64_t);
    5349  GET_COLUMN(detectID    , "detectID",    int64_t);
    5450  GET_COLUMN(ippObjID    , "ippObjID",    int64_t);
    55   GET_COLUMN(objID       , "objID",       int64_t);
    56   GET_COLUMN(photcode    , "photcode",    int);
    57   GET_COLUMN(flags       , "flags",       int);
    58   GET_COLUMN(zp          , "zp",          float);
    59   GET_COLUMN(zpErr       , "zpErr",       float);
    60   GET_COLUMN(airMass     , "airMass",     float);
    61   GET_COLUMN(expTime     , "expTime",     float);
     51  GET_COLUMN(ippDetectID , "ippDetectID", int);
     52  GET_COLUMN(imageID     , "imageID",     int);
     53  GET_COLUMN(catID       , "catID",       int);
    6254  GET_COLUMN(ra          , "ra",          double); // XXX signed vs unsigned?
    6355  GET_COLUMN(dec         , "dec",         double);
    6456  GET_COLUMN(raErr       , "raErr",       float);
    6557  GET_COLUMN(decErr      , "decErr",      float);
     58  GET_COLUMN(zp          , "zp",          float);
     59  GET_COLUMN(telluricExt , "telluricExt", float);
     60  GET_COLUMN(airmass     , "airmass",     float);
     61  GET_COLUMN(expTime     , "expTime",     float);
     62  GET_COLUMN(Mpsf        , "Mpsf",        float);
     63  GET_COLUMN(dMpsf       , "dMpsf",       float);
     64  GET_COLUMN(Mkron       , "Mkron",       float);
     65  GET_COLUMN(dMkron      , "dMkron",      float);
     66  GET_COLUMN(Map         , "Map",         float);
     67  GET_COLUMN(dMap        , "dMap",        float);
     68  GET_COLUMN(flags       , "flags",       int);
    6669  gfits_free_header (&theader);
    6770  gfits_free_table  (&ftable);
     
    6972  ALLOCATE (detections, Detections, Nrow);
    7073  for (i = 0; i < Nrow; i++) {
    71     detections[i].imageID      = imageID[i];   
    72     detections[i].ippDetectID  = ippDetectID[i];
     74    detections[i].objID        = objID[i];     
    7375    detections[i].detectID     = detectID[i];   
    7476    detections[i].ippObjID     = ippObjID[i];   
    75     detections[i].objID        = objID[i];     
    76     detections[i].photcode     = photcode[i];     
    77     detections[i].flags        = flags[i];     
    78     detections[i].zp           = zp[i];         
    79     detections[i].zpErr        = zpErr[i];     
    80     detections[i].airMass      = airMass[i];   
    81     detections[i].expTime      = expTime[i];   
     77    detections[i].ippDetectID  = ippDetectID[i];
     78    detections[i].imageID      = imageID[i];   
     79    detections[i].catID        = catID[i];   
    8280    detections[i].ra           = ra[i];         
    8381    detections[i].dec          = dec[i];       
    8482    detections[i].raErr        = raErr[i];     
    8583    detections[i].decErr       = decErr[i];     
     84    detections[i].zp           = zp[i];         
     85    detections[i].telluricExt  = telluricExt[i];     
     86    detections[i].airmass      = airmass[i];   
     87    detections[i].expTime      = expTime[i];   
     88    detections[i].Mpsf         = Mpsf[i];   
     89    detections[i].dMpsf        = dMpsf[i];   
     90    detections[i].Mkron        = Mkron[i];   
     91    detections[i].dMkron       = dMkron[i];   
     92    detections[i].Map          = Map[i];   
     93    detections[i].dMap         = dMap[i];   
     94    detections[i].flags        = flags[i];     
    8695  }
    8796  fprintf (stderr, "loaded data for %lld detections\n", (long long) Nrow);
    8897
    89   free (imageID    );
    90   free (ippDetectID);
     98  free (objID      );
    9199  free (detectID   );
    92100  free (ippObjID   );
    93   free (objID      );
    94   free (photcode   );
    95   free (flags      );
    96   free (zp         );
    97   free (zpErr      );
    98   free (airMass    );
    99   free (expTime    );
     101  free (ippDetectID);
     102  free (imageID    );
     103  free (catID      );
    100104  free (ra         );
    101105  free (dec        );
    102106  free (raErr      );
    103107  free (decErr     );
     108  free (zp         );
     109  free (telluricExt);
     110  free (airmass    );
     111  free (expTime    );
     112  free (Mpsf       );
     113  free (dMpsf      );
     114  free (Mkron      );
     115  free (dMkron     );
     116  free (Map        );
     117  free (dMap       );
     118  free (flags      );
    104119
    105120  gfits_free_header (&header);
     
    149164
    150165  // XXX need to get the bzero values right
    151   gfits_define_bintable_column (&theader, "J", "imageID",     NULL, NULL, 1.0, BZERO_INT32);
    152   gfits_define_bintable_column (&theader, "J", "ippDetectID", NULL, NULL, 1.0, BZERO_INT32);
     166  gfits_define_bintable_column (&theader, "K", "objID",       NULL, NULL, 1.0, 0);
    153167  gfits_define_bintable_column (&theader, "K", "detectID",    NULL, NULL, 1.0, 0);
    154168  gfits_define_bintable_column (&theader, "K", "ippObjID",    NULL, NULL, 1.0, 0);
    155   gfits_define_bintable_column (&theader, "K", "objID",       NULL, NULL, 1.0, 0);
    156   // gfits_define_bintable_column (&theader, "K", "detectID",    NULL, NULL, 1.0, BZERO_INT64);
    157   // gfits_define_bintable_column (&theader, "K", "ippObjID",    NULL, NULL, 1.0, BZERO_INT64);
    158   // gfits_define_bintable_column (&theader, "K", "objID",       NULL, NULL, 1.0, BZERO_INT64);
    159   gfits_define_bintable_column (&theader, "J", "photcode",    NULL, NULL, 1.0, 0.0);
    160   gfits_define_bintable_column (&theader, "J", "flags",       NULL, NULL, 1.0, BZERO_INT32);
    161   gfits_define_bintable_column (&theader, "E", "zp",          NULL, NULL, 1.0, 0.0);
    162   gfits_define_bintable_column (&theader, "E", "zpErr",       NULL, NULL, 1.0, 0.0);
    163   gfits_define_bintable_column (&theader, "E", "airMass",     NULL, NULL, 1.0, 0.0);
    164   gfits_define_bintable_column (&theader, "E", "expTime",     NULL, NULL, 1.0, 0.0);
     169  gfits_define_bintable_column (&theader, "J", "ippDetectID", NULL, NULL, 1.0, FT_BZERO_INT32);
     170  gfits_define_bintable_column (&theader, "J", "imageID",     NULL, NULL, 1.0, FT_BZERO_INT32);
     171  gfits_define_bintable_column (&theader, "J", "catID",       NULL, NULL, 1.0, FT_BZERO_INT32);
    165172  gfits_define_bintable_column (&theader, "D", "ra",          NULL, NULL, 1.0, 0.0);
    166173  gfits_define_bintable_column (&theader, "D", "dec",         NULL, NULL, 1.0, 0.0);
    167174  gfits_define_bintable_column (&theader, "E", "raErr",       NULL, NULL, 1.0, 0.0);
    168175  gfits_define_bintable_column (&theader, "E", "decErr",      NULL, NULL, 1.0, 0.0);
     176  gfits_define_bintable_column (&theader, "E", "zp",          NULL, NULL, 1.0, 0.0);
     177  gfits_define_bintable_column (&theader, "E", "telluricExt", NULL, NULL, 1.0, 0.0);
     178  gfits_define_bintable_column (&theader, "E", "airmass",     NULL, NULL, 1.0, 0.0);
     179  gfits_define_bintable_column (&theader, "E", "expTime",     NULL, NULL, 1.0, 0.0);
     180  gfits_define_bintable_column (&theader, "E", "Mpsf",        NULL, NULL, 1.0, 0.0);
     181  gfits_define_bintable_column (&theader, "E", "dMpsf",       NULL, NULL, 1.0, 0.0);
     182  gfits_define_bintable_column (&theader, "E", "Mkron",       NULL, NULL, 1.0, 0.0);
     183  gfits_define_bintable_column (&theader, "E", "dMkron",      NULL, NULL, 1.0, 0.0);
     184  gfits_define_bintable_column (&theader, "E", "Map",         NULL, NULL, 1.0, 0.0);
     185  gfits_define_bintable_column (&theader, "E", "dMap",        NULL, NULL, 1.0, 0.0);
     186  gfits_define_bintable_column (&theader, "J", "flags",       NULL, NULL, 1.0, FT_BZERO_INT32);
    169187
    170188  // generate the output array that carries the data
     
    172190
    173191  // create intermediate storage arrays
    174    int32_t   *imageID     ; ALLOCATE (imageID     ,   int32_t, Ndetections);
    175   uint32_t   *ippDetectID ; ALLOCATE (ippDetectID ,  uint32_t, Ndetections);
     192  uint64_t   *objID       ; ALLOCATE (objID       ,  uint64_t, Ndetections);
    176193  uint64_t   *detectID    ; ALLOCATE (detectID    ,  uint64_t, Ndetections);
    177194  uint64_t   *ippObjID    ; ALLOCATE (ippObjID    ,  uint64_t, Ndetections);
    178   uint64_t   *objID       ; ALLOCATE (objID       ,  uint64_t, Ndetections);
    179   int        *photcode    ; ALLOCATE (photcode    ,  int,      Ndetections);
    180   uint32_t   *flags       ; ALLOCATE (flags       ,  uint32_t, Ndetections);
    181   float      *zp          ; ALLOCATE (zp          ,  float,    Ndetections);
    182   float      *zpErr       ; ALLOCATE (zpErr       ,  float,    Ndetections);
    183   float      *airMass     ; ALLOCATE (airMass     ,  float,    Ndetections);
    184   float      *expTime     ; ALLOCATE (expTime     ,  float,    Ndetections);
     195  uint32_t   *ippDetectID ; ALLOCATE (ippDetectID ,  uint32_t, Ndetections);
     196   int32_t   *imageID     ; ALLOCATE (imageID     ,   int32_t, Ndetections);
     197   int32_t   *catID       ; ALLOCATE (catID       ,   int32_t, Ndetections);
    185198  double     *ra          ; ALLOCATE (ra          ,  double,   Ndetections);
    186199  double     *dec         ; ALLOCATE (dec         ,  double,   Ndetections);
    187200  float      *raErr       ; ALLOCATE (raErr       ,  float,    Ndetections);
    188201  float      *decErr      ; ALLOCATE (decErr      ,  float,    Ndetections);
     202  float      *zp          ; ALLOCATE (zp          ,  float,    Ndetections);
     203  float      *telluricExt ; ALLOCATE (telluricExt ,  float,    Ndetections);
     204  float      *airmass     ; ALLOCATE (airmass     ,  float,    Ndetections);
     205  float      *expTime     ; ALLOCATE (expTime     ,  float,    Ndetections);
     206  float      *Mpsf        ; ALLOCATE (Mpsf        ,  float,    Ndetections);
     207  float      *dMpsf       ; ALLOCATE (dMpsf       ,  float,    Ndetections);
     208  float      *Mkron       ; ALLOCATE (Mkron       ,  float,    Ndetections);
     209  float      *dMkron      ; ALLOCATE (dMkron      ,  float,    Ndetections);
     210  float      *Map         ; ALLOCATE (Map         ,  float,    Ndetections);
     211  float      *dMap        ; ALLOCATE (dMap        ,  float,    Ndetections);
     212  uint32_t   *flags       ; ALLOCATE (flags       ,  uint32_t, Ndetections);
    189213
    190214  // assign the storage arrays
    191215  for (i = 0; i < Ndetections; i++) {
    192     imageID[i]     = detections[i].imageID     ;
    193     ippDetectID[i] = detections[i].ippDetectID ;
     216    objID[i]       = detections[i].objID       ;
    194217    detectID[i]    = detections[i].detectID    ;
    195218    ippObjID[i]    = detections[i].ippObjID    ;
    196     objID[i]       = detections[i].objID       ;
    197     photcode[i]    = detections[i].photcode    ;
    198     flags[i]       = detections[i].flags       ;
    199     zp[i]          = detections[i].zp          ;
    200     zpErr[i]       = detections[i].zpErr       ;
    201     airMass[i]     = detections[i].airMass     ;
    202     expTime[i]     = detections[i].expTime     ;
     219    ippDetectID[i] = detections[i].ippDetectID ;
     220    imageID[i]     = detections[i].imageID     ;
     221    catID[i]       = detections[i].catID       ;
    203222    ra[i]          = detections[i].ra          ;
    204223    dec[i]         = detections[i].dec         ;
    205224    raErr[i]       = detections[i].raErr       ;
    206225    decErr[i]      = detections[i].decErr      ;
     226    zp[i]          = detections[i].zp          ;
     227    telluricExt[i] = detections[i].telluricExt ;
     228    airmass[i]     = detections[i].airmass     ;
     229    expTime[i]     = detections[i].expTime     ;
     230    Mpsf[i]        = detections[i].Mpsf        ;
     231    dMpsf[i]       = detections[i].dMpsf       ;
     232    Mkron[i]       = detections[i].Mkron       ;
     233    dMkron[i]      = detections[i].dMkron      ;
     234    Map[i]         = detections[i].Map         ;
     235    dMap[i]        = detections[i].dMap        ;
     236    flags[i]       = detections[i].flags       ;
    207237  }
    208238
    209239  // add the columns to the output array
    210   gfits_set_bintable_column (&theader, &ftable, "imageID",     imageID     , Ndetections);
    211   gfits_set_bintable_column (&theader, &ftable, "ippDetectID", ippDetectID , Ndetections);
     240  gfits_set_bintable_column (&theader, &ftable, "objID",       objID       , Ndetections);
    212241  gfits_set_bintable_column (&theader, &ftable, "detectID",    detectID    , Ndetections);
    213242  gfits_set_bintable_column (&theader, &ftable, "ippObjID",    ippObjID    , Ndetections);
    214   gfits_set_bintable_column (&theader, &ftable, "objID",       objID       , Ndetections);
    215   gfits_set_bintable_column (&theader, &ftable, "photcode",    photcode    , Ndetections);
    216   gfits_set_bintable_column (&theader, &ftable, "flags",       flags       , Ndetections);
    217   gfits_set_bintable_column (&theader, &ftable, "zp",          zp          , Ndetections);
    218   gfits_set_bintable_column (&theader, &ftable, "zpErr",       zpErr       , Ndetections);
    219   gfits_set_bintable_column (&theader, &ftable, "airMass",     airMass     , Ndetections);
    220   gfits_set_bintable_column (&theader, &ftable, "expTime",     expTime     , Ndetections);
     243  gfits_set_bintable_column (&theader, &ftable, "ippDetectID", ippDetectID , Ndetections);
     244  gfits_set_bintable_column (&theader, &ftable, "imageID",     imageID     , Ndetections);
     245  gfits_set_bintable_column (&theader, &ftable, "catID",       catID       , Ndetections);
    221246  gfits_set_bintable_column (&theader, &ftable, "ra",          ra          , Ndetections);
    222247  gfits_set_bintable_column (&theader, &ftable, "dec",         dec         , Ndetections);
    223248  gfits_set_bintable_column (&theader, &ftable, "raErr",       raErr       , Ndetections);
    224249  gfits_set_bintable_column (&theader, &ftable, "decErr",      decErr      , Ndetections);
    225 
    226   free (imageID     );
    227   free (ippDetectID );
     250  gfits_set_bintable_column (&theader, &ftable, "zp",          zp          , Ndetections);
     251  gfits_set_bintable_column (&theader, &ftable, "telluricExt", telluricExt , Ndetections);
     252  gfits_set_bintable_column (&theader, &ftable, "airmass",     airmass     , Ndetections);
     253  gfits_set_bintable_column (&theader, &ftable, "expTime",     expTime     , Ndetections);
     254  gfits_set_bintable_column (&theader, &ftable, "Mpsf",        Mpsf        , Ndetections);
     255  gfits_set_bintable_column (&theader, &ftable, "dMpsf",       dMpsf       , Ndetections);
     256  gfits_set_bintable_column (&theader, &ftable, "Mkron",       Mkron       , Ndetections);
     257  gfits_set_bintable_column (&theader, &ftable, "dMkron",      dMkron      , Ndetections);
     258  gfits_set_bintable_column (&theader, &ftable, "Map",         Map         , Ndetections);
     259  gfits_set_bintable_column (&theader, &ftable, "dMap",        dMap        , Ndetections);
     260  gfits_set_bintable_column (&theader, &ftable, "flags",       flags       , Ndetections);
     261
     262  free (objID       );
    228263  free (detectID    );
    229264  free (ippObjID    );
    230   free (objID       );
    231   free (photcode    );
    232   free (flags       );
    233   free (zp          );
    234   free (zpErr       );
    235   free (airMass     );
    236   free (expTime     );
     265  free (ippDetectID );
     266  free (imageID     );
     267  free (catID       );
    237268  free (ra          );
    238269  free (dec         );
    239270  free (raErr       );
    240271  free (decErr      );
     272  free (zp          );
     273  free (telluricExt );
     274  free (airmass     );
     275  free (expTime     );
     276  free (Mpsf        );
     277  free (dMpsf       );
     278  free (Mkron       );
     279  free (dMkron      );
     280  free (Map         );
     281  free (dMap        );
     282  free (flags       );
    241283
    242284  gfits_fwrite_Theader (f, &theader);
  • trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps.c

    r37048 r37246  
    281281}
    282282
    283 # define PRINT_FLOAT(BUFFER,FIELD,FORMAT)                 \
    284   if (!isfinite(FIELD)) PrintIOBuffer (BUFFER, "NULL, "); \
    285   else PrintIOBuffer (BUFFER, FORMAT, FIELD);
    286 
    287 int insert_detections_mysql_detvalue (IOBuffer *buffer, Detections *detection) {
    288 
    289   PrintIOBuffer (buffer, "(%d, ", detection->imageID);    // imageID
    290   PrintIOBuffer (buffer, "%u, ", detection->ippDetectID); // ippDetectID
    291   PrintIOBuffer (buffer, "%lu, ", detection->detectID);   // detectID
    292   PrintIOBuffer (buffer, "%lu, ", detection->ippObjID);   // ippObjID
    293   PrintIOBuffer (buffer, "%lu, ", detection->objID);      // objID
    294   PrintIOBuffer (buffer, "%u, ", detection->flags);       // flags
    295   PRINT_FLOAT(buffer, detection->zp,      "%.6f, ");
    296   PRINT_FLOAT(buffer, detection->zpErr,   "%.6f, ");
    297   PRINT_FLOAT(buffer, detection->airMass, "%.6f, ");
    298   PRINT_FLOAT(buffer, detection->expTime, "%.6f, ");
    299   PRINT_FLOAT(buffer, detection->ra,      "%.8f, ");
    300   PRINT_FLOAT(buffer, detection->dec,     "%.8f, ");
    301   PRINT_FLOAT(buffer, detection->raErr,   "%.6f, ");
    302   PRINT_FLOAT(buffer, detection->decErr,  "%.6f),\n");
    303   return TRUE;
    304 }
  • trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c

    r37048 r37246  
    66Detections *detections = NULL;
    77
     8static float ZeroPoint = 25.0;
     9
    810int init_detections () {
    911  NDETECTIONS = 1000;
     
    1517
    1618  off_t i, j;
     19
     20  ZeroPoint = GetZeroPoint();
    1721
    1822  int missingID = 0;
     
    4751      if (measure->photcode >=  PHOTCODE_END) continue;
    4852
    49       PhotCode *code = GetPhotcodebyCode(measure->photcode);
    50 
    51       detections[Ndetections].imageID     = measure->imageID;    // imageID
    52       detections[Ndetections].ippDetectID = measure->detID;   // ippDetectID
    53       detections[Ndetections].detectID    = measure->extID;   // detectID
    54       detections[Ndetections].ippObjID    = ((uint64_t)average->catID * 1000000000) + (uint64_t)average->objID; // ippObjID
    55       // NOTE: this is better, but the above is the current ippToPsps value
    56       // detections[Ndetections]. ((uint64_t)average->catID << 32) + (uint64_t)average->objID; // ippObjID
    57       detections[Ndetections].objID        = average->extID;   // objID
    58       detections[Ndetections].photcode     = measure->photcode;   // photcode
    59       detections[Ndetections].flags        = measure->dbFlags;  // flags
    60       detections[Ndetections].zp           = code->C * 0.001 + code->K * (measure->airmass - 1) - measure->Mcal;   // zp
    61       detections[Ndetections].zpErr        = measure->dMcal;    // zpErr
    62       detections[Ndetections].airMass      = measure->airmass;
    63       detections[Ndetections].expTime      = pow(10.0, 0.4 * measure->dt);    // expTime
    64       detections[Ndetections].ra           = measure->R;    // ra
    65       detections[Ndetections].dec          = measure->D;    // dec
    66       detections[Ndetections].raErr        = measure->dXccd * 0.01 * fabs(measure->pltscale); // estimate of raErr
    67       detections[Ndetections].decErr       = measure->dYccd * 0.01 * fabs(measure->pltscale); // estimate of decErr
    68 
     53      assign_detection_values (&detections[Ndetections], measure, average);
    6954      Ndetections ++;
     55
    7056      myAssert (Ndetections <= NDETECTIONS, "programming error");
    7157    }
     
    10995
    11096  off_t found = 0;
     97
     98  ZeroPoint = GetZeroPoint();
    11199
    112100  INITTIME;
     
    143131
    144132      // XXX check return status
    145       if (!insert_detections_mysql_value (&buffer, &average[i], &measure[Nmeas])) {
     133      Detections detection;
     134      assign_detection_values (&detection, &measure[Nmeas], &average[i]);
     135
     136      if (!insert_detections_mysql_detvalue (&buffer, &detection)) {
    146137        fprintf (stderr, "failure to insert detections in mysql\n");
    147138        status = FALSE;
     
    194185  }
    195186
    196   // PrintIOBuffer (buffer, "INSERT INTO dvoDetectionFull (imageID, ippDetectID, detectID, ippObjID, objID, photcode, flags, zp, zpErr, airMass, expTime, ra, dec_, raErr, decErr) VALUES \n");
    197   PrintIOBuffer (buffer, "INSERT INTO dvoDetectionFull (imageID, ippDetectID, detectID, ippObjID, objID, flags, zp, zpErr, airMass, expTime, ra, dec_, raErr, decErr) VALUES \n");
    198 
    199   return TRUE;
    200 }
    201 
    202 # define PRINT_FLOAT(BUFFER,FIELD,FORMAT)                 \
    203   if (isinf(FIELD) || isnan(FIELD)) PrintIOBuffer (BUFFER, "NULL, ");   \
    204   else PrintIOBuffer (BUFFER, FORMAT, FIELD);
    205 
    206 int insert_detections_mysql_value (IOBuffer *buffer, Average *average, Measure *measure) {
    207 
    208   PhotCode *code = GetPhotcodebyCode(measure->photcode);
    209   PrintIOBuffer (buffer, "(%d, ", measure->imageID);      // imageID
    210   PrintIOBuffer (buffer, "%u, ", measure->detID); // ippDetectID
    211   PrintIOBuffer (buffer, "%lu, ", measure->extID);        // detectID
    212   PrintIOBuffer (buffer, "%lu, ", ((uint64_t)average->catID * 1000000000) + (uint64_t)average->objID);    // ippObjID
    213   // NOTE: the following is better, but the above is the current ippToPsps value
    214   // ((uint64_t)average->catID << 32) + (uint64_t)average->objID, // ippObjID
    215   PrintIOBuffer (buffer, "%lu, ", average->extID);        // objID
    216   // XXX PrintIOBuffer (buffer, "%d, ", measure->photcode);       // photcode
    217   PrintIOBuffer (buffer, "%u, ", measure->dbFlags);       // flags
    218 
    219   float zp = code->C * 0.001 + code->K * (measure->airmass - 1) - measure->Mcal;
    220   float exptime = pow(10.0, 0.4 * measure->dt);
    221   double ra  = measure->R;
    222   double dec = measure->D;
    223   double dR = measure->dXccd * 0.01 * fabs(measure->pltscale);
    224   double dD = measure->dYccd * 0.01 * fabs(measure->pltscale);
    225 
    226   PRINT_FLOAT(buffer, zp,               "%.6f, ");
    227   PRINT_FLOAT(buffer, measure->dMcal,   "%.6f, ");
    228   PRINT_FLOAT(buffer, measure->airmass, "%.6f, ");
    229   PRINT_FLOAT(buffer, exptime,          "%.6f, ");
    230   PRINT_FLOAT(buffer, ra,               "%.8f, ");
    231   PRINT_FLOAT(buffer, dec,              "%.8f, ");
    232   PRINT_FLOAT(buffer, dR,               "%.6f, ");
    233   PRINT_FLOAT(buffer, dD,               "%.6f),\n");
    234  
    235   return TRUE;
    236 }
    237    
     187  PrintIOBuffer (buffer, "INSERT INTO dvoDetectionFull (objID, detectID, ippObjID, ippDetectID, imageID, catID, ");
     188  PrintIOBuffer (buffer, "ra, dec_, raErr, decErr, zp, telluricExt, airmass, expTime, ");
     189  PrintIOBuffer (buffer, "Mpsf, dMpsf, Mkron, dMkron, Map, dMap, flags) VALUES \n");
     190
     191  return TRUE;
     192}
     193
    238194int insert_detections_mysql_commit (IOBuffer *buffer, MYSQL *mysql) {
    239195
     
    270226  return status;
    271227}
     228
     229# define PRINT_FLOAT(BUFFER,FIELD,FORMAT)                 \
     230  if (!isfinite(FIELD)) PrintIOBuffer (BUFFER, "NULL, "); \
     231  else PrintIOBuffer (BUFFER, FORMAT, FIELD);
     232
     233int insert_detections_mysql_detvalue (IOBuffer *buffer, Detections *detection) {
     234
     235  PrintIOBuffer (buffer, "(%lu, ", detection->objID);       // objID
     236  PrintIOBuffer (buffer,  "%lu, ", detection->detectID);    // detectID
     237  PrintIOBuffer (buffer,  "%lu, ", detection->ippObjID);    // ippObjID
     238  PrintIOBuffer (buffer,  "%u,  ", detection->ippDetectID); // ippDetectID
     239  PrintIOBuffer (buffer,  "%d,  ", detection->imageID);     // imageID
     240  PrintIOBuffer (buffer,  "%d,  ", detection->catID);       // DVO Catalog ID
     241
     242  PRINT_FLOAT(buffer, detection->ra,          "%.8f, ");
     243  PRINT_FLOAT(buffer, detection->dec,         "%.8f, ");
     244  PRINT_FLOAT(buffer, detection->raErr,       "%.6f, ");
     245  PRINT_FLOAT(buffer, detection->decErr,      "%.6f, ");
     246  PRINT_FLOAT(buffer, detection->zp,          "%.6f, ");
     247  PRINT_FLOAT(buffer, detection->telluricExt, "%.6f, ");
     248  PRINT_FLOAT(buffer, detection->airmass,     "%.6f, ");
     249  PRINT_FLOAT(buffer, detection->expTime,     "%.6f, ");
     250
     251  PRINT_FLOAT(buffer, detection->Mpsf,        "%.6f, ");
     252  PRINT_FLOAT(buffer, detection->dMpsf,       "%.6f, ");
     253  PRINT_FLOAT(buffer, detection->Mkron,       "%.6f, ");
     254  PRINT_FLOAT(buffer, detection->dMkron,      "%.6f, ");
     255  PRINT_FLOAT(buffer, detection->Map,         "%.6f, ");
     256  PRINT_FLOAT(buffer, detection->dMap,        "%.6f, ");
     257
     258  PrintIOBuffer (buffer, "%u),\n", detection->flags);     // flags
     259  return TRUE;
     260}
     261
     262float getMagFromValueOrFlux (float flux, float mag, float zp) {
     263
     264  // first, if mag is finite, use mag:
     265  if (isfinite(mag)) {
     266    return (zp + mag - ZeroPoint);
     267  }
     268
     269  if (isfinite(flux) && (flux > 0.0)) {
     270    fprintf (stderr, "how did we get here?\n");
     271    return (zp - 2.5*log10(flux));
     272  }
     273
     274  if (isfinite(flux) && (flux <= 0.0)) {
     275    return (NAN);
     276  }
     277  return (NAN);
     278}
     279
     280float getdMagFromValueOrFlux (float flux, float dflux, float dmag) {
     281
     282  // first, if mag is finite, use mag:
     283  if (isfinite(dmag)) {
     284    return (dmag);
     285  }
     286
     287  if (isfinite(flux) && isfinite(dflux)) {
     288    return (dflux / fabs(flux));
     289  }
     290  return (NAN);
     291}
     292
     293int assign_detection_values (Detections *detection, Measure *measure, Average *average) {
     294
     295  PhotCode *code = GetPhotcodebyCode(measure->photcode);
     296
     297  uint64_t ippObjID = ((uint64_t)average->catID << 32) + (uint64_t)average->objID; // ippObjID
     298
     299  float nominalZP   = code->C * 0.001 + code->K * (measure->airmass - 1);
     300  float zp          = nominalZP - measure->Mcal;
     301  float telluricExt = - measure->Mcal;
     302  float expTime     = pow(10.0, 0.4 * measure->dt);
     303  float airmass     = measure->airmass;
     304
     305  detection->objID        = average->extID;   // objID
     306  detection->detectID     = measure->extID;   // detectID
     307  detection->ippObjID     = ippObjID;         // ippObjID
     308  detection->ippDetectID  = measure->detID;   // ippDetectID
     309  detection->imageID      = measure->imageID; // imageID
     310  detection->catID        = measure->catID;   // catID
     311
     312  detection->ra           = measure->R;    // ra
     313  detection->dec          = measure->D;    // dec
     314  detection->raErr        = measure->dXccd * 0.01 * fabs(measure->pltscale); // estimate of raErr
     315  detection->decErr       = measure->dYccd * 0.01 * fabs(measure->pltscale); // estimate of decErr
     316
     317  detection->zp           = zp;
     318  detection->telluricExt  = telluricExt;
     319  detection->airmass      = airmass;
     320  detection->expTime      = expTime;
     321
     322  // XXX clean this up with dvo_photcode_ops calls:
     323  // if (isfinite(measure->FluxPSF) && (measure->FluxPSF < 0.0))
     324  detection->Mpsf  = getMagFromValueOrFlux (measure->FluxPSF,  measure->M,     zp);
     325  detection->Mkron = getMagFromValueOrFlux (measure->FluxKron, measure->Mkron, zp);
     326  detection->Map   = getMagFromValueOrFlux (measure->FluxAp,   measure->Map,   zp);
     327
     328  detection->dMpsf  = getdMagFromValueOrFlux (measure->FluxPSF,  measure->dFluxPSF,  measure->dM);
     329  detection->dMkron = getdMagFromValueOrFlux (measure->FluxKron, measure->dFluxKron, measure->dMkron);
     330  detection->dMap   = getdMagFromValueOrFlux (measure->FluxAp,   measure->dFluxAp,   measure->dMap);
     331
     332  detection->flags  = measure->dbFlags;  // flags
     333
     334  return TRUE;
     335}
     336
  • trunk/Ohana/src/dvopsps/src/insert_objects_dvopsps_catalog.c

    r37116 r37246  
    8888  bzero (buffer.buffer, buffer.Nalloc);
    8989
     90  // Only send the necessary fields (eg, do not sent parallax and pm)
    9091  PrintIOBuffer (&buffer, "CREATE TABLE %s_cpt ("
    91                  "RA DOUBLE,  "         
    92                  "DEC_ DOUBLE,  "         
    93                  "RA_ERR FLOAT,  "     
    94                  "DEC_ERR FLOAT,  "     
    95                  "U_RA FLOAT,  "       
    96                  "U_DEC FLOAT,  "       
    97                  "V_RA_ERR FLOAT,  "   
    98                  "V_DEC_ERR FLOAT,  "   
    99                  "PAR FLOAT,  "         
    100                  "PAR_ERR FLOAT,  "     
    101                  "CHISQ_POS FLOAT,  "   
    102                  "CHISQ_PM FLOAT,  "   
    103                  "CHISQ_PAP FLOAT,  "   
    104                  "MEAN_EPOCH INT,  " 
    105                  "TIME_RANGE INT,  " 
    106                  "PSF_QF FLOAT, "     
    107                  "PSF_QF_PERF FLOAT,  "
    108                  "STARGAL_SEP FLOAT,  "
    109                  "NUMBER_POS SMALLINT,  " 
    110                  "NMEASURE SMALLINT,  "   
    111                  "NMISSING SMALLINT,  "   
    112                  "NEXTEND SMALLINT,  "     
    113                  "OFF_MEASURE INT,  "
    114                  "OFF_MISSING INT,  "
    115                  "OFF_EXTEND INT,  " 
    116                  "FLAGS INT,  "       
    117                  "PHOTFLAGS_U INT,  "
    118                  "PHOTFLAGS_L INT,  "
    119                  "OBJ_ID INT,  "     
    120                  "CAT_ID INT,  "     
    121                  "EXT_ID BIGINT"
     92                 "EXT_ID        BIGINT,   "
     93                 "OBJ_ID        INT,      "     
     94                 "CAT_ID        INT,      "
     95                 "TESS_ID       TINYINT,  "
     96                 "PROJECTION_ID SMALLINT, "
     97                 "SKYCELL_ID    TINYINT,  "
     98                 "RA_STK        DOUBLE,   "         
     99                 "DEC_STK       DOUBLE,   "         
     100                 "RA_STK_ERR    FLOAT,    "     
     101                 "DEC_STK_ERR   FLOAT,    "     
     102                 "RA_MEAN       DOUBLE,   "         
     103                 "DEC_MEAN      DOUBLE,   "         
     104                 "RA_ERR        FLOAT,    "     
     105                 "DEC_ERR       FLOAT,    "     
     106                 "CHISQ_POS     FLOAT,    "   
     107                 "CHISQ_PM      FLOAT,    "   
     108                 "CHISQ_PAR     FLOAT,    "   
     109                 "FLAGS         INT       "       
    122110                 ")\n", basename);
     111
     112// skipping these cpt fields:
     113//               "U_RA        FLOAT,  "       
     114//               "U_DEC       FLOAT,  "       
     115//               "V_RA_ERR    FLOAT,  "   
     116//               "V_DEC_ERR   FLOAT,  "   
     117//               "PAR         FLOAT,  "         
     118//               "PAR_ERR     FLOAT,  "     
     119//               "OFF_MEASURE INT,  "
     120//               "OFF_MISSING INT,  "
     121//               "OFF_EXTEND  INT,  " 
     122//               "PSF_QF      FLOAT, "     
     123//               "PSF_QF_PERF FLOAT,  "
     124//               "STARGAL_SEP FLOAT,  "
     125//               "NUMBER_POS  SMALLINT,  " 
     126//               "NMEASURE    SMALLINT,  "   
     127//               "NMISSING    SMALLINT,  "   
     128//               "NEXTEND     SMALLINT,  "     
     129//               "PHOTFLAGS_U INT,  "
     130//               "PHOTFLAGS_L INT,  "
     131
     132
    123133
    124134  if (DEBUG) fprintf (stderr, "%s\n", buffer.buffer);
     
    145155
    146156  PrintIOBuffer (&buffer, "CREATE TABLE %s_cps ("
    147                  "MAG FLOAT,  "             
    148                  "MAG_AP FLOAT,  "             
    149                  "MAG_KRON FLOAT,  "       
    150                  "MAG_KRON_ERR FLOAT,  "   
    151                  "MAG_ERR FLOAT,  "         
    152                  "MAG_CHI FLOAT,  "         
    153                  "STACK_PSF_MAG FLOAT,  "       
    154                  "STACK_PSF_MAG_ERR FLOAT,  "   
    155                  "STACK_KRON_MAG FLOAT,  "      
    156                  "STACK_KRON_MAG_ERR FLOAT,  "   
    157                  "FLAGS INT,  "           
    158                  "NCODE SMALLINT,  "           
    159                  "NUSED SMALLINT,  "           
    160                  "MAG_20 SMALLINT,  "         
    161                  "MAG_80 SMALLINT,  "         
    162                  "UBERCAL_DIST SMALLINT,  "   
    163                  "MAG_STDEV SMALLINT,  "       
    164                  "STACK_DETECT_ID BIGINT"
     157                 "MAG            FLOAT,  "             
     158                 "MAG_ERR        FLOAT,  "         
     159                 "MAG_STDEV      FLOAT,  "        
     160                 "MAG_MIN        FLOAT,  "        
     161                 "MAG_MAX        FLOAT,  "         
     162                 "NUSED          SMALLINT,  "           
     163                 "MAG_KRON      FLOAT,  "       
     164                 "MAG_KRON_ERR  FLOAT,  "   
     165                 "MAG_KRON_STDEV FLOAT,  "   
     166                 "NUSED_KRON     SMALLINT,  "    
     167                 "MAG_AP         FLOAT,  "             
     168                 "MAG_AP_ERR     FLOAT,  "             
     169                 "MAG_AP_STDEV   FLOAT,  "             
     170                 "NUSED_AP       SMALLINT,  "   
     171                 "NCODE          SMALLINT,  "          
     172                 "NSTACK_DET     SMALLINT,  "          
     173                 "PSF_QF_PERF_MAX FLOAT, "           
     174                 "FLAGS          INT "         
    165175                 ")\n", basename);
    166 
    167  //              "FLUX_PSF FLOAT,  "       
    168  //              "FLUX_PSF_ERR FLOAT,  "   
    169  //              "FLUX_KRON FLOAT,  "       
    170  //              "FLUX_KRON_ERR FLOAT,  "   
    171176
    172177  if (DEBUG) fprintf (stderr, "%s\n", buffer.buffer);
     
    191196
    192197  PrintIOBuffer (ave_buffer, "INSERT INTO %s_cpt ("
    193                  "RA, "         
    194                  "DEC_, "         
    195                  "RA_ERR, "     
    196                  "DEC_ERR, "     
    197                  "U_RA, "       
    198                  "U_DEC, "       
    199                  "V_RA_ERR, "   
    200                  "V_DEC_ERR, "   
    201                  "PAR, "         
    202                  "PAR_ERR, "     
    203                  "CHISQ_POS, "   
    204                  "CHISQ_PM, "   
    205                  "CHISQ_PAP, "   
    206                  "MEAN_EPOCH, " 
    207                  "TIME_RANGE, " 
    208                  "PSF_QF, "     
    209                  "PSF_QF_PERF, "
    210                  "STARGAL_SEP, "
    211                  "NUMBER_POS, " 
    212                  "NMEASURE, "   
    213                  "NMISSING, "   
    214                  "NEXTEND, "     
    215                  "OFF_MEASURE, "
    216                  "OFF_MISSING, "
    217                  "OFF_EXTEND, " 
    218                  "FLAGS, "       
    219                  "PHOTFLAGS_U, "
    220                  "PHOTFLAGS_L, "
    221                  "OBJ_ID, "     
    222                  "CAT_ID, "     
    223                  "EXT_ID"
     198                 "EXT_ID,        "
     199                 "OBJ_ID,        "     
     200                 "CAT_ID,        "     
     201                 "TESS_ID,       "     
     202                 "PROJECTION_ID, "     
     203                 "SKYCELL_ID,    "     
     204                 "RA_STK,        "         
     205                 "DEC_STK,       "         
     206                 "RA_STK_ERR,    "     
     207                 "DEC_STK_ERR,   "     
     208                 "RA_MEAN,       "         
     209                 "DEC_MEAN,      "         
     210                 "RA_ERR,        "     
     211                 "DEC_ERR,       "     
     212                 "CHISQ_POS,     "   
     213                 "CHISQ_PM,      "   
     214                 "CHISQ_PAR,     "   
     215                 "FLAGS          "       
    224216                 ") VALUES \n", basename);
    225217
     
    230222  PrintIOBuffer (sec_buffer, "INSERT INTO %s_cps ("
    231223                 "MAG, "             
    232                  "MAG_AP, "             
     224                 "MAG_ERR, "         
     225                 "MAG_STDEV, "       
     226                 "MAG_MIN, "         
     227                 "MAG_MAX, "         
     228                 "NUSED, "           
     229
    233230                 "MAG_KRON, "       
    234231                 "MAG_KRON_ERR, "   
    235                  "MAG_ERR, "         
    236                  "MAG_CHI, "         
    237                  "STACK_PSF_MAG, "       
    238                  "STACK_PSF_MAG_ERR, "   
    239                  "STACK_KRON_MAG, "       
    240                  "STACK_KRON_MAG_ERR, "   
    241                  "FLAGS, "           
     232                 "MAG_KRON_STDEV, "   
     233                 "NUSED_KRON, "           
     234
     235                 "MAG_AP, "             
     236                 "MAG_AP_ERR, "             
     237                 "MAG_AP_STDEV, "             
     238                 "NUSED_AP, "           
     239
    242240                 "NCODE, "           
    243                  "NUSED, "           
    244                  "MAG_20, "         
    245                  "MAG_80, "         
    246                  "UBERCAL_DIST, "   
    247                  "MAG_STDEV, "       
    248                  "STACK_DETECT_ID "
     241                 "NSTACK_DET,  "           
     242                 "PSF_QF_PERF_MAX, "           
     243                 "FLAGS "           
    249244                 ") VALUES \n", basename);
    250245  return TRUE;
     
    261256// XXX this bit could/should be autocoded...
    262257  PrintIOBuffer (ave_buffer, " (");
     258  PrintIOBuffer (ave_buffer, "%lu, ", average->extID);         
     259  PrintIOBuffer (ave_buffer, "%u,  ", average->objID);         
     260  PrintIOBuffer (ave_buffer, "%u,  ", average->catID);         
     261
     262  PrintIOBuffer (ave_buffer, "%hhd, ", average->tessID);         
     263  PrintIOBuffer (ave_buffer, "%hd,  ", average->projectionID);         
     264  PrintIOBuffer (ave_buffer, "%hhd, ", average->skycellID);         
     265
     266  PRINT_FLOAT(ave_buffer, average->Rstk,     "%.8f, ");  // 0.036 mas precision
     267  PRINT_FLOAT(ave_buffer, average->Dstk,     "%.8f, ");  // 0.036 mas precision
     268  PRINT_FLOAT(ave_buffer, average->dRstk,    "%.5f, ");  // 0.010 mas precision
     269  PRINT_FLOAT(ave_buffer, average->dDstk,    "%.5f, ");  // 0.010 mas precision
     270
    263271  PRINT_FLOAT(ave_buffer, average->R,        "%.8f, ");  // 0.036 mas precision
    264272  PRINT_FLOAT(ave_buffer, average->D,        "%.8f, ");  // 0.036 mas precision
    265273  PRINT_FLOAT(ave_buffer, average->dR,       "%.5f, ");  // 0.010 mas precision
    266274  PRINT_FLOAT(ave_buffer, average->dD,       "%.5f, ");  // 0.010 mas precision
    267   PRINT_FLOAT(ave_buffer, average->uR,       "%.5f, ");  // 0.010 mas/yr precision
    268   PRINT_FLOAT(ave_buffer, average->uD,       "%.5f, ");
    269   PRINT_FLOAT(ave_buffer, average->duR,      "%.5f, ");
    270   PRINT_FLOAT(ave_buffer, average->duD,      "%.5f, ");
    271   PRINT_FLOAT(ave_buffer, average->P,        "%.5f, ");
    272   PRINT_FLOAT(ave_buffer, average->dP,       "%.5f, ");
     275
    273276  PRINT_FLOAT(ave_buffer, average->ChiSqAve, "%.4f, ");
    274277  PRINT_FLOAT(ave_buffer, average->ChiSqPM,  "%.4f, ");
    275278  PRINT_FLOAT(ave_buffer, average->ChiSqPar, "%.4f, ");
    276   PrintIOBuffer (ave_buffer, "%d, ",  average->Tmean);         
    277   PrintIOBuffer (ave_buffer, "%d, ",  average->Trange);         
    278   PRINT_FLOAT(ave_buffer, average->psfQF,     "%.3f, ");
    279   PRINT_FLOAT(ave_buffer, average->psfQFperf, "%.3f, ");
    280   PRINT_FLOAT(ave_buffer, average->stargal,   "%.3f, ");
    281   PrintIOBuffer (ave_buffer, "%hu, ", average->Npos);           
    282   PrintIOBuffer (ave_buffer, "%hu, ", average->Nmeasure);       
    283   PrintIOBuffer (ave_buffer, "%hu, ", average->Nmissing);       
    284   PrintIOBuffer (ave_buffer, "%hu, ", average->Nextend);       
    285   PrintIOBuffer (ave_buffer, "%d, ",  average->measureOffset); 
    286   PrintIOBuffer (ave_buffer, "%d, ",  average->missingOffset); 
    287   PrintIOBuffer (ave_buffer, "%d, ",  0); // was : average->extendOffset);   
    288   PrintIOBuffer (ave_buffer, "%u, ",  average->flags);         
    289   PrintIOBuffer (ave_buffer, "%u, ",  average->photFlagsUpper);
    290   PrintIOBuffer (ave_buffer, "%u, ",  average->photFlagsLower);
    291   PrintIOBuffer (ave_buffer, "%u, ",  average->objID);         
    292   PrintIOBuffer (ave_buffer, "%u, ",  average->catID);         
    293   PrintIOBuffer (ave_buffer, "%lu",   average->extID);         
     279
     280  PrintIOBuffer (ave_buffer, "%u ",  average->flags);         
     281
    294282  PrintIOBuffer (ave_buffer, "),\n");
    295283
     284  // XXX what rules for keeping or NAN-ing various mags?
    296285  for (i = 0; i < Nsecfilt; i++) {
    297286    float meanPSFMag    = -999.0;
    298287    float meanPSFMagErr = -999.0;
     288    float meanPSFMagStd = -999.0;
     289    float meanPSFMagMin = -999.0;
     290    float meanPSFMagMax = -999.0;
    299291    if (isfinite(secfilt->dM) && isfinite(secfilt->M)) {
    300       meanPSFMag = secfilt->M;
     292      meanPSFMag    = secfilt->M;
    301293      meanPSFMagErr = secfilt->dM;
     294      meanPSFMagStd = secfilt->Mstdev;
     295      meanPSFMagMin = secfilt->Mmin;
     296      meanPSFMagMax = secfilt->Mmax;
    302297    }
    303298
    304299    float meanKronMag    = -999.0;
    305300    float meanKronMagErr = -999.0;
     301    float meanKronMagStd = -999.0;
    306302    if (isfinite(secfilt->dMkron) && isfinite(secfilt->Mkron) && (secfilt->dMkron < 0.333)) {
    307       meanKronMag = secfilt->Mkron;
     303      meanKronMag    = secfilt->Mkron;
    308304      meanKronMagErr = secfilt->dMkron;
     305      meanKronMagStd = secfilt->sMkron;
    309306    }
    310307
    311308    float meanApMag    = -999.0;
    312     if (isfinite(secfilt->Map)) {
    313       meanApMag = secfilt->Map;
    314     }
    315 
    316     float stackPSFMag    = -999.0;
    317     float stackPSFMagErr = -999.0;
    318     if (isfinite(secfilt->dFpsfStk) && isfinite(secfilt->FpsfStk) && (secfilt->dFpsfStk > 0.0)) {
    319       float SN = secfilt->FpsfStk / secfilt->dFpsfStk;
    320       if (SN > 3.0) {
    321         stackPSFMag = -2.5 * log10(secfilt->FpsfStk) + 8.9;
    322         stackPSFMagErr = secfilt->dFpsfStk / secfilt->FpsfStk;
    323       }
    324     }
    325 
    326     float stackKronMag    = -999.0;
    327     float stackKronMagErr = -999.0;
    328     if (isfinite(secfilt->dFkronStk) && isfinite(secfilt->FkronStk) && (secfilt->dFkronStk > 0.0)) {
    329       float SN = secfilt->FkronStk / secfilt->dFkronStk;
    330       if (SN > 3.0) {
    331         stackKronMag = -2.5 * log10(secfilt->FkronStk) + 8.9;
    332         stackKronMagErr = secfilt->dFkronStk / secfilt->FkronStk;
    333       }
     309    float meanApMagErr = -999.0;
     310    float meanApMagStd = -999.0;
     311    if (isfinite(secfilt->dMap) && isfinite(secfilt->Map)) {
     312      meanApMag    = secfilt->Map;
     313      meanApMagErr = secfilt->dMap;
     314      meanApMagStd = secfilt->sMap;
    334315    }
    335316
    336317    PrintIOBuffer (sec_buffer, " (");
    337318    PRINT_FLOAT(sec_buffer, meanPSFMag,      "%.6f, "); // umag precision
    338     PRINT_FLOAT(sec_buffer, meanApMag,       "%.6f, "); // umag precision
     319    PRINT_FLOAT(sec_buffer, meanPSFMagErr,   "%.6f, "); // umag precision
     320    PRINT_FLOAT(sec_buffer, meanPSFMagStd,   "%.6f, "); // umag precision
     321    PRINT_FLOAT(sec_buffer, meanPSFMagMin,   "%.6f, "); // umag precision
     322    PRINT_FLOAT(sec_buffer, meanPSFMagMax,   "%.6f, "); // umag precision
     323    PrintIOBuffer (sec_buffer, "%hd,  ", secfilt->Nused);       
     324
    339325    PRINT_FLOAT(sec_buffer, meanKronMag,     "%.6f, "); // umag precision
    340326    PRINT_FLOAT(sec_buffer, meanKronMagErr,  "%.6f, "); // umag precision
    341     PRINT_FLOAT(sec_buffer, meanPSFMagErr,   "%.6f, "); // umag precision
    342     PRINT_FLOAT(sec_buffer, secfilt->Mchisq, "%.6f, ");
    343     PRINT_FLOAT(sec_buffer, stackPSFMag,     "%.6f, "); // umag precision
    344     PRINT_FLOAT(sec_buffer, stackPSFMagErr,  "%.6f, "); // umag precision
    345     PRINT_FLOAT(sec_buffer, stackKronMag,    "%.6f, "); // umag precision
    346     PRINT_FLOAT(sec_buffer, stackKronMagErr, "%.6f, "); // 0.36 umag precision
    347     PrintIOBuffer (sec_buffer, "%u,   ", secfilt->flags);       
     327    PRINT_FLOAT(sec_buffer, meanKronMagStd,  "%.6f, "); // umag precision
     328    PrintIOBuffer (sec_buffer, "%hd,  ", secfilt->NusedKron);       
     329
     330    PRINT_FLOAT(sec_buffer, meanApMag,     "%.6f, "); // umag precision
     331    PRINT_FLOAT(sec_buffer, meanApMagErr,  "%.6f, "); // umag precision
     332    PRINT_FLOAT(sec_buffer, meanApMagStd,  "%.6f, "); // umag precision
     333    PrintIOBuffer (sec_buffer, "%hd,  ", secfilt->NusedAp);        
    348334    PrintIOBuffer (sec_buffer, "%hd,  ", secfilt->Ncode);       
    349     PrintIOBuffer (sec_buffer, "%hd,  ", secfilt->Nused);       
    350     PrintIOBuffer (sec_buffer, "%.6f, ", secfilt->Mmin);         
    351     PrintIOBuffer (sec_buffer, "%.6f, ", secfilt->Mmax);         
    352     PrintIOBuffer (sec_buffer, "%hd, ", secfilt->ubercalDist); 
    353     PrintIOBuffer (sec_buffer, "%.6f, ", secfilt->Mstdev);       
    354     PrintIOBuffer (sec_buffer, "%lu  ", 0L); // secfilt->stackDetectID
     335    PrintIOBuffer (sec_buffer, "%hd,  ", secfilt->NstackDet);       
     336
     337    PRINT_FLOAT(sec_buffer, secfilt->psfQfPerfMax, "%.6f,");       
     338    PrintIOBuffer (sec_buffer, "%u ", secfilt->flags);       
    355339    PrintIOBuffer (sec_buffer, "),\n");
    356340    secfilt ++;
  • trunk/Ohana/src/getstar

  • trunk/Ohana/src/libautocode/def/average-ps1-v5.d

    r37034 r37246  
    22EXTNAME      DVO_AVERAGE_PS1_V5
    33TYPE         BINTABLE
    4 SIZE         184
     4SIZE         192
    55DESCRIPTION  DVO Average Object Table
    66
     
    5353FIELD refColorRed,    REF_COLOR_RED,  float,        color of astrometry ref stars
    5454
     55FIELD tessID,         TESS_ID,       char,          ID of tessellation for primary skycell
     56FIELD skycellID,      SKYCELL_ID,    char,          ID of skycell for primary skycell
     57FIELD projectionID,   PROJECTION_ID, short,         ID of projection for primary skycell
     58
     59FIELD dummy,          DUMMY,         int,           unassigned bytes
     60
    5561# 'flags' was called 'code' prior to 2009.02.07
    5662FIELD flags,          FLAGS,       uint32_t,        average object flags (star; ghost; etc)
  • trunk/Ohana/src/libautocode/def/average.d

    r37034 r37246  
    22EXTNAME      DVO_AVERAGE
    33TYPE         BINTABLE
    4 SIZE         184
     4SIZE         192
    55DESCRIPTION  DVO Average Object Table
    66
     
    5353FIELD refColorRed,    REF_COLOR_RED,  float,        color of astrometry ref stars
    5454
     55FIELD tessID,         TESS_ID,       char,          ID of tessellation for primary skycell
     56FIELD skycellID,      SKYCELL_ID,    char,          ID of skycell for primary skycell
     57FIELD projectionID,   PROJECTION_ID, short,         ID of projection for primary skycell
     58
     59FIELD dummy,          DUMMY,         int,           unassigned bytes
     60
    5561# 'flags' was called 'code' prior to 2009.02.07
    5662FIELD flags,          FLAGS,       uint32_t,        average object flags (star; ghost; etc)
  • trunk/Ohana/src/libautocode/def/measure-ps1-v5.d

    r37034 r37246  
    6868FIELD psfNdof,        PSF_NDOF,      int,            psf degrees of freedom
    6969FIELD psfNpix,        PSF_NPIX,      int,            psf number of pixels
    70 FIELD crNsigma,       CR_NSIGMA,     float,          Nsigma deviation towards CR
     70FIELD photFlags2,     PHOT_FLAGS,    int,            flags supplied by photometry program
    7171FIELD extNsigma,      EXT_NSIGMA,    float,          Nsigma deviation towards EXT
    7272
  • trunk/Ohana/src/libautocode/def/measure.d

    r37034 r37246  
    6666FIELD psfNdof,        PSF_NDOF,      int,            psf degrees of freedom
    6767FIELD psfNpix,        PSF_NPIX,      int,            psf number of pixels
    68 FIELD crNsigma,       CR_NSIGMA,     float,          Nsigma deviation towards CR
     68FIELD photFlags2,     PHOT_FLAGS,    int,            flags supplied by photometry program
    6969FIELD extNsigma,      EXT_NSIGMA,    float,          Nsigma deviation towards EXT
    7070
  • trunk/Ohana/src/libautocode/def/secfilt-ps1-v5.d

    r37116 r37246  
    22EXTNAME      DVO_SECFILT_PS1_V5
    33TYPE         BINTABLE
    4 SIZE         160
     4SIZE         176
    55DESCRIPTION  DVO SecFilt : Secondary Filter Data
    66
     
    1515FIELD  sMkron,        MAG_KRON_STDEV,  float,      standard deviation of kron mags,       mags
    1616                                         
     17# XXX I could add these fields to secfilt or calculate in dvopsps?
     18FIELD  psfQfMax,      PSF_QF_MAX,      float,      best psfQf for this filter
     19FIELD  psfQfPerfMax,  PSF_QF_PERF_MAX, float,      best psfQfPerfect for this filter
     20
    1721# these statistics are PSF-specific     
    1822FIELD  Mstdev,        MAG_STDEV,         float,    standard deviation of measurements,    mags
     
    4246FIELD  dFapStk,       FLUX_AP_STK_ERR,   float,    mean flux ap error
    4347
     48FIELD  Nstack,        NSTACK,            short,    number of measurements in band (gpc1 stack only)
     49FIELD  NstackDet,     NSTACK_DET,        short,    number of stack detections in band (gpc1 stack only)
     50
    4451FIELD  stackPrmryOff, STACK_PRIMARY_OFF,  int,     measure entry which is primary stack detection
    4552FIELD  stackBestOff,  STACK_BEST_OFF,     int,     measure entry which is best stack detection
     
    6673FIELD  NusedApWrp,    NUSED_AP_WRP,      short,    number of detections used in average
    6774
     75FIELD  Nwarp,         NWARP,             short,    number of measurements in band (gpc1 warp only)
     76FIELD  NwarpGood,     NWARP_GOOD,        short,    number of meas with psf_qf > 0.85 in band (gpc1 warp only)
     77
    6878FIELD  ubercalDist,   UBERCAL_DIST,      short,    number of images from an ubercal-image
    6979
  • trunk/Ohana/src/libautocode/def/secfilt.d

    r37116 r37246  
    22EXTNAME      DVO_SECFILT
    33TYPE         BINTABLE
    4 SIZE         160
     4SIZE         176
    55DESCRIPTION  DVO SecFilt : Secondary Filter Data
    66
     
    1515FIELD  sMkron,        MAG_KRON_STDEV,  float,      standard deviation of kron mags,       mags
    1616
     17# XXX I could add these fields to secfilt or calculate in dvopsps?
     18FIELD  psfQfMax,      PSF_QF_MAX,      float,      best psfQf for this filter
     19FIELD  psfQfPerfMax,  PSF_QF_PERF_MAX, float,      best psfQfPerfect for this filter
     20
    1721# these statistics are PSF-specific     
    1822FIELD  Mstdev,        MAG_STDEV,       float,      standard deviation of measurements,    mags
     
    2125FIELD  Mchisq,        MAG_CHI,         float,      chisq on average mag,                  value
    2226
    23 FIELD  Ncode,         NCODE,           short,      number of detections in band
    24 FIELD  Nused,         NUSED,           short,      number of detections used in average
    25 FIELD  NusedKron,     NUSED_KRON,      short,      number of detections used in average
    26 FIELD  NusedAp,       NUSED_AP,        short,      number of detections used in average
     27FIELD  Ncode,         NCODE,           short,      number of detections in band (gpc1 chip only)
     28FIELD  Nused,         NUSED,           short,      number of detections used to calculate secfilt.M
     29FIELD  NusedKron,     NUSED_KRON,      short,      number of detections used to calculate secfilt.Mkron
     30FIELD  NusedAp,       NUSED_AP,        short,      number of detections used to calculate secfilt.Map
    2731
    2832FIELD  flags,         FLAGS,           uint32_t,   photometry flags
     
    4246FIELD  dFapStk,       FLUX_AP_STK_ERR,   float,    mean flux ap error
    4347
    44 FIELD  stackPrmryOff, STACK_PRIMARY_OFF,  int,     measure entry which is primary stack detection
    45 FIELD  stackBestOff,  STACK_BEST_OFF,     int,     measure entry which is best stack detection
     48FIELD  Nstack,        NSTACK,            short,    number of measurements in band (gpc1 stack only)
     49FIELD  NstackDet,     NSTACK_DET,        short,    number of stack detections in band (gpc1 stack only)
     50
     51FIELD  stackPrmryOff, STACK_PRIMARY_OFF, int,      measure entry which is primary stack detection
     52FIELD  stackBestOff,  STACK_BEST_OFF,    int,      measure entry which is best stack detection
    4653
    4754## *** this section is for forced-warp mean values ***
     
    6673FIELD  NusedApWrp,    NUSED_AP_WRP,      short,    number of detections used in average
    6774
    68 FIELD  ubercalDist,   UBERCAL_DIST,    short,      number of images from an ubercal-image
     75FIELD  Nwarp,         NWARP,             short,    number of measurements in band (gpc1 warp only)
     76FIELD  NwarpGood,     NWARP_GOOD,        short,    number of meas with psf_qf > 0.85 in band (gpc1 warp only)
     77
     78FIELD  ubercalDist,   UBERCAL_DIST,      short,    number of images from an ubercal-image
    6979
    7080# *** 20090206 : new fields : M_20, M_80; dropped dummy
  • trunk/Ohana/src/libdvo/include/dvo.h

    r37116 r37246  
    464464} MeasureTiny;
    465465
    466 /** STRUCT DEFINITION **/
     466// alternate version of PS1_V4 (old dev version)
    467467typedef struct {
    468468  double           R;                    // RA (decimal degrees )
     
    500500Average *Average_PS1_V4alt_ToInternal (Average_PS1_V4alt *in, off_t Nvalues);
    501501
    502 /** STRUCT DEFINITION **/
     502// alternate version of PS1_V4 (old dev version)
    503503typedef struct {
    504504  float            dR;                   // RA offset (arcsec)
     
    556556Measure *Measure_PS1_V4alt_ToInternal (Average *ave, Measure_PS1_V4alt *in, off_t Nvalues);
    557557
     558// alternate version of PS1_V5 (old dev version)
     559typedef struct {
     560  float            M;                    // average mag in this band (mags)
     561  float            dM;                   // formal error on average mag (mags)
     562  float            Map;                  // ave aperture mag in this band (mags)
     563  float            dMap;                 // ave aperture mag in this band (mags)
     564  float            sMap;                 // standard deviation of ap mags (mags)
     565  float            Mkron;                // ave kron mag in this band (mags)
     566  float            dMkron;               // formal error on average kron mag (mags)
     567  float            sMkron;               // standard deviation of kron mags (mags)
     568  float            Mstdev;               // standard deviation of measurements (mags)
     569  float            Mmin;                 // min accepted mag (mags)
     570  float            Mmax;                 // max accepted mag (mags)
     571  float            Mchisq;               // chisq on average mag (value)
     572  short            Ncode;                // number of detections in band
     573  short            Nused;                // number of detections used in average
     574  short            NusedKron;            // number of detections used in average
     575  short            NusedAp;              // number of detections used in average
     576  uint32_t         flags;                // photometry flags
     577  float            MpsfStk;              // magnitude from stack (primary if available)
     578  float            FpsfStk;              // flux from stack (primary if available)
     579  float            dFpsfStk;             // mean flux psf error
     580  float            MkronStk;             // magnitude from stack (primary if available)
     581  float            FkronStk;             // flux from stack (primary if available)
     582  float            dFkronStk;            // mean flux kron error
     583  float            MapStk;               // magnitude from stack (primary if available)
     584  float            FapStk;               // flux from stack (primary if available)
     585  float            dFapStk;              // mean flux ap error
     586  int              stackPrmryOff;        // measure entry which is primary stack detection
     587  int              stackBestOff;         // measure entry which is best stack detection
     588  float            MpsfWrp;              // psf magnitude from stack (primary if available)
     589  float            FpsfWrp;              // psf flux from stack (primary if available)
     590  float            dFpsfWrp;             // mean flux psf error
     591  float            sFpsfWrp;             // mean flux psf stdev
     592  float            MkronWrp;             // kron magnitude from stack (primary if available)
     593  float            FkronWrp;             // kron flux from stack (primary if available)
     594  float            dFkronWrp;            // mean flux kron error
     595  float            sFkronWrp;            // mean flux kron stdev
     596  float            MapWrp;               // aper magnitude from stack (primary if available)
     597  float            FapWrp;               // aper flux from stack (primary if available)
     598  float            dFapWrp;              // mean flux ap error
     599  float            sFapWrp;              // mean flux ap stdev
     600  short            NusedWrp;             // number of detections used in average
     601  short            NusedKronWrp;         // number of detections used in average
     602  short            NusedApWrp;           // number of detections used in average
     603  short            ubercalDist;          // number of images from an ubercal-image
     604} SecFilt_PS1_V5alt;
     605
     606SecFilt_PS1_V5alt *gfits_table_get_SecFilt_PS1_V5alt (FTable *table, off_t *Ndata, char *swapped);
     607int      gfits_convert_SecFilt_PS1_V5alt (SecFilt_PS1_V5alt *data, off_t size, off_t nitems);
     608SecFilt *SecFilt_PS1_V5alt_ToInternal (SecFilt_PS1_V5alt *in, off_t Nvalues);
     609
     610// alternate version of PS1_V5alt (old dev version)
     611typedef struct {
     612  double           R;                    // RA (decimal degrees )
     613  double           D;                    // DEC (decimal degrees )
     614  float            dR;                   // RA error (arcsec)
     615  float            dD;                   // DEC error (arcsec)
     616  float            uR;                   // RA*cos(D) proper-motion (arcsec/year)
     617  float            uD;                   // DEC proper-motion (arcsec/year)
     618  float            duR;                  // RA*cos(D) p-m error (arcsec/year)
     619  float            duD;                  // DEC p-m error (arcsec/year)
     620  float            P;                    // parallax (arcsec)
     621  float            dP;                   // parallax error (arcsec)
     622  double           Rstk;                 // RA on stack (decimal degrees )
     623  double           Dstk;                 // DEC on stack (decimal degrees )
     624  float            dRstk;                // RA error on stack (arcsec)
     625  float            dDstk;                // DEC error on stack (arcsec)
     626  float            ChiSqAve;             // astrometry analysis chisq
     627  float            ChiSqPM;              // astrometry analysis chisq
     628  float            ChiSqPar;             // astrometry analysis chisq
     629  int              Tmean;                // mean epoch (PM,PAR ref) (unix time seconds)
     630  int              Trange;               // mean epoch (PM,PAR ref) (unix time seconds)
     631  float            psfQF;                // psf coverage (bad masks)
     632  float            psfQFperf;            // psf coverage (all masks)
     633  float            stargal;              // star / galaxy separator (1/100 arcsec)
     634  unsigned short   Npos;                 // number of detections used for astrometry
     635  unsigned short   Nmeasure;             // number of psf measurements
     636  unsigned short   Nmissing;             // number of missings
     637  unsigned short   Nlensing;             // number of lensing measurements
     638  unsigned short   Nlensobj;             // number of lensing measurements
     639  unsigned short   Nextend;              // number of extended measurements
     640  int              measureOffset;        // offset to first psf measurement
     641  int              missingOffset;        // offset to first missing obs
     642  int              lensingOffset;        // offset to first lensing obs
     643  int              lensobjOffset;        // offset to mean lensing data
     644  int              extendOffset;         // offset to extended object entry
     645  int              paramsOffset;         // offset to stellar parameter data
     646  float            refColorBlue;         // color of astrometry ref stars
     647  float            refColorRed;          // color of astrometry ref stars
     648  uint32_t         flags;                // average object flags (star; ghost; etc)
     649  uint32_t         photFlagsUpper;       // upper bit of 2 bit summary of per-measure photflags
     650  uint32_t         photFlagsLower;       // lower bit of 2 bit summary of per-measure photflags
     651  unsigned int     objID;                // unique ID for object in table
     652  unsigned int     catID;                // unique ID for table in which object was first realized
     653  uint64_t         extID;                // external ID for object (eg PSPS objID)
     654  uint64_t         extIDgc;              // external ID for object in galactic coords
     655} Average_PS1_V5alt;
     656
     657Average_PS1_V5alt *gfits_table_get_Average_PS1_V5alt (FTable *table, off_t *Ndata, char *swapped);
     658int      gfits_convert_Average_PS1_V5alt (Average_PS1_V5alt *data, off_t size, off_t nitems);
     659Average *Average_PS1_V5alt_ToInternal (Average_PS1_V5alt *in, off_t Nvalues);
     660
    558661/* for some reason I have merged the set of tables and the file description,
    559662   so I need to have an internal structure to point to the separate files */
  • trunk/Ohana/src/libdvo/src/dbExtractMeasures.c

    r37116 r37246  
    646646    case MEAS_PSF_NPIX: /* OK */
    647647      value.Int = measure[0].psfNpix;
    648       break;
    649     case MEAS_CR_NSIGMA: /* OK */
    650       value.Flt = measure[0].crNsigma;
    651648      break;
    652649    case MEAS_EXT_NSIGMA: /* OK */
  • trunk/Ohana/src/libdvo/src/dvo_catalog.c

    r37116 r37246  
    141141  average->refColorRed     = NAN;
    142142
     143  average->tessID          = 0;
     144  average->skycellID       = 0;
     145  average->projectionID    = 0;
     146  average->dummy           = 0;
     147
    143148  average->flags           = 0;
    144149  average->photFlagsUpper  = 0;
     
    173178  secfilt->sMkron      = NAN;
    174179
     180  secfilt->psfQfMax     = NAN;
     181  secfilt->psfQfPerfMax = NAN;
     182
    175183  secfilt->Mstdev      = NAN;
    176184  secfilt->Mmin        = NAN;
     
    197205  secfilt->dFapStk     = NAN;
    198206
     207  secfilt->Nstack      = 0;
     208  secfilt->NstackDet   = 0;
     209
    199210  secfilt->stackPrmryOff = -1;
    200211  secfilt->stackBestOff  = -1;
     
    218229  secfilt->NusedKronWrp = 0;
    219230  secfilt->NusedApWrp   = 0;
     231
     232  secfilt->Nwarp        = 0;
     233  secfilt->NwarpGood    = 0;
    220234
    221235  secfilt->ubercalDist = 1000;
     
    279293 measure->psfNdof   = 0;
    280294 measure->psfNpix   = 0;
    281  measure->crNsigma  = NAN;
    282295 measure->extNsigma = NAN;
    283296
     
    302315 measure->dbFlags   = 0;
    303316 measure->photFlags = 0;
     317 measure->photFlags2= 0;
    304318}
    305319
  • trunk/Ohana/src/libdvo/src/dvo_convert.c

    r37116 r37246  
    8080  }
    8181
     82  // block to convert old tables (PS1_V5 versions made during development)
     83  if (!strcmp (extname, "DVO_AVERAGE_PS1_V5") && (ftable[0].header[0].Naxis[0] == 184)) {
     84    Average_PS1_V5alt *tmpAverage;
     85    tmpAverage = gfits_table_get_Average_PS1_V5alt (ftable, Naverage, NULL);
     86    if (!tmpAverage) {
     87      fprintf (stderr, "ERROR: failed to read averages\n");
     88      exit (2);
     89    }
     90    average = Average_PS1_V5alt_ToInternal (tmpAverage, *Naverage);
     91    free (tmpAverage);
     92    *format = DVO_FORMAT_PS1_V5;
     93    return (average);
     94  }
     95
    8296# define CONVERT_FORMAT(NAME, FORMAT, TYPE) \
    8397  if (!strcmp (extname, NAME)) { \
     
    285299    return (FALSE);
    286300  }
     301
     302  // block to convert old tables (PS1_V5 versions made during development)
     303  if (!strcmp (extname, "DVO_SECFILT_PS1_V5") && (ftable[0].header[0].Naxis[0] == 160)) {
     304    SecFilt_PS1_V5alt *tmpSecFilt;
     305    tmpSecFilt = gfits_table_get_SecFilt_PS1_V5alt (ftable, Nsecfilt, NULL);
     306    if (!tmpSecFilt) {
     307      fprintf (stderr, "ERROR: failed to read secfilts\n");
     308      exit (2);
     309    }
     310    secfilt = SecFilt_PS1_V5alt_ToInternal (tmpSecFilt, *Nsecfilt);
     311    free (tmpSecFilt);
     312    *format = DVO_FORMAT_PS1_V5;
     313    return (secfilt);
     314  }
     315
    287316
    288317# define CONVERT_FORMAT(NAME, FORMAT, TYPE) \
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c

    r37035 r37246  
    3232    out[i].psfQF      = in[i].psfQF;
    3333    out[i].psfChisq   = in[i].psfChisq;
    34     out[i].crNsigma   = in[i].crNsigma;
    3534    out[i].extNsigma  = in[i].extNsigma;
    3635    out[i].FWx        = in[i].FWx;
     
    8079    out[i].psfQF      = in[i].psfQF;
    8180    out[i].psfChisq   = in[i].psfChisq;
    82     out[i].crNsigma   = in[i].crNsigma;
    8381    out[i].extNsigma  = in[i].extNsigma;
    8482    out[i].FWx        = in[i].FWx;
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c

    r37035 r37246  
    3434    out[i].psfQF      = in[i].psfQF;
    3535    out[i].psfChisq   = in[i].psfChisq;
    36     out[i].crNsigma   = in[i].crNsigma;
    3736    out[i].extNsigma  = in[i].extNsigma;
    3837    out[i].FWx        = in[i].FWx;
     
    8079    out[i].psfQF      = in[i].psfQF;
    8180    out[i].psfChisq   = in[i].psfChisq;
    82     out[i].crNsigma   = in[i].crNsigma;
    8381    out[i].extNsigma  = in[i].extNsigma;
    8482    out[i].FWx        = in[i].FWx;
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c

    r37035 r37246  
    4040    out[i].psfNdof    = in[i].psfNdof;
    4141    out[i].psfNpix    = in[i].psfNpix;
    42     out[i].crNsigma   = in[i].crNsigma;
    4342    out[i].extNsigma  = in[i].extNsigma;
    4443    out[i].FWx        = in[i].FWx;
     
    9594    out[i].psfNdof    = in[i].psfNdof;
    9695    out[i].psfNpix    = in[i].psfNpix;
    97     out[i].crNsigma   = in[i].crNsigma;
    9896    out[i].extNsigma  = in[i].extNsigma;
    9997    out[i].FWx        = in[i].FWx;
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c

    r37035 r37246  
    4040    out[i].psfNdof    = in[i].psfNdof;
    4141    out[i].psfNpix    = in[i].psfNpix;
    42     out[i].crNsigma   = in[i].crNsigma;
    4342    out[i].extNsigma  = in[i].extNsigma;
    4443    out[i].FWx        = in[i].FWx;
     
    9695    out[i].psfNdof    = in[i].psfNdof;
    9796    out[i].psfNpix    = in[i].psfNpix;
    98     out[i].crNsigma   = in[i].crNsigma;
    9997    out[i].extNsigma  = in[i].extNsigma;
    10098    out[i].FWx        = in[i].FWx;
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c

    r37035 r37246  
    4040    out[i].psfNdof    = in[i].psfNdof;
    4141    out[i].psfNpix    = in[i].psfNpix;
    42     out[i].crNsigma   = in[i].crNsigma;
    4342    out[i].extNsigma  = in[i].extNsigma;
    4443    out[i].FWx        = in[i].FWx;
     
    9695    out[i].psfNdof    = in[i].psfNdof;
    9796    out[i].psfNpix    = in[i].psfNpix;
    98     out[i].crNsigma   = in[i].crNsigma;
    9997    out[i].extNsigma  = in[i].extNsigma;
    10098    out[i].FWx        = in[i].FWx;
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c

    r37116 r37246  
    4949    out[i].psfNdof    = in[i].psfNdof;
    5050    out[i].psfNpix    = in[i].psfNpix;
    51     out[i].crNsigma   = in[i].crNsigma;
    5251    out[i].extNsigma  = in[i].extNsigma;
    5352    out[i].FWx        = in[i].FWx;
     
    114113    out[i].psfNdof    = in[i].psfNdof;
    115114    out[i].psfNpix    = in[i].psfNpix;
    116     out[i].crNsigma   = in[i].crNsigma;
    117115    out[i].extNsigma  = in[i].extNsigma;
    118116    out[i].FWx        = in[i].FWx;
     
    541539    out[i].psfNdof    = in[i].psfNdof;
    542540    out[i].psfNpix    = in[i].psfNpix;
    543     out[i].crNsigma   = in[i].crNsigma;
    544541    out[i].extNsigma  = in[i].extNsigma;
    545542    out[i].FWx        = in[i].FWx;
  • trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c

    r37116 r37246  
    5656    out[i].psfNdof    = in[i].psfNdof;
    5757    out[i].psfNpix    = in[i].psfNpix;
    58     out[i].crNsigma   = in[i].crNsigma;
    5958    out[i].extNsigma  = in[i].extNsigma;
    6059    out[i].FWx        = in[i].FWx;
     
    7372    out[i].dbFlags    = in[i].dbFlags;
    7473    out[i].photFlags  = in[i].photFlags;
     74    out[i].photFlags2 = in[i].photFlags2;
    7575  }
    7676  return (out);
     
    128128    out[i].psfNdof    = in[i].psfNdof;
    129129    out[i].psfNpix    = in[i].psfNpix;
    130     out[i].crNsigma   = in[i].crNsigma;
    131130    out[i].extNsigma  = in[i].extNsigma;
    132131    out[i].FWx        = in[i].FWx;
     
    145144    out[i].dbFlags    = in[i].dbFlags;
    146145    out[i].photFlags  = in[i].photFlags;
     146    out[i].photFlags2 = in[i].photFlags2;
    147147  }
    148148  return (out);
     
    203203    out[i].refColorRed   = in[i].refColorRed;
    204204
     205    out[i].tessID        = in[i].tessID;
     206    out[i].skycellID     = in[i].skycellID;
     207    out[i].projectionID  = in[i].projectionID;
     208
    205209    out[i].flags         = in[i].flags;   
    206210    out[i].photFlagsUpper = in[i].photFlagsUpper;   
     
    223227
    224228  for (i = 0; i < Nvalues; i++) {
    225     out[i].R             = in[i].R;     
    226     out[i].D             = in[i].D;     
    227     out[i].dR            = in[i].dR;
    228     out[i].dD            = in[i].dD;
    229     out[i].uR            = in[i].uR;
    230     out[i].uD            = in[i].uD;
    231     out[i].duR           = in[i].duR;
    232     out[i].duD           = in[i].duD;
    233     out[i].P             = in[i].P;
    234     out[i].dP            = in[i].dP;
    235 
    236     out[i].Rstk          = in[i].Rstk;     
    237     out[i].Dstk          = in[i].Dstk;     
    238     out[i].dRstk         = in[i].dRstk;
    239     out[i].dDstk         = in[i].dDstk;
    240 
    241     out[i].ChiSqAve      = in[i].ChiSqAve;     
    242     out[i].ChiSqPM       = in[i].ChiSqPM;     
    243     out[i].ChiSqPar      = in[i].ChiSqPar;     
    244     out[i].Tmean         = in[i].Tmean;     
    245     out[i].Trange        = in[i].Trange;     
    246 
    247     out[i].psfQF         = in[i].psfQF;
    248     out[i].psfQFperf     = in[i].psfQFperf;
    249     out[i].stargal       = in[i].stargal;     
    250     out[i].Npos          = in[i].Npos;     
    251 
    252     out[i].Nmeasure      = in[i].Nmeasure;     
    253     out[i].Nmissing      = in[i].Nmissing;     
    254     out[i].Nlensing      = in[i].Nlensing;     
    255     out[i].Nlensobj      = in[i].Nlensobj;     
    256     out[i].Nextend       = in[i].Nextend;     
    257 
    258     out[i].measureOffset = in[i].measureOffset;
    259     out[i].missingOffset = in[i].missingOffset;
    260     out[i].lensingOffset = in[i].lensingOffset;
    261     out[i].lensobjOffset = in[i].lensobjOffset;
    262     out[i].extendOffset  = in[i].extendOffset;
    263     out[i].paramsOffset  = in[i].paramsOffset;
    264 
    265     out[i].refColorBlue  = in[i].refColorBlue;
    266     out[i].refColorRed   = in[i].refColorRed;
    267 
    268     out[i].flags         = in[i].flags;   
     229    out[i].R              = in[i].R;     
     230    out[i].D              = in[i].D;     
     231    out[i].dR             = in[i].dR;
     232    out[i].dD             = in[i].dD;
     233    out[i].uR             = in[i].uR;
     234    out[i].uD             = in[i].uD;
     235    out[i].duR            = in[i].duR;
     236    out[i].duD            = in[i].duD;
     237    out[i].P              = in[i].P;
     238    out[i].dP             = in[i].dP;
     239                         
     240    out[i].Rstk           = in[i].Rstk;     
     241    out[i].Dstk           = in[i].Dstk;     
     242    out[i].dRstk          = in[i].dRstk;
     243    out[i].dDstk          = in[i].dDstk;
     244                         
     245    out[i].ChiSqAve       = in[i].ChiSqAve;     
     246    out[i].ChiSqPM        = in[i].ChiSqPM;     
     247    out[i].ChiSqPar       = in[i].ChiSqPar;     
     248    out[i].Tmean          = in[i].Tmean;     
     249    out[i].Trange         = in[i].Trange;     
     250                         
     251    out[i].psfQF          = in[i].psfQF;
     252    out[i].psfQFperf      = in[i].psfQFperf;
     253    out[i].stargal        = in[i].stargal;     
     254    out[i].Npos           = in[i].Npos;     
     255                         
     256    out[i].Nmeasure       = in[i].Nmeasure;     
     257    out[i].Nmissing       = in[i].Nmissing;     
     258    out[i].Nlensing       = in[i].Nlensing;     
     259    out[i].Nlensobj       = in[i].Nlensobj;     
     260    out[i].Nextend        = in[i].Nextend;     
     261                         
     262    out[i].measureOffset  = in[i].measureOffset;
     263    out[i].missingOffset  = in[i].missingOffset;
     264    out[i].lensingOffset  = in[i].lensingOffset;
     265    out[i].lensobjOffset  = in[i].lensobjOffset;
     266    out[i].extendOffset   = in[i].extendOffset;
     267    out[i].paramsOffset   = in[i].paramsOffset;
     268                         
     269    out[i].refColorBlue   = in[i].refColorBlue;
     270    out[i].refColorRed    = in[i].refColorRed;
     271                         
     272    out[i].tessID         = in[i].tessID;
     273    out[i].skycellID      = in[i].skycellID;
     274    out[i].projectionID   = in[i].projectionID;
     275                         
     276    out[i].flags          = in[i].flags;   
    269277    out[i].photFlagsUpper = in[i].photFlagsUpper;   
    270278    out[i].photFlagsLower = in[i].photFlagsLower;   
    271     out[i].objID         = in[i].objID;
    272     out[i].catID         = in[i].catID;
    273     out[i].extID         = in[i].extID;
    274     out[i].extIDgc       = in[i].extIDgc;
     279    out[i].objID          = in[i].objID;
     280    out[i].catID          = in[i].catID;
     281    out[i].extID          = in[i].extID;
     282    out[i].extIDgc        = in[i].extIDgc;
    275283  }
    276284  return (out);
     
    286294  for (i = 0; i < Nvalues; i++) {
    287295    dvo_secfilt_init (&out[i]);
    288 
    289     out[i].M             = in[i].M;     
    290     out[i].dM            = in[i].dM;     
    291     out[i].Map           = in[i].Map;     
    292     out[i].dMap          = in[i].dMap;     
    293     out[i].sMap          = in[i].sMap;     
    294     out[i].Mkron         = in[i].Mkron;     
    295     out[i].dMkron        = in[i].dMkron;     
    296 
    297     out[i].Mstdev        = in[i].Mstdev;     
    298     out[i].Mmin          = in[i].Mmin;     
    299     out[i].Mmax          = in[i].Mmax;     
    300     out[i].Mchisq        = in[i].Mchisq;     
    301 
    302     out[i].Ncode         = in[i].Ncode;
    303     out[i].Nused         = in[i].Nused;
    304     out[i].NusedKron     = in[i].NusedKron;
    305     out[i].NusedAp       = in[i].NusedAp;
    306 
    307     out[i].flags         = in[i].flags;     
    308 
    309     out[i].MpsfStk       = in[i].MpsfStk;
    310     out[i].FpsfStk       = in[i].FpsfStk;
    311     out[i].dFpsfStk      = in[i].dFpsfStk;
    312 
    313     out[i].MkronStk      = in[i].MkronStk;
    314     out[i].FkronStk      = in[i].FkronStk;
    315     out[i].dFkronStk     = in[i].dFkronStk;
    316 
    317     out[i].MapStk        = in[i].MapStk;
    318     out[i].FapStk        = in[i].FapStk;
    319     out[i].dFapStk       = in[i].dFapStk;
    320 
    321     out[i].stackPrmryOff = in[i].stackPrmryOff;     
    322     out[i].stackBestOff  = in[i].stackBestOff;     
    323 
    324     out[i].MpsfWrp       = in[i].MpsfWrp;
    325     out[i].FpsfWrp       = in[i].FpsfWrp;
    326     out[i].dFpsfWrp      = in[i].dFpsfWrp;
    327     out[i].sFpsfWrp      = in[i].sFpsfWrp;
    328 
    329     out[i].MkronWrp      = in[i].MkronWrp;
    330     out[i].FkronWrp      = in[i].FkronWrp;
    331     out[i].dFkronWrp     = in[i].dFkronWrp;
    332     out[i].sFkronWrp     = in[i].sFkronWrp;
    333 
    334     out[i].MapWrp        = in[i].MapWrp;
    335     out[i].FapWrp        = in[i].FapWrp;
    336     out[i].dFapWrp       = in[i].dFapWrp;
    337     out[i].sFapWrp       = in[i].sFapWrp;
    338 
    339     out[i].NusedWrp      = in[i].NusedWrp;
    340     out[i].NusedKronWrp  = in[i].NusedKronWrp;
    341     out[i].NusedApWrp    = in[i].NusedApWrp;
    342 
    343     out[i].ubercalDist   = in[i].ubercalDist;     
    344   }
    345   return (out);
    346 }
    347 
    348 SecFilt_PS1_V5 *SecFiltInternalTo_PS1_V5 (SecFilt *in, off_t Nvalues) {
    349 
    350   off_t i;
    351   SecFilt_PS1_V5 *out;
    352 
    353   ALLOCATE_ZERO (out, SecFilt_PS1_V5, Nvalues);
    354 
    355   for (i = 0; i < Nvalues; i++) {
    356296
    357297    out[i].M             = in[i].M;     
     
    364304    out[i].sMkron        = in[i].sMkron;     
    365305
     306    out[i].psfQfMax      = in[i].psfQfMax;     
     307    out[i].psfQfPerfMax  = in[i].psfQfPerfMax;     
     308
    366309    out[i].Mstdev        = in[i].Mstdev;     
    367310    out[i].Mmin          = in[i].Mmin;     
     
    388331    out[i].dFapStk       = in[i].dFapStk;
    389332
     333    out[i].Nstack        = in[i].Nstack;     
     334    out[i].NstackDet     = in[i].NstackDet;     
     335
    390336    out[i].stackPrmryOff = in[i].stackPrmryOff;     
    391337    out[i].stackBestOff  = in[i].stackBestOff;     
     
    409355    out[i].NusedKronWrp  = in[i].NusedKronWrp;
    410356    out[i].NusedApWrp    = in[i].NusedApWrp;
     357
     358    out[i].Nwarp         = in[i].Nwarp;     
     359    out[i].NwarpGood     = in[i].NwarpGood;     
     360
     361    out[i].ubercalDist   = in[i].ubercalDist;     
     362  }
     363  return (out);
     364}
     365
     366SecFilt_PS1_V5 *SecFiltInternalTo_PS1_V5 (SecFilt *in, off_t Nvalues) {
     367
     368  off_t i;
     369  SecFilt_PS1_V5 *out;
     370
     371  ALLOCATE_ZERO (out, SecFilt_PS1_V5, Nvalues);
     372
     373  for (i = 0; i < Nvalues; i++) {
     374
     375    out[i].M             = in[i].M;     
     376    out[i].dM            = in[i].dM;     
     377    out[i].Map           = in[i].Map;     
     378    out[i].dMap          = in[i].dMap;     
     379    out[i].sMap          = in[i].sMap;     
     380    out[i].Mkron         = in[i].Mkron;     
     381    out[i].dMkron        = in[i].dMkron;     
     382    out[i].sMkron        = in[i].sMkron;     
     383
     384    out[i].psfQfMax      = in[i].psfQfMax;     
     385    out[i].psfQfPerfMax  = in[i].psfQfPerfMax;     
     386
     387    out[i].Mstdev        = in[i].Mstdev;     
     388    out[i].Mmin          = in[i].Mmin;     
     389    out[i].Mmax          = in[i].Mmax;     
     390    out[i].Mchisq        = in[i].Mchisq;     
     391
     392    out[i].Ncode         = in[i].Ncode;
     393    out[i].Nused         = in[i].Nused;
     394    out[i].NusedKron     = in[i].NusedKron;
     395    out[i].NusedAp       = in[i].NusedAp;
     396
     397    out[i].flags         = in[i].flags;     
     398
     399    out[i].MpsfStk       = in[i].MpsfStk;
     400    out[i].FpsfStk       = in[i].FpsfStk;
     401    out[i].dFpsfStk      = in[i].dFpsfStk;
     402
     403    out[i].MkronStk      = in[i].MkronStk;
     404    out[i].FkronStk      = in[i].FkronStk;
     405    out[i].dFkronStk     = in[i].dFkronStk;
     406
     407    out[i].MapStk        = in[i].MapStk;
     408    out[i].FapStk        = in[i].FapStk;
     409    out[i].dFapStk       = in[i].dFapStk;
     410
     411    out[i].Nstack        = in[i].Nstack;     
     412    out[i].NstackDet     = in[i].NstackDet;     
     413
     414    out[i].stackPrmryOff = in[i].stackPrmryOff;     
     415    out[i].stackBestOff  = in[i].stackBestOff;     
     416
     417    out[i].MpsfWrp       = in[i].MpsfWrp;
     418    out[i].FpsfWrp       = in[i].FpsfWrp;
     419    out[i].dFpsfWrp      = in[i].dFpsfWrp;
     420    out[i].sFpsfWrp      = in[i].sFpsfWrp;
     421
     422    out[i].MkronWrp      = in[i].MkronWrp;
     423    out[i].FkronWrp      = in[i].FkronWrp;
     424    out[i].dFkronWrp     = in[i].dFkronWrp;
     425    out[i].sFkronWrp     = in[i].sFkronWrp;
     426
     427    out[i].MapWrp        = in[i].MapWrp;
     428    out[i].FapWrp        = in[i].FapWrp;
     429    out[i].dFapWrp       = in[i].dFapWrp;
     430    out[i].sFapWrp       = in[i].sFapWrp;
     431
     432    out[i].NusedWrp      = in[i].NusedWrp;
     433    out[i].NusedKronWrp  = in[i].NusedKronWrp;
     434    out[i].NusedApWrp    = in[i].NusedApWrp;
     435
     436    out[i].Nwarp         = in[i].Nwarp;     
     437    out[i].NwarpGood     = in[i].NwarpGood;     
    411438
    412439    out[i].ubercalDist   = in[i].ubercalDist;     
     
    834861  return (out);
    835862}
     863
     864/*********************** old / alternate version **********************/
     865
     866// 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
     867Average *Average_PS1_V5alt_ToInternal (Average_PS1_V5alt *in, off_t Nvalues) {
     868
     869  off_t i;
     870  Average *out;
     871
     872  ALLOCATE_ZERO (out, Average, Nvalues);
     873
     874  for (i = 0; i < Nvalues; i++) {
     875    dvo_average_init (&out[i]);
     876
     877    out[i].R              = in[i].R;     
     878    out[i].D              = in[i].D;     
     879    out[i].dR             = in[i].dR;
     880    out[i].dD             = in[i].dD;
     881    out[i].uR             = in[i].uR;
     882    out[i].uD             = in[i].uD;
     883    out[i].duR            = in[i].duR;
     884    out[i].duD            = in[i].duD;
     885    out[i].P              = in[i].P;
     886    out[i].dP             = in[i].dP;
     887                         
     888    out[i].Rstk           = in[i].Rstk;     
     889    out[i].Dstk           = in[i].Dstk;     
     890    out[i].dRstk          = in[i].dRstk;
     891    out[i].dDstk          = in[i].dDstk;
     892                         
     893    out[i].ChiSqAve       = in[i].ChiSqAve;     
     894    out[i].ChiSqPM        = in[i].ChiSqPM;     
     895    out[i].ChiSqPar       = in[i].ChiSqPar;     
     896    out[i].Tmean          = in[i].Tmean;     
     897    out[i].Trange         = in[i].Trange;     
     898                         
     899    out[i].psfQF          = in[i].psfQF;
     900    out[i].psfQFperf      = in[i].psfQFperf;
     901    out[i].stargal        = in[i].stargal;     
     902    out[i].Npos           = in[i].Npos;     
     903                         
     904    out[i].Nmeasure       = in[i].Nmeasure;     
     905    out[i].Nmissing       = in[i].Nmissing;     
     906    out[i].Nlensing       = in[i].Nlensing;     
     907    out[i].Nlensobj       = in[i].Nlensobj;     
     908    out[i].Nextend        = in[i].Nextend;     
     909                         
     910    out[i].measureOffset  = in[i].measureOffset;
     911    out[i].missingOffset  = in[i].missingOffset;
     912    out[i].lensingOffset  = in[i].lensingOffset;
     913    out[i].lensobjOffset  = in[i].lensobjOffset;
     914    out[i].extendOffset   = in[i].extendOffset;
     915    out[i].paramsOffset   = in[i].paramsOffset;
     916                         
     917    out[i].refColorBlue   = in[i].refColorBlue;
     918    out[i].refColorRed    = in[i].refColorRed;
     919                         
     920    out[i].flags          = in[i].flags;   
     921    out[i].photFlagsUpper = in[i].photFlagsUpper;   
     922    out[i].photFlagsLower = in[i].photFlagsLower;   
     923    out[i].objID          = in[i].objID;
     924    out[i].catID          = in[i].catID;
     925    out[i].extID          = in[i].extID;
     926    out[i].extIDgc        = in[i].extIDgc;
     927  }
     928  return (out);
     929}
     930
     931int gfits_convert_Average_PS1_V5alt (Average_PS1_V5alt *data, off_t size, off_t nitems) {
     932
     933  off_t i;
     934  unsigned char *byte, tmp;
     935
     936  if (size != 184) {
     937    fprintf (stderr, "WARNING: mismatch in data types Average_PS1_V5alt: "OFF_T_FMT" vs %d\n",  size,  184);
     938    return (FALSE);
     939  }
     940
     941  /* provide initial values to avoid compiler warnings for non-BYTE_SWAP arch */
     942  i = tmp = 0;
     943  byte = NULL;
     944
     945# ifdef BYTE_SWAP
     946  byte = (unsigned char *) data;
     947  for (i = 0; i < nitems; i++, byte += 184) {
     948    /** BYTE SWAP **/
     949    SWAP_DBLE (0); // RA
     950    SWAP_DBLE (8); // DEC
     951    SWAP_WORD (16); // RA_ERR
     952    SWAP_WORD (20); // DEC_ERR
     953    SWAP_WORD (24); // U_RA
     954    SWAP_WORD (28); // U_DEC
     955    SWAP_WORD (32); // V_RA_ERR
     956    SWAP_WORD (36); // V_DEC_ERR
     957    SWAP_WORD (40); // PAR
     958    SWAP_WORD (44); // PAR_ERR
     959    SWAP_DBLE (48); // RA_STK
     960    SWAP_DBLE (56); // DEC_STK
     961    SWAP_WORD (64); // RA_STK_ERR
     962    SWAP_WORD (68); // DEC_STK_ERR
     963    SWAP_WORD (72); // CHISQ_POS
     964    SWAP_WORD (76); // CHISQ_PM
     965    SWAP_WORD (80); // CHISQ_PAP
     966    SWAP_WORD (84); // MEAN_EPOCH
     967    SWAP_WORD (88); // TIME_RANGE
     968    SWAP_WORD (92); // PSF_QF
     969    SWAP_WORD (96); // PSF_QF_PERF
     970    SWAP_WORD (100); // STARGAL_SEP
     971    SWAP_BYTE (104); // NUMBER_POS
     972    SWAP_BYTE (106); // NMEASURE
     973    SWAP_BYTE (108); // NMISSING
     974    SWAP_BYTE (110); // NLENSING
     975    SWAP_BYTE (112); // NLENSOBJ
     976    SWAP_BYTE (114); // NEXTEND
     977    SWAP_WORD (116); // OFF_MEASURE
     978    SWAP_WORD (120); // OFF_MISSING
     979    SWAP_WORD (124); // OFF_LENSING
     980    SWAP_WORD (128); // OFF_LENSOBJ
     981    SWAP_WORD (132); // OFF_EXTEND
     982    SWAP_WORD (136); // OFF_PARAMS
     983    SWAP_WORD (140); // REF_COLOR_BLUE
     984    SWAP_WORD (144); // REF_COLOR_RED
     985    SWAP_WORD (148); // FLAGS
     986    SWAP_WORD (152); // PHOTFLAGS_U
     987    SWAP_WORD (156); // PHOTFLAGS_L
     988    SWAP_WORD (160); // OBJ_ID
     989    SWAP_WORD (164); // CAT_ID
     990    SWAP_DBLE (168); // EXT_ID
     991    SWAP_DBLE (176); // EXT_ID_GC
     992  }
     993# endif 
     994
     995  return (TRUE);
     996}
     997
     998/*** add test of EXTNAME and header-defined columns? ***/
     999/* return internal structure representation */
     1000Average_PS1_V5alt *gfits_table_get_Average_PS1_V5alt (FTable *ftable, off_t *Ndata, char *swapped) {
     1001
     1002  int Ncols;
     1003  Average_PS1_V5alt *data;
     1004
     1005  Ncols = ftable[0].header[0].Naxis[0];
     1006  if (Ncols != 184) {
     1007    fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, 184);
     1008    return NULL;
     1009  }
     1010
     1011  *Ndata = ftable[0].header[0].Naxis[1];
     1012  data = (Average_PS1_V5alt *) ftable[0].buffer;
     1013  if ((swapped == NULL) || (*swapped == FALSE)) {
     1014    if (!gfits_convert_Average_PS1_V5alt (data, sizeof (Average_PS1_V5alt), *Ndata)) {
     1015      return NULL;
     1016    }
     1017    gfits_table_scale_data (ftable);
     1018    if (swapped != NULL) *swapped = TRUE;
     1019  }
     1020  return (data);
     1021}
     1022
     1023/****** alt secfilt **********/
     1024
     1025SecFilt *SecFilt_PS1_V5alt_ToInternal (SecFilt_PS1_V5alt *in, off_t Nvalues) {
     1026
     1027  off_t i;
     1028  SecFilt *out;
     1029
     1030  ALLOCATE_ZERO (out, SecFilt, Nvalues);
     1031
     1032  for (i = 0; i < Nvalues; i++) {
     1033    dvo_secfilt_init (&out[i]);
     1034
     1035    out[i].M             = in[i].M;     
     1036    out[i].dM            = in[i].dM;     
     1037    out[i].Map           = in[i].Map;     
     1038    out[i].dMap          = in[i].dMap;     
     1039    out[i].sMap          = in[i].sMap;     
     1040    out[i].Mkron         = in[i].Mkron;     
     1041    out[i].dMkron        = in[i].dMkron;     
     1042
     1043    out[i].Mstdev        = in[i].Mstdev;     
     1044    out[i].Mmin          = in[i].Mmin;     
     1045    out[i].Mmax          = in[i].Mmax;     
     1046    out[i].Mchisq        = in[i].Mchisq;     
     1047
     1048    out[i].Ncode         = in[i].Ncode;
     1049    out[i].Nused         = in[i].Nused;
     1050    out[i].NusedKron     = in[i].NusedKron;
     1051    out[i].NusedAp       = in[i].NusedAp;
     1052
     1053    out[i].flags         = in[i].flags;     
     1054
     1055    out[i].MpsfStk       = in[i].MpsfStk;
     1056    out[i].FpsfStk       = in[i].FpsfStk;
     1057    out[i].dFpsfStk      = in[i].dFpsfStk;
     1058
     1059    out[i].MkronStk      = in[i].MkronStk;
     1060    out[i].FkronStk      = in[i].FkronStk;
     1061    out[i].dFkronStk     = in[i].dFkronStk;
     1062
     1063    out[i].MapStk        = in[i].MapStk;
     1064    out[i].FapStk        = in[i].FapStk;
     1065    out[i].dFapStk       = in[i].dFapStk;
     1066
     1067    out[i].stackPrmryOff = in[i].stackPrmryOff;     
     1068    out[i].stackBestOff  = in[i].stackBestOff;     
     1069
     1070    out[i].MpsfWrp       = in[i].MpsfWrp;
     1071    out[i].FpsfWrp       = in[i].FpsfWrp;
     1072    out[i].dFpsfWrp      = in[i].dFpsfWrp;
     1073    out[i].sFpsfWrp      = in[i].sFpsfWrp;
     1074
     1075    out[i].MkronWrp      = in[i].MkronWrp;
     1076    out[i].FkronWrp      = in[i].FkronWrp;
     1077    out[i].dFkronWrp     = in[i].dFkronWrp;
     1078    out[i].sFkronWrp     = in[i].sFkronWrp;
     1079
     1080    out[i].MapWrp        = in[i].MapWrp;
     1081    out[i].FapWrp        = in[i].FapWrp;
     1082    out[i].dFapWrp       = in[i].dFapWrp;
     1083    out[i].sFapWrp       = in[i].sFapWrp;
     1084
     1085    out[i].NusedWrp      = in[i].NusedWrp;
     1086    out[i].NusedKronWrp  = in[i].NusedKronWrp;
     1087    out[i].NusedApWrp    = in[i].NusedApWrp;
     1088
     1089    out[i].ubercalDist   = in[i].ubercalDist;     
     1090  }
     1091  return (out);
     1092}
     1093
     1094int gfits_convert_SecFilt_PS1_V5alt (SecFilt_PS1_V5alt *data, off_t size, off_t nitems) {
     1095
     1096  off_t i;
     1097  unsigned char *byte, tmp;
     1098
     1099  if (size != 160) {
     1100    fprintf (stderr, "WARNING: mismatch in data types SecFilt_PS1_V5alt: "OFF_T_FMT" vs %d\n",  size,  160);
     1101    return (FALSE);
     1102  }
     1103
     1104  /* provide initial values to avoid compiler warnings for non-BYTE_SWAP arch */
     1105  i = tmp = 0;
     1106  byte = NULL;
     1107
     1108# ifdef BYTE_SWAP
     1109  byte = (unsigned char *) data;
     1110  for (i = 0; i < nitems; i++, byte += 160) {
     1111    /** BYTE SWAP **/
     1112    SWAP_WORD (0); // MAG
     1113    SWAP_WORD (4); // MAG_ERR
     1114    SWAP_WORD (8); // MAG_AP
     1115    SWAP_WORD (12); // MAG_AP_ERR
     1116    SWAP_WORD (16); // MAG_AP_STDEV
     1117    SWAP_WORD (20); // MAG_KRON
     1118    SWAP_WORD (24); // MAG_KRON_ERR
     1119    SWAP_WORD (28); // MAG_KRON_STDEV
     1120    SWAP_WORD (32); // MAG_STDEV
     1121    SWAP_WORD (36); // MAG_MIN
     1122    SWAP_WORD (40); // MAG_MAX
     1123    SWAP_WORD (44); // MAG_CHI
     1124    SWAP_BYTE (48); // NCODE
     1125    SWAP_BYTE (50); // NUSED
     1126    SWAP_BYTE (52); // NUSED_KRON
     1127    SWAP_BYTE (54); // NUSED_AP
     1128    SWAP_WORD (56); // FLAGS
     1129    SWAP_WORD (60); // MAG_PSF_STK
     1130    SWAP_WORD (64); // FLUX_PSF_STK
     1131    SWAP_WORD (68); // FLUX_PSF_STK_ERR
     1132    SWAP_WORD (72); // MAG_KRON_STK
     1133    SWAP_WORD (76); // FLUX_KRON_STK
     1134    SWAP_WORD (80); // FLUX_KRON_STK_ERR
     1135    SWAP_WORD (84); // MAG_AP_STK
     1136    SWAP_WORD (88); // FLUX_AP_STK
     1137    SWAP_WORD (92); // FLUX_AP_STK_ERR
     1138    SWAP_WORD (96); // STACK_PRIMARY_OFF
     1139    SWAP_WORD (100); // STACK_BEST_OFF
     1140    SWAP_WORD (104); // MAG_PSF_WRP
     1141    SWAP_WORD (108); // FLUX_PSF_WRP
     1142    SWAP_WORD (112); // FLUX_PSF_WRP_ERR
     1143    SWAP_WORD (116); // FLUX_PSF_WRP_STD
     1144    SWAP_WORD (120); // MAG_KRON_WRP
     1145    SWAP_WORD (124); // FLUX_KRON_WRP
     1146    SWAP_WORD (128); // FLUX_KRON_WRP_ERR
     1147    SWAP_WORD (132); // FLUX_KRON_WRP_STD
     1148    SWAP_WORD (136); // MAG_AP_WRP
     1149    SWAP_WORD (140); // FLUX_AP_WRP
     1150    SWAP_WORD (144); // FLUX_AP_WRP_ERR
     1151    SWAP_WORD (148); // FLUX_AP_WRP_STD
     1152    SWAP_BYTE (152); // NUSED_WRP
     1153    SWAP_BYTE (154); // NUSED_KRON_WRP
     1154    SWAP_BYTE (156); // NUSED_AP_WRP
     1155    SWAP_BYTE (158); // UBERCAL_DIST
     1156  }
     1157# endif 
     1158
     1159  return (TRUE);
     1160}
     1161
     1162/*** add test of EXTNAME and header-defined columns? ***/
     1163/* return internal structure representation */
     1164SecFilt_PS1_V5alt *gfits_table_get_SecFilt_PS1_V5alt (FTable *ftable, off_t *Ndata, char *swapped) {
     1165
     1166  int Ncols;
     1167  SecFilt_PS1_V5alt *data;
     1168
     1169  Ncols = ftable[0].header[0].Naxis[0];
     1170  if (Ncols != 160) {
     1171    fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, 160);
     1172    return NULL;
     1173  }
     1174
     1175  *Ndata = ftable[0].header[0].Naxis[1];
     1176  data = (SecFilt_PS1_V5alt *) ftable[0].buffer;
     1177  if ((swapped == NULL) || (*swapped == FALSE)) {
     1178    if (!gfits_convert_SecFilt_PS1_V5alt (data, sizeof (SecFilt_PS1_V5alt), *Ndata)) {
     1179      return NULL;
     1180    }
     1181    gfits_table_scale_data (ftable);
     1182    if (swapped != NULL) *swapped = TRUE;
     1183  }
     1184  return (data);
     1185}
     1186
     1187
  • trunk/Ohana/src/opihi/cmd.astro/cplot.c

    r34613 r37246  
    44 
    55  double ra_prev = 0;
    6   int i, kapa, Npts, status, leftside;
     6  int i, kapa, Npts, status, leftside, valid, size;
    77  opihi_flt *x, *y, *r, *d, Rmin, Rmax, Rmid;
    88  Vector Xvec, Yvec, *xvec, *yvec;
     
    1111  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
    1212
    13   if (argc != 3) {
     13  valid  = (argc == 3);
     14  valid |= (argc > 4) && !strcmp (argv[3], "where");
     15  if (!valid) {
    1416    gprint (GP_ERR, "USAGE: cplot <ra> <dec> [style]\n");
     17    gprint (GP_ERR, "   OR: cplot <ra> <dec> [style] where (condition)\n");
    1518    return (FALSE);
    1619  }
     
    3235  }
    3336
     37  // tvec is used for logical test (truth vector)
     38  Vector *tvec = NULL;
     39  if (argc > 4) {
     40    char *out = dvomath (argc - 4, &argv[4], &size, 1);
     41    if (out == NULL) {
     42      print_error ();
     43      return FALSE;
     44    }
     45    if ((tvec = SelectVector (out, OLDVECTOR, TRUE)) == NULL) {
     46      gprint (GP_ERR, " invalid logic result\n");
     47      DeleteNamedVector (out);
     48      free (out);
     49      return (FALSE);
     50    }
     51  }
     52
     53  if (tvec && tvec[0].Nelements != yvec[0].Nelements) {
     54    gprint (GP_ERR, "logic test vector not the same length as data vectors\n");
     55    DeleteVector (tvec);
     56    return (FALSE);
     57  }
     58
    3459  SetVector (&Xvec, OPIHI_FLT, xvec[0].Nelements);
    3560  SetVector (&Yvec, OPIHI_FLT, xvec[0].Nelements);
     
    4267  Npts = 0;
    4368  for (i = 0; i < Xvec.Nelements; i++, r++, d++) {
     69    if (tvec) {
     70      int skip = (tvec->type == OPIHI_FLT) ? (tvec->elements.Flt[i] == 0.0) : (tvec->elements.Int[i] == 0.0);
     71      if (skip) continue;
     72    }
     73
    4474    double ra = ohana_normalize_angle (*r);
    4575    while (ra < Rmin) ra += 360.0;
     
    88118  free (Yvec.elements.Ptr);
    89119   
     120  if (tvec) DeleteVector (tvec);
     121
    90122  return (TRUE);
    91123}
  • trunk/Ohana/src/opihi/dvo/gstar.c

    r37116 r37246  
    627627              gprint (GP_LOG, "%5.3f ", catalog.measure[Nv].psfQF);
    628628              gprint (GP_LOG, "%7.1f ", catalog.measure[Nv].psfChisq);
    629               gprint (GP_LOG, "%3.1f ", catalog.measure[Nv].crNsigma);
     629              // gprint (GP_LOG, "%3.1f ", catalog.measure[Nv].crNsigma);
    630630              gprint (GP_LOG, "%4.1f ", catalog.measure[Nv].extNsigma);
    631631              gprint (GP_LOG, "%5.1f ", FromShortDegrees(catalog.measure[Nv].theta));
  • trunk/Ohana/src/relastro/src/UpdateObjects.c

    r37038 r37246  
    467467      catalog[i].average[j].Npos = fit.Nfit;
    468468
     469      // XXX EAM 20140812: for a test, set average.Rstk,Dstk, etc to match R,D
     470      catalog[i].average[j].Rstk  = fit.Ro; // RA in degrees
     471      catalog[i].average[j].Dstk  = fit.Do; // DEC in degrees
     472      catalog[i].average[j].dRstk = fit.dRo; // RA scatter in arcsec
     473      catalog[i].average[j].dDstk = fit.dDo; // DEC scatter in arcsec
     474
    469475      // unset the NO_ASTROM bit (not(NO_ASTROM) == HAVE_ASTROM)
    470476      catalog[i].average[j].flags &= ~ID_STAR_NO_ASTROM;
  • trunk/Ohana/src/relphot/src/setMrelCatalog.c

    r37116 r37246  
    147147    off_t meas = measureOffset;
    148148
     149    float psfQfMax = 0.0;
     150    float psfQfPerfMax = 0.0;
     151
    149152    int Nap = 0;
    150153    int Npsf = 0;
     
    166169      // SKIP gpc1 forced-warp data
    167170      if (isGPC1warp(measureT[k].photcode)) continue;
     171
     172      if (isSetMrelFinal) {
     173        if (measure[k].psfQF     > psfQfMax)     psfQfMax     = measure[k].psfQF;
     174        if (measure[k].psfQFperf > psfQfPerfMax) psfQfPerfMax = measure[k].psfQFperf;
     175      }
    168176
    169177      if (measureT[k].dbFlags & MEAS_BAD) SKIP_THIS_MEAS(Nbad);
     
    367375      secfilt[Nsec].Mmin = psfstats->min;
    368376
     377      secfilt[Nsec].psfQfMax     = psfQfMax;
     378      secfilt[Nsec].psfQfPerfMax = psfQfPerfMax;
     379
    369380      // NOTE : use the modified weight for apmags as well as psf mags
    370381      liststats (Maplist, daplist, waplist, Nap, apstats);
     
    457468  get_tess_ids(&tessID, &projectID, &skycellID, average[0].R, average[0].D);
    458469
     470  average[0].tessID       = tessID;
     471  average[0].projectionID = projectID;
     472  average[0].skycellID    = skycellID;
     473
    459474  int NstackGood = 0;
    460475  int NstackSuspect = 0;
     
    478493    int isBad = FALSE;
    479494    int isSuspect = FALSE;
     495
     496    int Nstack = 0; // number for this photcode
     497    int NstackDet = 0; // number for this photcode
    480498
    481499    off_t meas = measureOffset;
     
    489507      if (!code) continue;
    490508      if (code->equiv != thisCode) { continue; }
     509
     510      Nstack ++;
     511      if (measure[k].photFlags2 & 0x00000004 == 0) NstackDet ++;
    491512
    492513      // clear this bit for all measurements
     
    615636    secfilt[Nsec].stackBestOff = k + measureOffset;
    616637
     638    secfilt[Nsec].Nstack    = Nstack;
     639    secfilt[Nsec].NstackDet = NstackDet;
     640
    617641    // this is the measurement used by secfilt[]
    618642    measure[k].dbFlags |= ID_MEAS_STACK_PHOT_SRC;
     
    694718    int Npsf = 0;
    695719    int Nkron = 0;
     720
     721    int Nwarp = 0;
     722    int NwarpGood = 0;
    696723    for (k = 0; k < average[0].Nmeasure; k++, meas++) {
    697724
     
    703730      if (!code) continue;
    704731      if (code->equiv != thisCode) { continue; }
     732
     733      Nwarp ++;
     734      if (measure[k].psfQFperf > 0.85) NwarpGood ++;
    705735
    706736      measure[k].dbFlags &= ~ID_MEAS_WARP_USED;
     
    799829    secfilt[Nsec].NusedKronWrp = Nkron;
    800830    secfilt[Nsec].MkronWrp  = isnan(secfilt[Nsec].FkronWrp) ? NAN : 8.9 - 2.5*log10(secfilt[Nsec].FkronWrp); // 8.9 since flux is in Jy
     831
     832    secfilt[Nsec].Nwarp     = Nwarp;
     833    secfilt[Nsec].NwarpGood = NwarpGood;
    801834  }
    802835  return (TRUE);
Note: See TracChangeset for help on using the changeset viewer.