IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 12, 2015, 6:18:23 PM (11 years ago)
Author:
eugene
Message:

merge changes from EAM dev branch ohana.20150429

Location:
trunk/Ohana
Files:
45 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/addstar/include/addstar.h

    r37807 r38441  
    8484char   GSCFILE[256];
    8585char  *CATDIR;
    86 char   CATMODE[16];    /* raw, mef, split, mysql */
    87 char   CATFORMAT[16];  /* internal, elixir, loneos, panstarrs */
     86char   CATMODE[16];     /* raw, mef, split, mysql */
     87char   CATFORMAT[16];   /* internal, elixir, loneos, panstarrs */
     88char   CATCOMPRESS[16]; /* GZIP_1, NONE */
    8889char   TWO_MASS_DIR_AS[256];
    8990char   TWO_MASS_DIR_DR2[256];
    … …  
    326327void *memrchr(const void *s, int c, size_t n);
    327328int addstar_create_ID ();
    328 int strextend (char *input, char *format,...);
    329329
    330330void initMosaicCoords ();
  • trunk/Ohana/src/addstar/src/ConfigInit.c

    r33963 r38441  
    134134  ScanConfig (config, "CATMODE",                "%s",  0, CATMODE);
    135135  ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
     136  if (!ScanConfig (config, "CATCOMPRESS",       "%s",  0, CATCOMPRESS)) {
     137    strcpy (CATCOMPRESS, "NONE");
     138  }
    136139  if (!ScanConfig (config, "SKY_DEPTH",         "%d",  0, &SKY_DEPTH)) {
    137140    SKY_DEPTH = SKY_DEPTH_HST;
  • trunk/Ohana/src/addstar/src/ReadStarsFITS.c

    r37995 r38441  
    153153  off_t Nstars;
    154154  unsigned int i;
    155   char swapped;
    156155  double ZeroPt;
    157156  Stars *stars = NULL;
    158157  SMPData *smpdata = NULL;
    159158
    160   swapped = FALSE;
    161   smpdata = gfits_table_get_SMPData (table, &Nstars, &swapped);
     159  smpdata = gfits_table_get_SMPData (table, &Nstars, NULL, NULL);
    162160  if (!smpdata) {
    163161    fprintf (stderr, "skipping inconsistent entry\n");
    … …  
    229227  PS1_DEV_0 *ps1data;
    230228
    231   ps1data = gfits_table_get_PS1_DEV_0 (table, &Nstars, NULL);
     229  ps1data = gfits_table_get_PS1_DEV_0 (table, &Nstars, NULL, NULL);
    232230  if (!ps1data) {
    233231    fprintf (stderr, "skipping inconsistent entry\n");
    … …  
    300298  PS1_DEV_1 *ps1data;
    301299
    302   ps1data = gfits_table_get_PS1_DEV_1 (table, &Nstars, NULL);
     300  ps1data = gfits_table_get_PS1_DEV_1 (table, &Nstars, NULL, NULL);
    303301  if (!ps1data) {
    304302    fprintf (stderr, "skipping inconsistent entry\n");
    … …  
    383381  }
    384382
    385   ps1data = gfits_table_get_CMF_PS1_V1 (table, &Nstars, NULL);
     383  ps1data = gfits_table_get_CMF_PS1_V1 (table, &Nstars, NULL, NULL);
    386384  if (!ps1data) {
    387385    fprintf (stderr, "skipping inconsistent entry\n");
    … …  
    545543  CMF_PS1_V2 *ps1data;
    546544
    547   ps1data = gfits_table_get_CMF_PS1_V2 (table, &Nstars, NULL);
     545  ps1data = gfits_table_get_CMF_PS1_V2 (table, &Nstars, NULL, NULL);
    548546  if (!ps1data) {
    549547    fprintf (stderr, "skipping inconsistent entry\n");
    … …  
    622620  CMF_PS1_V3 *ps1data;
    623621
    624   ps1data = gfits_table_get_CMF_PS1_V3 (table, &Nstars, NULL);
     622  ps1data = gfits_table_get_CMF_PS1_V3 (table, &Nstars, NULL, NULL);
    625623  if (!ps1data) {
    626624    fprintf (stderr, "skipping inconsistent entry\n");
    … …  
    706704  CMF_PS1_V4 *ps1data;
    707705
    708   ps1data = gfits_table_get_CMF_PS1_V4 (table, &Nstars, NULL);
     706  ps1data = gfits_table_get_CMF_PS1_V4 (table, &Nstars, NULL, NULL);
    709707  if (!ps1data) {
    710708    fprintf (stderr, "skipping inconsistent entry\n");
    … …  
    12591257  }
    12601258
    1261   ps1data = gfits_table_get_CMF_PS1_SV1 (table, &Nstars, NULL);
     1259  ps1data = gfits_table_get_CMF_PS1_SV1 (table, &Nstars, NULL, NULL);
    12621260  if (!ps1data) {
    12631261    fprintf (stderr, "skipping inconsistent entry\n");
    … …  
    14231421  CMF_PS1_SV2 *ps1data;
    14241422
    1425   ps1data = gfits_table_get_CMF_PS1_SV2 (table, &Nstars, NULL);
     1423  ps1data = gfits_table_get_CMF_PS1_SV2 (table, &Nstars, NULL, NULL);
    14261424  if (!ps1data) {
    14271425    fprintf (stderr, "skipping inconsistent entry\n");
    … …  
    17531751  CMF_PS1_DV4 *ps1data;
    17541752
    1755   ps1data = gfits_table_get_CMF_PS1_DV4 (table, &Nstars, NULL);
     1753  ps1data = gfits_table_get_CMF_PS1_DV4 (table, &Nstars, NULL, NULL);
    17561754  if (!ps1data) {
    17571755    fprintf (stderr, "skipping inconsistent entry\n");
    … …  
    18391837  CMF_PS1_DV5 *ps1data;
    18401838
    1841   ps1data = gfits_table_get_CMF_PS1_DV5 (table, &Nstars, NULL);
     1839  ps1data = gfits_table_get_CMF_PS1_DV5 (table, &Nstars, NULL, NULL);
    18421840  if (!ps1data) {
    18431841    fprintf (stderr, "skipping inconsistent entry\n");
  • trunk/Ohana/src/addstar/src/SEDfit.c

    r37036 r38441  
    198198  outcat[0].Naverage  = Nave;
    199199  outcat[0].Nmeasure  = Nmeas;
    200   outcat[0].Nsecf_mem = Nave*Nsec;
     200  outcat[0].Nsecfilt_mem = Nave*Nsec;
    201201 
    202202  free (sourceValue.mags);
  • trunk/Ohana/src/addstar/src/UpdateDatabase_Image.c

    r37807 r38441  
    1212  }
    1313
    14   catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
    15   if (options[0].update) catalog.catflags = LOAD_AVES | LOAD_MISS | LOAD_SECF;
     14  catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
     15  if (options[0].update) catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
    1616 
    1717  // XXX this is probably not needed anymore
    … …  
    4747    catalog.filename  = skylist[0].filename[i];
    4848    catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
    49     catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
    50     if (options[0].update) catalog.catflags = LOAD_AVES | LOAD_MISS | LOAD_SECF;
     49    catalog.catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
     50    if (options[0].update) catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
    5151
    5252    // an error exit status here is a significant error
    … …  
    5656    }
    5757
    58     // Naves_disk == 0 implies an empty catalog file
     58    // Naverage_disk == 0 implies an empty catalog file
    5959    // for only_match, skip empty catalogs
    60     if ((catalog.Naves_disk == 0) && options[0].only_match) {
     60    if ((catalog.Naverage_disk == 0) && options[0].only_match) {
    6161      dvo_catalog_unlock (&catalog);
    6262      dvo_catalog_free (&catalog);
    … …  
    7373      SetProtect (TRUE);
    7474      if (options[0].update) {
    75         catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
     75        catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
    7676        dvo_catalog_update (&catalog, VERBOSE);
    7777      } else {
    … …  
    9292    /*** update the image table ***/
    9393    /* setup image table format and lock */
     94    gfits_db_init (&db);
    9495    db.mode   = dvo_catalog_catmode (CATMODE);
    9596    db.format = dvo_catalog_catformat (CATFORMAT);
  • trunk/Ohana/src/addstar/src/UpdateDatabase_Refcat.c

    r15743 r38441  
    3636    catalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
    3737    catalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
    38     catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
    39     if (options[0].update) catalog.catflags = LOAD_AVES | LOAD_MISS | LOAD_SECF;
     38    catalog.catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
     39    if (options[0].update) catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
    4040 
    4141    // an error exit status here is a significant error
    … …  
    4545    }
    4646
    47     // Naves_disk == 0 implies an empty catalog file
     47    // Naverage_disk == 0 implies an empty catalog file
    4848    // for only_match, skip empty catalogs
    49     if ((catalog.Naves_disk == 0) && options[0].only_match) {
     49    if ((catalog.Naverage_disk == 0) && options[0].only_match) {
    5050      dvo_catalog_unlock (&catalog);
    5151      dvo_catalog_free (&catalog);
    … …  
    6363      SetProtect (TRUE);
    6464      if (options[0].update) {
    65         catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
     65        catalog.catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
    6666        dvo_catalog_update (&catalog, VERBOSE);
    6767      } else {
  • trunk/Ohana/src/addstar/src/UpdateDatabase_Reflist.c

    r27435 r38441  
    3636    catalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
    3737    catalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
    38     catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
    39     if (options[0].update) catalog.catflags = LOAD_AVES | LOAD_MISS | LOAD_SECF;
     38    catalog.catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
     39    if (options[0].update) catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
    4040
    4141    // an error exit status here is a significant error
    … …  
    4646
    4747    /* for only_match, skip empty catalogs XXX EAM : this leaves behind empty files */
    48     if ((catalog.Naves_disk == 0) && options[0].only_match) {
     48    if ((catalog.Naverage_disk == 0) && options[0].only_match) {
    4949      dvo_catalog_unlock (&catalog);
    5050      dvo_catalog_free (&catalog);
    … …  
    5959      SetProtect (TRUE);
    6060      if (options[0].update) {
    61         catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
     61        catalog.catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
    6262        dvo_catalog_update (&catalog, VERBOSE);
    6363      } else {
  • trunk/Ohana/src/addstar/src/UpdateImageIDs.c

    r37357 r38441  
    99  /*** update the image table ***/
    1010  /* setup image table format and lock */
     11  gfits_db_init (&db);
    1112  db.mode   = dvo_catalog_catmode (CATMODE);
    1213  db.format = dvo_catalog_catformat (CATFORMAT);
  • trunk/Ohana/src/addstar/src/addstar.c

    r37807 r38441  
    104104
    105105    // set the parameters which guide catalog open/load/create
    106     catalog.filename  = skylist[0].filename[i];
    107     catalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
    108     catalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
    109     catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF | LOAD_LENSING;
    110     catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
     106    catalog.filename    = skylist[0].filename[i];
     107    catalog.catmode     = dvo_catalog_catmode (CATMODE);         // set the default catmode from config data
     108    catalog.catformat   = dvo_catalog_catformat (CATFORMAT);     // set the default catformat from config data
     109    catalog.catcompress = dvo_catalog_catcompress (CATCOMPRESS); // set the default catcompress from config data
     110    catalog.catflags    = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT | DVO_LOAD_LENSING;
     111    catalog.Nsecfilt    = GetPhotcodeNsecfilt ();
    111112
    112113    // XXX need to do something to enforce consistency.  we can change options.update
    … …  
    117118    if (catalog.catmode != DVO_MODE_SPLIT) options.update = FALSE;
    118119
    119     if (options.update) catalog.catflags = LOAD_AVES | LOAD_MISS | LOAD_SECF;
     120    if (options.update) catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
    120121
    121122    // open as read or write, depending on desire
    … …  
    134135    if (VERBOSE) MARKTIME ("load cpt: %f sec\n", dtime); RESETTIME;
    135136
    136     // Naves_disk == 0 implies an empty catalog file
     137    // Naverage_disk == 0 implies an empty catalog file
    137138    // for only_match, skip empty catalogs
    138     if ((catalog.Naves_disk == 0) && options.only_match) {
     139    if ((catalog.Naverage_disk == 0) && options.only_match) {
    139140      dvo_catalog_unlock (&catalog);
    140141      dvo_catalog_free (&catalog);
    … …  
    174175      SetProtect (TRUE);
    175176      if (options.update) {
    176         catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF | LOAD_LENSING;
     177        catalog.catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT | DVO_LOAD_LENSING;
    177178        dvo_catalog_update (&catalog, VERBOSE);
    178179      } else {
    … …  
    193194  /*** update the image table ***/
    194195  /* setup image table format and lock */
     196  gfits_db_init (&db);
    195197  db.mode   = dvo_catalog_catmode (CATMODE);
    196198  db.format = dvo_catalog_catformat (CATFORMAT);
  • trunk/Ohana/src/addstar/src/addstar_create_ID.c

    r35760 r38441  
    1010  /*** update the image table ***/
    1111  /* setup image table format and lock */
    12   // gfits_db_init (&db);
     12  gfits_db_init (&db);
    1313  db.mode   = dvo_catalog_catmode (CATMODE);
    1414  db.format = dvo_catalog_catformat (CATFORMAT);
  • trunk/Ohana/src/addstar/src/args.c

    r37807 r38441  
    480480}
    481481
    482 int strextend (char *input, char *format,...) {
    483 
    484   char tmpextra[1024], tmpline[1024];
    485   va_list argp;
    486 
    487   va_start (argp, format);
    488   vsnprintf (tmpextra, 1024, format, argp);
    489   snprintf (tmpline, 1024, "%s %s", input, tmpextra);
    490   strcpy (input, tmpline);
    491 
    492   return TRUE;
    493 }
    494 
    495482/** addstar modes:
    496483 
  • trunk/Ohana/src/addstar/src/args_parallel_client.c

    r37116 r38441  
    125125}
    126126
    127 int strextend (char *input, char *format,...) {
    128 
    129   char tmpextra[1024], tmpline[1024];
    130   va_list argp;
    131 
    132   va_start (argp, format);
    133   vsnprintf (tmpextra, 1024, format, argp);
    134   snprintf (tmpline, 1024, "%s %s", input, tmpextra);
    135   strcpy (input, tmpline);
    136 
    137   return TRUE;
    138 }
    139 
  • trunk/Ohana/src/addstar/src/dumpskycells.c

    r33719 r38441  
    4646  /*** open the image table ***/
    4747  /* setup image table format and lock */
     48  gfits_db_init (&db);
    4849  db.mode   = dvo_catalog_catmode (CATMODE);
    4950  db.format = dvo_catalog_catformat (CATFORMAT);
  • trunk/Ohana/src/addstar/src/find_matches.c

    r37807 r38441  
    9191
    9292  /* set up pointers for linked list of measure */
    93   if (catalog[0].sorted && (catalog[0].Nmeasure == catalog[0].Nmeas_disk)) {
     93  if (catalog[0].sorted && (catalog[0].Nmeasure == catalog[0].Nmeasure_disk)) {
    9494    next_meas = init_measure_links (catalog[0].average, Nave, catalog[0].measure, Nmeas);
    9595  } else {
    … …  
    320320  catalog[0].Naverage = Nave;
    321321  catalog[0].Nmeasure = Nmeas;
    322   catalog[0].Nsecf_mem = Nave*Nsecfilt;
     322  catalog[0].Nsecfilt_mem = Nave*Nsecfilt;
    323323  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n",  Nstars,  Nave,  Nmeas,  Nmatch);
    324324
  • trunk/Ohana/src/addstar/src/find_matches_ICRF.c

    r37807 r38441  
    164164  catalog[0].Naverage  = Nave;
    165165  catalog[0].Nmeasure  = Nmeas;
    166   catalog[0].Nsecf_mem = Nave*Nsecfilt;
     166  catalog[0].Nsecfilt_mem = Nave*Nsecfilt;
    167167  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %d "OFF_T_FMT" "OFF_T_FMT" ("OFF_T_FMT" matches)\n",  Nstars, Nave, Nmeas, Nmatch);
    168168
  • trunk/Ohana/src/addstar/src/find_matches_closest.c

    r37807 r38441  
    9191
    9292  /* set up pointers for linked list of measure */
    93   if (catalog[0].sorted && (catalog[0].Nmeasure == catalog[0].Nmeas_disk)) {
     93  if (catalog[0].sorted && (catalog[0].Nmeasure == catalog[0].Nmeasure_disk)) {
    9494    // this version is only valid if we have done a full catalog load, and if the catalog
    9595    // is sorted while processed
    … …  
    381381  catalog[0].Nmeasure = Nmeas;
    382382  catalog[0].Nlensing = Nlens;
    383   catalog[0].Nsecf_mem = Nave*Nsecfilt;
     383  catalog[0].Nsecfilt_mem = Nave*Nsecfilt;
    384384  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas, Nlens: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n",  Nstars,  Nave,  Nmeas,  Nlens, Nmatch);
    385385
  • trunk/Ohana/src/addstar/src/find_matches_closest_refstars.c

    r37807 r38441  
    8585
    8686  /* set up pointers for linked list of measure */
    87   if (catalog[0].sorted && (catalog[0].Nmeasure == catalog[0].Nmeas_disk)) {
     87  if (catalog[0].sorted && (catalog[0].Nmeasure == catalog[0].Nmeasure_disk)) {
    8888    // this version is only valid if we have done a full catalog load, and if the catalog
    8989    // is sorted while processed
    … …  
    322322  catalog[0].Naverage = Nave;
    323323  catalog[0].Nmeasure = Nmeas;
    324   catalog[0].Nsecf_mem = Nave*Nsecfilt;
     324  catalog[0].Nsecfilt_mem = Nave*Nsecfilt;
    325325  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n",  Nstars,  Nave,  Nmeas,  Nmatch);
    326326
  • trunk/Ohana/src/addstar/src/find_matches_refstars.c

    r37807 r38441  
    7070
    7171  /* set up pointers for linked list of measurements */
    72   if (catalog[0].sorted && (catalog[0].Nmeasure == catalog[0].Nmeas_disk)) {
     72  if (catalog[0].sorted && (catalog[0].Nmeasure == catalog[0].Nmeasure_disk)) {
    7373    // this version is only valid if we have done a full catalog load, and if the catalog
    7474    // is sorted while processed
    … …  
    298298  catalog[0].Naverage = Nave;
    299299  catalog[0].Nmeasure = Nmeas;
    300   catalog[0].Nsecf_mem = Nave*Nsecfilt;
     300  catalog[0].Nsecfilt_mem = Nave*Nsecfilt;
    301301  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %d "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n",  Nstars,  Nave,  Nmeas,  Nmatch);
    302302
  • trunk/Ohana/src/addstar/src/find_matches_starpar.c

    r37807 r38441  
    205205  catalog[0].Naverage  = Nave;
    206206  catalog[0].Nstarpar  = Nstarpar;
    207   catalog[0].Nsecf_mem = Nave*Nsecfilt;
     207  catalog[0].Nsecfilt_mem = Nave*Nsecfilt;
    208208  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nstarpar: %d "OFF_T_FMT" "OFF_T_FMT" ("OFF_T_FMT" matches)\n",  Nstars, Nave, Nstarpar, Nmatch);
    209209
  • trunk/Ohana/src/addstar/src/findskycell.c

    r37116 r38441  
    173173  snprintf (imagefile, DVO_MAX_PATH, "%s/Images.dat", catdir);
    174174
     175  gfits_db_init (&db);
    175176  status = dvo_image_lock (&db, imagefile, 2.0, LCK_XCLD);
    176177  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
    … …  
    183184  // convert database table to internal structure (binary to Image)
    184185  // 'image' points to the same memory as db->ftable->buffer
    185   image = gfits_table_get_Image (&db.ftable, &Nimage, &db.swapped);
     186  image = gfits_table_get_Image (&db.ftable, &Nimage, &db.scaledValue, &db.nativeOrder);
    186187  if (!image) {
    187188      fprintf (stderr, "ERROR: failed to read images\n");
    … …  
    557558  snprintf (imagefile, DVO_MAX_PATH, "%s/Images.dat", catdir);
    558559
     560  gfits_db_init (&db);
    559561  status = dvo_image_lock (&db, imagefile, 2.0, LCK_XCLD);
    560562  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
    … …  
    567569  // convert database table to internal structure (binary to Image)
    568570  // 'image' points to the same memory as db->ftable->buffer
    569   image = gfits_table_get_Image (&db.ftable, &Nimage, &db.swapped);
     571  image = gfits_table_get_Image (&db.ftable, &Nimage, &db.scaledValue, &db.nativeOrder);
    570572  if (!image) {
    571573    fprintf (stderr, "ERROR: failed to read images\n");
  • trunk/Ohana/src/addstar/src/load2mass_as_rawdata.c

    r34088 r38441  
    181181        catalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
    182182        catalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
    183         catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
     183        catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
    184184        catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
    185185
  • trunk/Ohana/src/addstar/src/load2mass_catalog.c

    r37036 r38441  
    5656  catalog[0].Naverage = Nave;
    5757  catalog[0].Nmeasure = Nmeas;
    58   catalog[0].Nsecf_mem = Nave*Nsec;
     58  catalog[0].Nsecfilt_mem = Nave*Nsec;
    5959  return (TRUE);
    6060}
  • trunk/Ohana/src/addstar/src/loadICRF_catalog.c

    r37807 r38441  
    1010  catalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
    1111  catalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
    12   catalog.catflags = LOAD_AVES | LOAD_SECF | LOAD_MEAS;
     12  catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT | DVO_LOAD_MEASURE;
    1313  catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
    1414   
  • trunk/Ohana/src/addstar/src/loadICRF_save_remote.c

    r37807 r38441  
    22# include "loadICRF.h"
    33# define DEBUG 1
    4 
    5 int strextend (char *input, char *format,...) {
    6 
    7   char tmpextra[1024], tmpline[1024];
    8   va_list argp;
    9 
    10   va_start (argp, format);
    11   vsnprintf (tmpextra, 1024, format, argp);
    12   snprintf (tmpline, 1024, "%s %s", input, tmpextra);
    13   strcpy (input, tmpline);
    14 
    15   return TRUE;
    16 }
    174
    185int loadICRF_save_remote (ICRF_Stars *stars, int Nstars, HostTable *hosts, SkyRegion *region, char *fullname, AddstarClientOptions *options) {
    … …  
    6451
    6552    // need to generate the remote command
    66     char command[1024];
    67     snprintf (command, 1024, "loadICRF_client");
    68     strextend (command, "-hostID %d", host->hostID);
    69     strextend (command, "-D CATDIR %s", CATDIR);
    70     strextend (command, "-hostdir %s", host->pathname);
    71     strextend (command, "-cpt %s", region->name);
    72     strextend (command, "-input %s", filename);
    73     strextend (command, "-D ADDSTAR_RADIUS %f", options->radius);
     53    char *command = NULL;
     54    strextend (&command, "loadICRF_client");
     55    strextend (&command, "-hostID %d", host->hostID);
     56    strextend (&command, "-D CATDIR %s", CATDIR);
     57    strextend (&command, "-hostdir %s", host->pathname);
     58    strextend (&command, "-cpt %s", region->name);
     59    strextend (&command, "-input %s", filename);
     60    strextend (&command, "-D ADDSTAR_RADIUS %f", options->radius);
    7461
    7562    fprintf (stderr, "command: %s\n", command);
  • trunk/Ohana/src/addstar/src/loadICRF_table.c

    r37807 r38441  
    11# include "addstar.h"
    22# include "loadICRF.h"
    3 
    4 # define GET_COLUMN(OUT,NAME,TYPE) \
    5   TYPE *OUT = gfits_get_bintable_column_data (&theader, &ftable, NAME, type, &Nrow, &Ncol); \
    6   myAssert (!strcmp(type, #TYPE), "wrong column type");
    73
    84int loadICRF_table (SkyList *skylistInput, HostTable *hosts, char *filename, AddstarClientOptions *options) {
  • trunk/Ohana/src/addstar/src/loadstarpar_catalog.c

    r37807 r38441  
    1010  catalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
    1111  catalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
    12   catalog.catflags = LOAD_AVES | LOAD_SECF | LOAD_STARPAR;
     12  catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT | DVO_LOAD_STARPAR;
    1313  catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
    1414   
  • trunk/Ohana/src/addstar/src/loadstarpar_save_remote.c

    r37807 r38441  
    22# include "loadstarpar.h"
    33# define DEBUG 1
    4 
    5 int strextend (char *input, char *format,...) {
    6 
    7   char tmpextra[1024], tmpline[1024];
    8   va_list argp;
    9 
    10   va_start (argp, format);
    11   vsnprintf (tmpextra, 1024, format, argp);
    12   snprintf (tmpline, 1024, "%s %s", input, tmpextra);
    13   strcpy (input, tmpline);
    14 
    15   return TRUE;
    16 }
    174
    185int loadstarpar_save_remote (StarPar_Stars *stars, int Nstars, HostTable *hosts, SkyRegion *region, char *fullname, AddstarClientOptions *options) {
    … …  
    6249
    6350    // need to generate the remote command
    64     char command[1024];
    65     snprintf (command, 1024, "loadstarpar_client");
    66     strextend (command, "-hostID %d", host->hostID);
    67     strextend (command, "-D CATDIR %s", CATDIR);
    68     strextend (command, "-hostdir %s", host->pathname);
    69     strextend (command, "-cpt %s", region->name);
    70     strextend (command, "-input %s", filename);
     51    char *command = NULL;
     52    strextend (&command, "loadstarpar_client");
     53    strextend (&command, "-hostID %d", host->hostID);
     54    strextend (&command, "-D CATDIR %s", CATDIR);
     55    strextend (&command, "-hostdir %s", host->pathname);
     56    strextend (&command, "-cpt %s", region->name);
     57    strextend (&command, "-input %s", filename);
    7158
    7259    // launch the job on the remote machine (no handshake)
    … …  
    7865    }
    7966    host->pid = pid; // save for future reference
     67    free (command);
    8068   
    8169    save_remote_host (host);
  • trunk/Ohana/src/addstar/src/loadstarpar_table.c

    r37807 r38441  
    11# include "addstar.h"
    22# include "loadstarpar.h"
    3 
    4 # define GET_COLUMN(OUT,NAME,TYPE) \
    5   TYPE *OUT = gfits_get_bintable_column_data (&theader, &ftable, NAME, type, &Nrow, &Ncol); \
    6   myAssert (!strcmp(type, #TYPE), "wrong column type");
    73
    84int loadstarpar_table (SkyList *skylistInput, HostTable *hosts, char *filename, AddstarClientOptions *options) {
  • trunk/Ohana/src/addstar/src/loadsupercos.c

    r33653 r38441  
    4747
    4848  // attempt to open the existing images table.  if it does not exist, we will save the loaded images
     49  gfits_db_init (&db);
    4950  db.mode   = dvo_catalog_catmode (CATMODE);
    5051  db.format = dvo_catalog_catformat (CATFORMAT);
  • trunk/Ohana/src/addstar/src/loadsupercos_rawdata.c

    r33653 r38441  
    168168        catalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
    169169        catalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
    170         catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
     170        catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
    171171        catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
    172172
  • trunk/Ohana/src/addstar/src/loadwise_prelim_rawdata.c

    r33653 r38441  
    186186        catalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
    187187        catalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
    188         catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
     188        catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
    189189        catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
    190190
  • trunk/Ohana/src/addstar/src/loadwise_rawdata.c

    r38062 r38441  
    198198        catalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
    199199        catalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
    200         catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
     200        catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
    201201        catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
    202202
  • trunk/Ohana/src/addstar/src/mkcmf.c

    r37995 r38441  
    500500  }
    501501
    502   gfits_table_set_PS1_DEV_0 (ftable, stars, Nstars);
     502  gfits_table_set_PS1_DEV_0 (ftable, stars, Nstars, TRUE);
    503503  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_DEV_0");
    504504}
    … …  
    547547  }
    548548
    549   gfits_table_set_PS1_DEV_1 (ftable, stars, Nstars);
     549  gfits_table_set_PS1_DEV_1 (ftable, stars, Nstars, TRUE);
    550550  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_DEV_1");
    551551}
    … …  
    596596  }
    597597
    598   gfits_table_set_CMF_PS1_V1 (ftable, stars, Nstars);
     598  gfits_table_set_CMF_PS1_V1 (ftable, stars, Nstars, TRUE);
    599599  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_V1");
    600600}
    … …  
    651651  }
    652652
    653   gfits_table_set_CMF_PS1_V2 (ftable, stars, Nstars);
     653  gfits_table_set_CMF_PS1_V2 (ftable, stars, Nstars, TRUE);
    654654  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_V2");
    655655}
    … …  
    710710  }
    711711
    712   gfits_table_set_CMF_PS1_V3 (ftable, stars, Nstars);
     712  gfits_table_set_CMF_PS1_V3 (ftable, stars, Nstars, TRUE);
    713713  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_V3");
    714714}
    … …  
    778778  }
    779779
    780   gfits_table_set_CMF_PS1_V4 (ftable, stars, Nstars);
     780  gfits_table_set_CMF_PS1_V4 (ftable, stars, Nstars, TRUE);
    781781  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_V4");
    782782}
  • trunk/Ohana/src/addstar/src/resort_catalogs.c

    r37116 r38441  
    7474    table->hosts[i].pathname = tmppath;
    7575
    76     char command[1024];
    77     snprintf (command, 1024, "addstar_client -resort");
    78     strextend (command, "-D CATDIR %s", CATDIR);
    79     strextend (command, "-hostID %d", table->hosts[i].hostID);
    80     strextend (command, "-hostdir %s", table->hosts[i].pathname);
    81     strextend (command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
     76    char *command = NULL;
     77    strextend (&command, "addstar_client -resort");
     78    strextend (&command, "-D CATDIR %s", CATDIR);
     79    strextend (&command, "-hostID %d", table->hosts[i].hostID);
     80    strextend (&command, "-hostdir %s", table->hosts[i].pathname);
     81    strextend (&command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
    8282
    83     if (VERBOSE)                   strextend (command, "%s -v");
    84     if (NTHREADS)                  strextend (command, "%s -threads %d", NTHREADS);
    85     if (OLD_RESORT)                strextend (command, "%s -old-resort");
    86     if (options->nosort == 3)      strextend (command, "%s -force-sort");
    87     if (options->existing_regions) strextend (command, "%s -existing-regions");
     83    if (VERBOSE)                   strextend (&command, "-v");
     84    if (NTHREADS)                  strextend (&command, "-threads %d", NTHREADS);
     85    if (OLD_RESORT)                strextend (&command, "-old-resort");
     86    if (options->nosort == 3)      strextend (&command, "-force-sort");
     87    if (options->existing_regions) strextend (&command, "-existing-regions");
    8888
    8989    fprintf (stderr, "command: %s\n", command);
  • trunk/Ohana/src/addstar/src/resort_threaded.c

    r37116 r38441  
    4343
    4444    // set the parameters which guide catalog open/load/create
    45     catalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
    46     catalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
    47     catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_LENSING;
    48     catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
     45    catalog.catformat   = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
     46    catalog.catmode     = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
     47    catalog.catcompress = dvo_catalog_catcompress (CATCOMPRESS); // set the default catcompress from config data
     48    catalog.catflags    = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_LENSING;
     49    catalog.Nsecfilt    = GetPhotcodeNsecfilt ();
    4950 
    5051    // an error exit status here is a significant error (disk I/O or file access)
    … …  
    5758    }
    5859
    59     // Naves_disk == 0 implies an empty catalog file, skip empty catalogs
    60     if (catalog.Naves_disk == 0) {
     60    // Naverage_disk == 0 implies an empty catalog file, skip empty catalogs
     61    if (catalog.Naverage_disk == 0) {
    6162      dvo_catalog_unlock (&catalog);
    6263      dvo_catalog_free (&catalog);
  • trunk/Ohana/src/addstar/src/resort_unthreaded.c

    r37116 r38441  
    2121
    2222    // set the parameters which guide catalog open/load/create
    23     catalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
    24     catalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
    25     catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_LENSING;
    26     catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
     23    catalog.catformat   = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
     24    catalog.catmode     = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
     25    catalog.catcompress = dvo_catalog_catcompress (CATCOMPRESS); // set the default catcompress from config data
     26    catalog.catflags    = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_LENSING;
     27    catalog.Nsecfilt    = GetPhotcodeNsecfilt ();
    2728
    2829    // an error exit status here is a significant error (disk I/O or file access)
    … …  
    3233    }
    3334
    34     // Naves_disk == 0 implies an empty catalog file, skip empty catalogs
    35     if (catalog.Naves_disk == 0) {
     35    // Naverage_disk == 0 implies an empty catalog file, skip empty catalogs
     36    if (catalog.Naverage_disk == 0) {
    3637      dvo_catalog_unlock (&catalog);
    3738      dvo_catalog_free (&catalog);
  • trunk/Ohana/src/addstar/src/sedstar.c

    r25757 r38441  
    2626  for (i = 0; i < skylist[0].Nregions; i++) {
    2727    incatalog.filename = skylist[0].filename[i];
    28     incatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;
     28    incatalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT;
    2929
    3030    // an error exit status here is a significant error
    … …  
    3434    }
    3535
    36     // Naves_disk == 0 implies an empty catalog file
    37     if ((incatalog.Naves_disk == 0) && options.only_match) {
     36    // Naverage_disk == 0 implies an empty catalog file
     37    if ((incatalog.Naverage_disk == 0) && options.only_match) {
    3838      if (VERBOSE) fprintf (stderr, "skipping empty region\n");
    3939      dvo_catalog_unlock (&incatalog);
    … …  
    5454    outcatalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
    5555    outcatalog.Nsecfilt  = GetPhotcodeNsecfilt ();
    56     outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
     56    outcatalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
    5757
    5858    // an error exit status here is a significant error
  • trunk/Ohana/src/addstar/src/skycells.c

    r21048 r38441  
    1212  /*** update the image table ***/
    1313  /* setup image table format and lock */
     14  gfits_db_init (&db);
    1415  db.mode   = dvo_catalog_catmode (CATMODE);
    1516  db.format = dvo_catalog_catformat (CATFORMAT);
  • trunk/Ohana/src/addstar/src/skycells_to_mdc.c

    r33720 r38441  
    55    // Convert FITS_DB to images structure
    66    off_t NdbImages;
    7     Image *dbImages = gfits_table_get_Image(&db->ftable, &NdbImages, &db->swapped);
     7    Image *dbImages = gfits_table_get_Image(&db->ftable, &NdbImages, &db->scaledValue, &db->nativeOrder);
    88
    99    // If tess_id was not supplied assume that it is the basename of the CATDIR
  • trunk/Ohana/src/addstar/test

  • trunk/Ohana/src/addstar/test/relphot.dvo

    r35760 r38441  
    11# -*-sh-*-
     2if (not($?VERBOSE)) set VERBOSE = 0
    23
    34input tap.dvo
    … …  
    4142  end
    4243
    43   echo relphot -D CATDIR catdir.test r -region {$RA-1.0} {$RA+1.0} {$DEC-1.0} {$DEC+1.0} -update -nloop 10.0
    44   exec relphot -D CATDIR catdir.test r -region {$RA-1.0} {$RA+1.0} {$DEC-1.0} {$DEC+1.0} -update -nloop 10.0 >& /dev/null
     44  $output = >& /dev/null
     45  if ($VERBOSE > 2)
     46    $output =
     47  end
     48  $command = relphot -D CATDIR catdir.test -region {$RA-1.0} {$RA+1.0} {$DEC-1.0} {$DEC+1.0} -update -nloop 10.0 -images r
     49  echo $command
     50  exec $command $output
    4551
    4652  catdir catdir.test
  • trunk/Ohana/src/addstar/test/relphot.flatcorr.dvo

    r33653 r38441  
    1414# * no other mechanism to tell DVO about a flat-field correction
    1515
     16$TAP_BREAK = 1
     17$TAP_VERBOSE = 1
    1618input tap.dvo
    1719
    1820# set globals
    19 if (not($?PLOT)) set PLOT = 0
     21if (not($?PLOT)) set PLOT = 0
     22
     23$USE_CELL_OFFSETS = 1; # turn on non-zero cell offsets
     24$SET_UC_RESID = 1; # write a non-zero resid value to the ubercal table (should not have an impact)
     25$DO_2MASS = 1
     26$DO_SYNTH = 1
     27$DO_TYCHO = 1
     28$NC_CLOUDS = 0.08
     29$UC_CLOUDS = 0.02
    2030
    2131# set various global variables
    2232macro init
     33  # generate a fake ptolemy.rc (to make this a contained test)
     34  exec rm -f ptolemy.rc
     35  output ptolemy.rc
     36    echo "\#"
     37    echo PHOTCODE_FILE dvo.photcodes
     38    echo GSCFILE GSCregions.tbl
     39    echo ZERO_PT 25.0
     40    echo ADDSTAR_RADIUS 1.0
     41    echo CATMODE                 SPLIT
     42    echo CATFORMAT               PS1_V5
     43    # echo CATFORMAT               PS1_V2 -- must be at least PS1_V3 for ubercaldist to work
     44    echo SKY_DEPTH               4
     45    echo CAMERA                  gpc1
     46    echo CAMERA_CONFIG           dvo.layout
     47    echo "input dvo.config"
     48  output stdout
     49
     50  # we need to define a photcode table consistent with the fake construction
     51  $zpt_nominal:g = 24.0
     52  $zpt_nominal:r = 24.5
     53
     54  # klam is negative, so klam*(airmass - 1) increases the zero point
     55  $klam_nominal:g = -0.15
     56  $klam_nominal:r = -0.10
     57
     58  # generate a fake dvo.photcode
     59  exec rm -f dvo.photcodes
     60  output dvo.photcodes
     61    echo "\# code  name                type    zero  slope offset c1    c2   slope   zero  equiv  sys scale   scale  sys     poor   bad     poor   bad"
     62    echo "1     g                    sec   0.000  0.000 0.000     1     3 0.0000     0  1051   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000"
     63    echo "2     r                    sec   0.000  0.000 0.000     2     3 0.0000     0  1052   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000"
     64    echo "10000 GPC1.g.XY00          dep  $zpt_nominal:g $klam_nominal:g 0.000     -     - 0.0000     0     1   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88"
     65    echo "10001 GPC1.g.XY01          dep  $zpt_nominal:g $klam_nominal:g 0.000     -     - 0.0000     0     1   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88"
     66    echo "10010 GPC1.g.XY10          dep  $zpt_nominal:g $klam_nominal:g 0.000     -     - 0.0000     0     1   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88"
     67    echo "10011 GPC1.g.XY11          dep  $zpt_nominal:g $klam_nominal:g 0.000     -     - 0.0000     0     1   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88"
     68    echo "10100 GPC1.r.XY00          dep  $zpt_nominal:r $klam_nominal:r 0.000     -     - 0.0000     0     1   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88"
     69    echo "10101 GPC1.r.XY01          dep  $zpt_nominal:r $klam_nominal:r 0.000     -     - 0.0000     0     1   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88"
     70    echo "10110 GPC1.r.XY10          dep  $zpt_nominal:r $klam_nominal:r 0.000     -     - 0.0000     0     1   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88"
     71    echo "10111 GPC1.r.XY11          dep  $zpt_nominal:r $klam_nominal:r 0.000     -     - 0.0000     0     1   0.015 0.000 1.000  0.000   0x0000 0x0000  0xe0440130 0x1003bc88"
     72    echo "2011  2MASS_J              ref   0.000  0.000 0.000     -     - 0.0000     0     6   0.080 0.000 2.000  0.000   0x0000 0x0000  0x0000 0x0000"
     73    echo "3001  SYNTH.g              ref   0.000  0.000 0.000     -     - 0.0000     0     1     nan 0.000 2.000  0.600   0x0000 0x0000  0x0000 0x0000"
     74    echo "2020  TYCHO_B              ref   0.000  0.000 0.000     -     - 0.0000     0     -   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000"
     75  output stdout     
     76
    2377  $RA_CENTER = 10.0
    2478  $DEC_CENTER = 20.0
    … …  
    3286  $CHIP_DX = 1000
    3387  $CHIP_DY = 1000
    34 
    35   # images are loaded into dvo with GPC1 photcodes, so we need to get the nominal zps for those filters
    36   $zpt_nominal:g = 24.58
    37   $zpt_nominal:r = 24.80
    38   $zpt_nominal:i = 24.74
    39   $zpt_nominal:z = 24.26
    40   $zpt_nominal:y = 23.41
    41 
    42   # klam is negative, so klam*(airmass - 1) increase the zero point
    43   $klam_nominal:g = -0.15
    44   $klam_nominal:r = -0.10
    45   $klam_nominal:i = -0.04
    46   $klam_nominal:z = -0.03
    47   $klam_nominal:y = -0.03
     88  $DEFECT_FRAC = 0.05
     89  $OFFSET_FRAC_UC = 0.0
     90  $OFFSET_FRAC_NC = 0.5
    4891
    4992  # we have two sets of images: ubercaled and not-ubercaled
    5093
    51   # sequence to count images (only used in this function)
    52   create tmpseq 0 9
    53 
    54   $filt_uc:n = 9
    55   $filt_uc:0 = g
    56   $filt_uc:1 = g
    57   $filt_uc:2 = g
    58   $filt_uc:3 = r
    59   $filt_uc:4 = r
    60   $filt_uc:5 = r
    61   $filt_uc:6 = i
    62   $filt_uc:7 = i
    63   $filt_uc:8 = i
    64 
    65   # airmass slopes for these sequnece
     94  # the number of exposures is defined by filt_uc:n
     95  list filt_uc -split g g g g r r r r
     96  $filt_uc:n = 4
     97
     98  # tmpseq is used to generate vectors in this function
     99  create tmpseq 0 $filt_uc:n
     100
     101  # exptime and airmasses for uc images
     102  set exptime_uc = 10.0 + zero(tmpseq)
     103  set airmass_uc =  1.3 + zero(tmpseq)
    66104  set klam_uc = zero(tmpseq)
    67   for i 0 tmpseq[]
    68     klam_uc[$i] = $klam_nominal:$filt_uc:$i
    69   end   
    70 
    71   # mjd and zpt values for ubercal'ed imaged
    72   set exptime_uc = 10.0 + zero(tmpseq)
    73   set airmass_uc = 1.3 + zero(tmpseq)
     105  set zpt_uc = zero(tmpseq)
    74106
    75107  # ubercal zero points are defined as ZP_nominal + 2.5log(exptime) + K*(airmass - 1.0)
    76108  # note that K is defined as a negative value (is this sensible?)
    77   set zpt_uc = 25.0 + 2.5*log(exptime_uc) + klam_uc*(airmass_uc - 1.0) + tmpseq*0.0050 - 0.0025
    78 
    79   set mjd_uc = zero(zpt_uc)
    80   mjd_uc[0] = 55000.01
    81   mjd_uc[1] = 55000.02
    82   mjd_uc[2] = 55000.03
    83   mjd_uc[3] = 55015.01
    84   mjd_uc[4] = 55015.02
    85   mjd_uc[5] = 55015.03
    86   mjd_uc[6] = 55025.01
    87   mjd_uc[7] = 55025.02
    88   mjd_uc[8] = 55025.03
     109
     110  # zero points and airmass slopes for these sequnece
     111  for i 0 $filt_uc:n
     112    klam_uc[$i] = $klam_nominal:$filt_uc:$i
     113    zpt_uc[$i]  = $zpt_nominal:$filt_uc:$i + 2.5*log(exptime_uc[$i]) + klam_uc[$i]*(airmass_uc[$i] - 1.0) + $UC_CLOUDS*(rnd(klam_uc[$i]) - 0.5)
     114  end   
     115  set mjd_uc = 55000.00 + 0.01*(tmpseq % 3) + 10.0*int(tmpseq / 3)
    89116
    90117  # mjd and zpt values for not-ubercal'ed images
    91   $filt_nc:n = 9
    92   $filt_nc:0 = g
    93   $filt_nc:1 = g
    94   $filt_nc:2 = g
    95   $filt_nc:3 = r
    96   $filt_nc:4 = r
    97   $filt_nc:5 = r
    98   $filt_nc:6 = i
    99   $filt_nc:7 = i
    100   $filt_nc:8 = i
     118  list filt_nc -split g g g g r r r r
     119  $filt_nc:n = 4
     120
     121  # tmpseq is used to generate vectors in this function
     122  create tmpseq 0 $filt_nc:n
     123
     124  # place this within a valid season (55000.0 - 55010.0 - 55020.0 - 55030.0)
     125  set exptime_nc = 10.0 + zero(tmpseq)
     126  set airmass_nc =  1.6 + zero(tmpseq)
     127  set klam_nc = zero(tmpseq)
     128  set zpt_nc = zero(tmpseq)
    101129
    102130  # airmass slopes for these sequnece
    103   set klam_nc = zero(tmpseq)
    104   for i 0 tmpseq[]
    105     klam_nc[$i] = $klam_nominal:$filt_nc:$i
     131  for i 0 $filt_nc:n
     132    klam_nc[$i] = $klam_nominal:$filt_nc:$i
     133    zpt_nc[$i]  = $zpt_nominal:$filt_nc:$i + 2.5*log(exptime_nc[$i]) + klam_nc[$i]*(airmass_nc[$i] - 1.0) + $NC_CLOUDS*(rnd(klam_nc[$i]) - 0.5)
    106134  end   
    107 
    108   # place this within a valid season (55000.0 - 55010.0 - 55020.0 - 55030.0)
    109   set exptime_nc = 15.0 + zero(tmpseq)
    110   set airmass_nc = 1.6 + zero(tmpseq)
    111 
    112   # ubercal zero points are defined as ZP_nominal + 2.5log(exptime) + K*(airmass - 1.0)
    113   set zpt_nc = 25.0 + 2.5*log(exptime_nc) + klam_nc*(airmass_nc - 1.0) - tmpseq*0.0050 + 0.0025
    114 
    115   set mjd_nc = zero(zpt_nc)
    116   mjd_nc[0] = 55000.11
    117   mjd_nc[1] = 55000.12
    118   mjd_nc[2] = 55000.13
    119   mjd_nc[3] = 55015.11
    120   mjd_nc[4] = 55015.12
    121   mjd_nc[5] = 55015.13
    122   mjd_nc[6] = 55025.11
    123   mjd_nc[7] = 55025.12
    124   mjd_nc[8] = 55025.13
     135  set mjd_nc = 55000.10 + 0.01*(tmpseq % 3) + 10.0*int(tmpseq / 3)
     136
     137  delete tmpseq
    125138end
    126139
    … …  
    139152  mkdir $rootdir
    140153
     154  break -auto off
    141155  exec rm -rf $catdir
     156  exec rm -rf $fileroot*
     157  break -auto on
    142158
    143159  init
    144160  mkzptfile
    145   mkstars 500
     161  mkstars 1000
     162
     163  catdir $catdir
     164
     165  mk2mass $fileroot $catdir
     166  ck2mass addstar
     167 
     168  mksynth $fileroot $catdir
     169  cksynth addstar
     170
     171  # to add a valid tycho test, I need to generate a zpt table for tycho as well
     172  mktycho $fileroot $catdir
     173  cktycho addstar
    146174
    147175  tapPLAN {((mjd_uc[]*4 + mjd_nc[]*4) + (mjd_uc[] + mjd_nc[]) + (mjd_uc[] + mjd_nc[])) / 3}
    … …  
    149177  # generate the basic images and check they were correctly ingested by dvo
    150178  mksequence $fileroot $catdir
    151   for i 0 mjd_uc[] 3
    152     ckexposure catdir.test mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i raw
    153   end
    154   for i 0 mjd_nc[] 3
    155     ckexposure catdir.test mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i raw
     179  for i 0 mjd_uc[]
     180    ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i raw
     181  end
     182  for i 0 mjd_nc[]
     183    ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i raw
    156184  end
    157185
    158186  # run setphot on the db and check that the images now match the expected values
    159   exec setphot -update -ubercal testzpt.fits -D CATDIR $catdir
    160   for i 0 mjd_uc[] 3
    161     ckexposure catdir.test mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i setphot_uc
    162   end
    163   for i 0 mjd_nc[] 3
    164     ckexposure catdir.test mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i setphot_nc
     187  tapEXEC setphot -update -ubercal testzpt.fits -D CATDIR $catdir
     188  for i 0 mjd_uc[]
     189    ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i setphot_uc
     190  end
     191  for i 0 mjd_nc[]
     192    ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i setphot_nc
    165193  end
    166194
    167195  # run relphot on the db and check that the images now match the expected values
    168   exec relphot g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR catdir.test -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal -D IMAGE_OFFSET 0.5 -update >& tmp.log
    169   for i 0 mjd_uc[] 3
    170     ckexposure catdir.test mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot
    171   end
    172   for i 0 mjd_nc[] 3
    173     ckexposure catdir.test mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot
    174   end
     196  tapEXEC relphot -images g,r -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -D IMAGE_OFFSET 0.5 -update -synthphot_zpts $fileroot.synthzpts.fits
     197  for i 0 mjd_uc[]
     198    ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot_uc
     199  end
     200  for i 0 mjd_nc[]
     201    ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc
     202  end
     203  ck2mass relphot
     204  cksynth relphot
     205  cktycho relphot
    175206
    176207  tapDONE
     208end
     209
     210macro try.relphot
     211  if ($0 != 3)
     212    echo "go (fileroot) (catdir)"
     213    break
     214  end
     215
     216  local i fileroot rootdir catdir
     217
     218  $fileroot = $1
     219  $catdir = $2
     220
     221  # run relphot on the db and check that the images now match the expected values
     222  tapEXEC relphot -images g,r -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -D IMAGE_OFFSET 0.5 -update -synthphot_zpts $fileroot.synthzpts.fits -nloop 24
     223
     224  for i 0 mjd_uc[]
     225    # ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot_uc
     226      ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot_uc
     227  end
     228  for i 0 mjd_nc[]
     229    # ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc
     230      ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc
     231  end
    177232end
    178233
    … …  
    215270  $AIRMASS     = $5
    216271  $FILTER      = $6
    217   $MODE        = $7
     272  $FUNC_MODE   = $7
    218273
    219274  # XXX need a function to extract the nominal zpt for a given filter / photcode from the db
    … …  
    235290
    236291  skyregion {$RA_CENTER - 0.2/dcos($DEC_CENTER)} {$RA_CENTER + 0.2/dcos($DEC_CENTER)} {$DEC_CENTER - 0.2} {$DEC_CENTER + 0.2}
    237   mextract ra dec mag xccd yccd where (abs(time - $MJD_IMAGE) < 0.0001)
     292  mextract ra dec mag xccd yccd dbflags photflags where (abs(time - $MJD_IMAGE) < 0.0001)
    238293 
    239294  match2d -closest ra dec stars_ra stars_dec 0.001 -index1 index1 -index2 index2
    … …  
    246301  set dm = mag - stars_mag_m
    247302
     303  set good_photom = (not(photflags & 0x02))
     304  foreach field dm xccd yccd
     305    subset $field\_good = $field if good_photom
     306  end
     307
    248308  if ($PLOT)
    249309    dev -n 1
    250     lim mag dm; clear; box; plot mag dm
    251   end
    252 
    253   set cell_xbin = int(xccd / ($CHIP_DX / $NCELL_X))
    254   set cell_ybin = int(yccd / ($CHIP_DY / $NCELL_Y))
    255   subset dm00 = dm if (cell_xbin == 0) && (cell_ybin == 0)
    256   subset dm01 = dm if (cell_xbin == 0) && (cell_ybin == 1)
    257   subset dm10 = dm if (cell_xbin == 1) && (cell_ybin == 0)
    258   subset dm11 = dm if (cell_xbin == 1) && (cell_ybin == 1)
     310    lim mag dm; clear; box; plot mag dm; plot -c red -pt 7 mag dm where (photflags & 0x00000002)
     311    dev -n 2
     312    lim xccd dm; clear; box; plot xccd dm; plot -c red -pt 7 xccd dm where (photflags & 0x00000002)
     313    dev -n 3
     314    lim ra dm; clear; box; plot ra dm; plot -c red -pt 7 ra dm where (photflags & 0x00000002)
     315    echo "red points are known bad photometry"
     316  end
     317
     318  # reproduce eddie's esoteric padding
     319  set cell_xbin = max(0 , min(1 , int((xccd_good +  8) / ($CHIP_DX / $NCELL_X))))
     320  set cell_ybin = max(0 , min(1 , int((yccd_good + 10) / ($CHIP_DY / $NCELL_Y))))
     321  subset dm00 = dm_good if (cell_xbin == 0) && (cell_ybin == 0)
     322  subset dm01 = dm_good if (cell_xbin == 0) && (cell_ybin == 1)
     323  subset dm10 = dm_good if (cell_xbin == 1) && (cell_ybin == 0)
     324  subset dm11 = dm_good if (cell_xbin == 1) && (cell_ybin == 1)
    259325
    260326  # uncorrected values behave like this:
    … …  
    273339  $ZPT_REAL_NORM = $ZPT_REAL - 2.5*log($EXPTIME) - $KLAM_NOMINAL*($AIRMASS - 1.0)
    274340
    275   if ("$MODE" == "raw")
     341  if ("$FUNC_MODE" == "raw")
    276342    for ix 0 $NCELL_X
    277343      for iy 0 $NCELL_Y
    … …  
    280346 
    281347        set dm_adjust = dm$ix\$iy - $ZPT_NOMINAL + $ZPT_REAL_NORM + cell_off[$ix][$iy]
     348        # echo set dm_adjust = dm$ix\$iy - $ZPT_NOMINAL + $ZPT_REAL_NORM + cell_off[$ix][$iy]
     349
    282350        vstat -q dm_adjust
    283         tapOK {abs($MEAN) < 0.005} "addstar raw ZP $MJD_IMAGE $FILTER"
     351        sprintf line "addstar raw ZP %8.2f $FILTER %6.3f %6.3f %6.3f: %7.4f %7.4f : cell%d%d %6.3f : %3d" $MJD_IMAGE $ZPT_REAL $ZPT_REAL_NORM $ZPT_NOMINAL $MEAN $SIGMA $ix $iy cell_off[$ix][$iy] dm_adjust[]
     352        tapOK {abs($MEAN) < 0.005} "$line"
    284353      end
    285354    end
    … …  
    287356  end
    288357
    289   if ("$MODE" == "setphot_uc")
    290     vstat -q dm
    291     tapOK {abs($MEAN) < 0.005} "setphot_uc  ZP $MJD_IMAGE $FILTER"
     358  if ("$FUNC_MODE" == "setphot_uc")
     359    vstat -q dm_good
     360    sprintf line "setphot_uc  ZP %8.2f $FILTER %6.3f %6.3f %6.3f: %7.4f %7.4f : %3d" $MJD_IMAGE $ZPT_REAL $ZPT_REAL_NORM $ZPT_NOMINAL $MEAN $SIGMA dm_good[]
     361    tapOK {abs($MEAN) < 0.005} "$line"
     362
     363    subset tmp = dm if (dbflags & 0x00008000)
     364    tapOK {tmp[] == dm[]} "ubercal detections have ubercal bit set"
     365
     366    imextract MCAL FLAGS where (abs(time - $MJD_IMAGE) < 0.0001)
     367    subset tmp = FLAGS if (FLAGS & 0x0000200)
     368    tapOK {tmp[] == FLAGS[]} "ubercal images have ubercal bit set"
     369   
    292370    return
    293371  end
    294372
    295   if ("$MODE" == "setphot_nc")
    296     vstat -q dm
    297     tapOK {abs($MEAN - $ZPT_NOMINAL + $ZPT_REAL_NORM) < 0.005} "setphot_nc  ZP $MJD_IMAGE $FILTER"
     373  if ("$FUNC_MODE" == "setphot_nc")
     374    vstat -q dm_good
     375    sprintf line "setphot_nc  ZP %8.2f $FILTER %6.3f %6.3f %6.3f: %7.4f %7.4f : %3d" $MJD_IMAGE $ZPT_REAL $ZPT_REAL_NORM $ZPT_NOMINAL $MEAN $SIGMA dm_good[]
     376    tapOK {abs($MEAN - $ZPT_NOMINAL + $ZPT_REAL_NORM) < 0.005} "$line"
     377
     378    subset tmp = dm if (not(dbflags & 0x00008000))
     379    tapOK {tmp[] == dm[]} "non-ubercal detections do NOT have ubercal bit set"
     380
     381    imextract FLAGS where (abs(time - $MJD_IMAGE) < 0.0001)
     382    subset tmp = FLAGS if (not(FLAGS & 0x0000200))
     383    tapOK {tmp[] == FLAGS[]} "non-ubercal images do NOT have ubercal bit set"
     384   
    298385    return
    299386  end
    300387
    301   if ("$MODE" == "relphot")
    302     vstat -q dm
    303     tapOK {abs($MEAN) < 0.005} "relphot    ZP $MJD_IMAGE $FILTER"
     388  if (("$FUNC_MODE" == "relphot_uc") || ("$FUNC_MODE" == "relphot_nc"))
     389    vstat -q dm_good
     390    sprintf line "relphot     ZP %8.2f $FILTER %6.3f %6.3f %6.3f: %7.4f %7.4f : %3d" $MJD_IMAGE $ZPT_REAL $ZPT_REAL_NORM $ZPT_NOMINAL $MEAN $SIGMA dm_good[]
     391
     392    if ("$FUNC_MODE" == "relphot_uc")
     393      tapOK {abs($MEAN) < 0.001} "$line"
     394      tapOK {abs($SIGMA) < 0.001} "$line"
     395    end
     396    if ("$FUNC_MODE" == "relphot_nc")
     397      # XXX NOTE relaxed condition : bad photometry points are partly clipped but still cause a bias
     398      tapOK {abs($MEAN) < 0.020} "$line"
     399      tapOK {abs($SIGMA) < 0.020} "$line"
     400    end
     401
     402    mextract ra dec mag dbflags
     403    subset rs = ra  if ((dbflags & 0x8000) && (mag > 13.5))
     404    subset ds = dec if ((dbflags & 0x8000) && (mag > 13.5))
     405    avmatch rs ds 0.1 $FILTER\:flags $FILTER\:uc_dist
     406
     407    subset tmp = rs if (($FILTER\:flags & 0x8) || ($FILTER\:flags & 0x4))
     408    tapOK {tmp[] == rs[]} "objects with ubercal detections have ubercal bit set or used SYNTH photometry (tmp[] vs rs[])"
     409 
     410    subset tmp = rs if (($FILTER\:uc_dist < 0.1) || ($FILTER\:flags & 0x4))
     411    tapOK {tmp[] == rs[]} "objects with ubercal detections have ubercal dist of 0.0 or used SYNTH photometry"
    304412    return
    305413  end
     414
     415  echo "ERROR: unknown mode for ckexposure : $FUNC_MODE"
    306416
    307417end
    … …  
    316426
    317427  # we have defined a set of mjd and zero point values for ubercal'ed images
    318   # for i 0 mjd_uc[]
    319   for i 0 mjd_uc[] 3
     428  for i 0 mjd_uc[]
    320429    mkexposure $1.uc.$i $RA_CENTER $DEC_CENTER zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] mjd_uc[$i] $filt_uc:$i $2
    321430  end
    322431
    323432  # we have a second set of mjd and zero point values for non-ubercal'ed images
    324   # for i 0 mjd_nc[]
    325   for i 0 mjd_nc[] 3
     433  for i 0 mjd_nc[]
    326434    mkexposure $1.nc.$i $RA_CENTER $DEC_CENTER zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] mjd_nc[$i] $filt_nc:$i $2
    327435  end
    … …  
    334442 end
    335443
    336  local ix iy date time datetime ra dec ROOT RAo DECo ZPT MJD FILTER EXPTIME AIRMASS CATDIR
     444 local ix iy date time datetime ra dec ROOT RAo DECo ZPT MJD FILTER EXPTIME AIRMASS CATDIR cmd
    337445
    338446 $ROOT    = $1
    … …  
    366474    $options = -mjd $MJD
    367475    $options = $options -radec $ra $dec
    368     $options = $options -type PS1_V2
     476
     477    #$options = $options -type PS1_V2
     478    #$options = $options -type PS1_V3
     479    #$options = $options -type PS1_V4
     480    $options = $options -type PS1_V5
     481
    369482    $options = $options -coords
    370483    $options = $options -photcode GPC1.$FILTER.XY$ix\$iy
    371484    $options = $options -no-noise
     485    $options = $options -flags
     486    $options = $options -bad-psfqf-frac $DEFECT_FRAC
    372487    $options = $options -size $CHIP_DX $CHIP_DY
    373488    $options = $options -crpix {0.5*$CHIP_DX} {0.5*$CHIP_DY}
    374489    $options = $options -airmass $AIRMASS
    375490    $options = $options -exptime $EXPTIME
    376     exec mkcmf test.in.txt $ROOT.$ix.$iy.cmf $options
    377     echo mkcmf test.in.txt $ROOT.$ix.$iy.cmf $options
    378    
     491
     492    tapEXEC mkcmf test.in.txt $ROOT.$ix.$iy.cmf $options
     493
    379494    # the fake images have inconsistent ra,dec and airmass,sidtime values
    380     echo addstar $ROOT.$ix.$iy.cmf -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass
    381     exec addstar $ROOT.$ix.$iy.cmf -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass >& tmp.log
     495    tapEXEC addstar $ROOT.$ix.$iy.cmf -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass
    382496  end
    383497 end
    … …  
    405519  subset stars_mr = stars_mag if valid
    406520
    407   set cell_x = int(stars_x / ($CHIP_DX / $NCELL_X))
    408   set cell_y = int(stars_y / ($CHIP_DX / $NCELL_X))
     521  # note eddie's esoteric padding rule:
     522  set cell_x = max(0 , min(1 , int((stars_x +  8) / ($CHIP_DX / $NCELL_X))))
     523  set cell_y = max(0 , min(1 , int((stars_y + 10) / ($CHIP_DX / $NCELL_X))))
    409524
    410525  # eddie says: M_real = M_inst + zpt + ff_offset
    … …  
    418533  end
    419534
    420   write -f "%10.6f %10.6f %7.3f  %6.1f %6.1f %7.3f" $1 stars_r stars_d stars_mr stars_x stars_y stars_mi
     535  # create bad detections / detections to ignore or avoid, save to a file?
     536
     537  # create 3 types of things to ignore / avoid
     538  # * badPhot (deviate the photometry)
     539  # * badFlag (set a bad flag bit)
     540  # * poorFlag (set a bad flag bit)
     541  set badPhot  = rnd(stars_r) <  $DEFECT_FRAC
     542  set badFlag  = rnd(stars_r) <  $DEFECT_FRAC
     543  set poorFlag = rnd(stars_r) <  $DEFECT_FRAC
     544
     545  # create deviant photometry (1%)
     546  # I'm setting the flag value 0x02 (EXTMODEL) if the object is deviated.  This is a simple way to pass the info
     547  # note that outlier rejection only occurs for Nmeas > 5
     548  set stars_mi = stars_mi + 0.2*badPhot
     549  set stars_fl = zero(stars_mi) + 0x00000080*badFlag + 0x00000100*poorFlag + 0x00000002*badPhot
     550
     551  # bad flags that we sould respect:
     552  # PM_SOURCE_MODE_FAIL             = 0x00000008, ///< Fit (non-linear) failed (non-converge, off-edge, run to zero)
     553  # PM_SOURCE_MODE_SATSTAR          = 0x00000080, ///< Source model peak is above saturation
     554  # PM_SOURCE_MODE_BADPSF           = 0x00000400, ///< Failed to get good estimate of object's PSF
     555  # PM_SOURCE_MODE_DEFECT           = 0x00000800, ///< Source is thought to be a defect
     556  # PM_SOURCE_MODE_SATURATED        = 0x00001000, ///< Source is thought to be saturated pixels (bleed trail)
     557  # PM_SOURCE_MODE_CR_LIMIT         = 0x00002000, ///< Source has crNsigma above limit
     558  # PM_SOURCE_MODE_MOMENTS_FAILURE  = 0x00008000, ///< could not measure the moments
     559  # PM_SOURCE_MODE_SKY_FAILURE      = 0x00010000, ///< could not measure the local sky
     560  # PM_SOURCE_MODE_SKYVAR_FAILURE   = 0x00020000, ///< could not measure the local sky variance
     561  # PM_SOURCE_MODE_SIZE_SKIPPED     = 0x10000000, ///< size could not be determined
     562
     563  # poor flags that we should respect:
     564  # PM_SOURCE_MODE_POOR             = 0x00000010, ///< Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?)
     565  # PM_SOURCE_MODE_PAIR             = 0x00000020, ///< Source fitted with a double psf
     566  # PM_SOURCE_MODE_BLEND            = 0x00000100, ///< Source is a blend with other sources
     567  # PM_SOURCE_MODE_BELOW_MOMENTS_SN = 0x00040000, ///< moments not measured due to low S/N
     568  # PM_SOURCE_MODE_BLEND_FIT        = 0x00400000, ///< source was fitted as a blend
     569  # PM_SOURCE_MODE_ON_SPIKE         = 0x20000000, ///< peak lands on diffraction spike
     570  # PM_SOURCE_MODE_ON_GHOST         = 0x40000000, ///< peak lands on ghost or glint
     571  # PM_SOURCE_MODE_OFF_CHIP         = 0x80000000, ///< peak lands off edge of chip
     572
     573  write -f "%10.6f %10.6f %7.3f  %6.1f %6.1f %7.3f 0x%x" $1 stars_r stars_d stars_mr stars_x stars_y stars_mi stars_fl
    421574end
    422575
    … …  
    439592  set stars_ra  = $RA_CENTER  + $RA_RANGE  * (rnd(tmp) - 0.5) / 3600 / dcos ($DEC_CENTER)
    440593  set stars_dec = $DEC_CENTER + $DEC_RANGE * (rnd(tmp) - 0.5) / 3600
    441   set stars_mag = 15.0 + 4.0 * rnd(tmp)
     594  set stars_mag = 10.0 + 10.0 * rnd(tmp)
     595  set stars_dmag = 0.02 + 0.1*rnd(tmp)
     596end
     597
     598macro mk2mass
     599  if ($0 != 3)
     600    echo "USAGE: mk2mass (fileroot) (catdir)"
     601    break
     602  end
     603
     604  if (not($DO_2MASS)) return
     605
     606  local ROOT CATDIR
     607
     608  $ROOT    = $1
     609  $CATDIR  = $2
     610
     611  set stars_flags = 0x00c00000*(rnd(stars_ra) < 0.1) + 0x7*(rnd(stars_ra) < 0.8)
     612  write $ROOT.2mass.dat -f "%10.6f %10.6f %6.3f %6.3f 0x%x" stars_ra stars_dec stars_mag stars_dmag stars_flags
     613
     614  tapEXEC addstar -ref $ROOT.2mass.dat -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass -photcode 2MASS_J
     615
     616  set r_2mass = stars_ra
     617  set d_2mass = stars_dec
     618  set m_2mass = stars_mag
     619  set dm_2mass = stars_dmag
     620  set fl_2mass = stars_flags
     621end
     622
     623macro ck2mass
     624  if ($0 != 2)
     625    echo "USAGE: ck2mass (stage)"
     626    break
     627  end
     628
     629  if (not($DO_2MASS)) return
     630
     631  if ("$1" == "addstar")
     632    skyregion {$RA_CENTER - 0.2/dcos($DEC_CENTER)} {$RA_CENTER + 0.2/dcos($DEC_CENTER)} {$DEC_CENTER - 0.2} {$DEC_CENTER + 0.2}
     633    mextract ra dec mag xccd yccd dbflags photflags where (photcode == 2011)
     634    tapOK {ra[] == r_2mass[]} "read in as many 2mass stars as we generated"
     635   
     636    match2d -closest ra dec r_2mass d_2mass 0.001 -index1 index1 -index2 index2
     637    subset tmp = index1 if (index1 >= 0)
     638    tapOK {tmp[] == ra[]} "2mass sources match those generated"
     639  end
     640
     641  if ("$1" == "relphot")
     642    subset rs = r_2mass if (fl_2mass & 0x00c00000)
     643    subset ds = d_2mass if (fl_2mass & 0x00c00000)
     644    avmatch rs ds 0.1 flags
     645    subset tmp = rs if (flags & 0x02000000); # extended in 2mass
     646    tapOK {tmp[] == rs[]} "2mass extended objects properly marked"
     647   
     648    subset rs = r_2mass if (fl_2mass & 0x07)
     649    subset ds = d_2mass if (fl_2mass & 0x07)
     650    avmatch rs ds 0.1 flags
     651    subset tmp = rs if (flags & 0x08000000); # extended in 2mass
     652    tapOK {tmp[] == rs[]} "2mass good objects properly marked"
     653  end
     654end
     655
     656macro mksynth
     657  if ($0 != 3)
     658    echo "USAGE: mksynth (fileroot) (catdir)"
     659    break
     660  end
     661
     662  if (not($DO_SYNTH)) return
     663
     664  local ROOT CATDIR
     665
     666  $ROOT    = $1
     667  $CATDIR  = $2
     668 
     669  subset r_synth  = stars_ra    if (stars_mag < 17)
     670  subset d_synth  = stars_dec   if (stars_mag < 17)
     671  subset m_synth  = stars_mag   if (stars_mag < 17)
     672  subset dm_synth = stars_dmag  if (stars_mag < 17)
     673  subset fl_synth = stars_flags if (stars_mag < 17)
     674
     675  write $ROOT.synth.dat -f "%10.6f %10.6f %6.3f %6.3f 0x%x" r_synth d_synth m_synth dm_synth fl_synth
     676
     677  tapEXEC addstar -ref $ROOT.synth.dat -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass -photcode SYNTH.g
     678end
     679
     680macro cksynth
     681  if ($0 != 2)
     682    echo "USAGE: cksynth (stage)"
     683    break
     684  end
     685
     686  if (not($DO_SYNTH)) return
     687
     688  if ("$1" == "addstar")
     689    skyregion {$RA_CENTER - 0.2/dcos($DEC_CENTER)} {$RA_CENTER + 0.2/dcos($DEC_CENTER)} {$DEC_CENTER - 0.2} {$DEC_CENTER + 0.2}
     690    mextract ra dec mag xccd yccd dbflags photflags where (photcode == 3001)
     691    tapOK {ra[] == r_synth[]} "read in as many synth stars as we generated"
     692   
     693    match2d -closest ra dec r_synth d_synth 0.001 -index1 index1 -index2 index2
     694    subset tmp = index1 if (index1 >= 0)
     695    tapOK {tmp[] == ra[]} "synth sources match those generated"
     696  end
     697
     698  if ("$1" == "relphot")
     699    subset rs = r_synth if (m_synth < 13.5)
     700    subset ds = d_synth if (m_synth < 13.5)
     701    avmatch rs ds 0.1 g:flags
     702    subset tmp = rs if (g:flags & 0x04); # synth used for photometry
     703    tapOK {tmp[] == rs[]} "synth objects used for photometry properly marked"
     704  end
     705end
     706
     707macro mktycho
     708  if ($0 != 3)
     709    echo "USAGE: mktycho (fileroot) (catdir)"
     710    break
     711  end
     712
     713  if (not($DO_TYCHO)) return
     714
     715  local ROOT CATDIR
     716
     717  $ROOT    = $1
     718  $CATDIR  = $2
     719
     720  subset r_tycho  = stars_ra    if (stars_mag < 12)
     721  subset d_tycho  = stars_dec   if (stars_mag < 12)
     722  subset m_tycho  = stars_mag   if (stars_mag < 12)
     723  subset dm_tycho = stars_dmag  if (stars_mag < 12)
     724  subset fl_tycho = stars_flags if (stars_mag < 12)
     725
     726  write $ROOT.tycho.dat -f "%10.6f %10.6f %6.3f %6.3f 0x%x" r_tycho d_tycho m_tycho dm_tycho fl_tycho
     727
     728  tapEXEC addstar -ref $ROOT.tycho.dat -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass -photcode TYCHO_B
     729
     730  $KAPA = kapa -noX
     731  dev -n tmpdev
     732  # resize 100 100
     733  resize 50 50
     734  region $RA_CENTER $DEC_CENTER 0.2
     735  section default -imtool none
     736  # causes trouble for this to come before region...
     737  create tmp 0 1
     738  cdensify tmpmap tmp tmp
     739  set map = zero(tmpmap) + 0.2
     740  close
     741  $KAPA = kapa
     742
     743  local filter 
     744  foreach filter g r i z y
     745    if ("$filter" == "g")
     746      wd map $ROOT.synthzpts.fits -bitpix -32 -bzero 0.0 -bscale 1.0
     747    end
     748    keyword map EXTNAME -w "map_$filter"
     749    wd map $ROOT.synthzpts.fits -bitpix -32 -bzero 0.0 -bscale 1.0 -extend
     750  end
     751end
     752
     753macro cktycho
     754  if ($0 != 2)
     755    echo "USAGE: cktycho (stage)"
     756    break
     757  end
     758
     759  if (not($DO_TYCHO)) return
     760
     761  if ("$1" == "addstar")
     762    skyregion {$RA_CENTER - 0.2/dcos($DEC_CENTER)} {$RA_CENTER + 0.2/dcos($DEC_CENTER)} {$DEC_CENTER - 0.2} {$DEC_CENTER + 0.2}
     763    mextract ra dec mag xccd yccd dbflags photflags where (photcode == 2020)
     764    tapOK {ra[] == r_tycho[]} "read in as many tycho stars as we generated"
     765   
     766    match2d -closest ra dec r_tycho d_tycho 0.001 -index1 index1 -index2 index2
     767    subset tmp = index1 if (index1 >= 0)
     768    tapOK {tmp[] == ra[]} "tycho sources match those generated"
     769  end
     770
     771  if ("$1" == "relphot")
     772    subset rst = r_tycho if (m_tycho < 12)
     773    subset dst = d_tycho if (m_tycho < 12)
     774    # XXX : should not restrict to 'g'
     775    avmatch rst dst 0.1 g:flags
     776    subset tmp = rst if (g:flags & 0x40); # tycho used for photometry
     777    tapOK {tmp[] == rst[]} "tycho objects used for photometry properly marked"
     778
     779    # non-tycho stars with synth phot should be repaired
     780    subset rsn = r_synth if (m_synth > 12) && (m_synth < 13.5)
     781    subset dsn = d_synth if (m_synth > 12) && (m_synth < 13.5)
     782    # XXX : should not restrict to 'g'
     783    avmatch rsn dsn 0.1 g:flags
     784    subset tmp = rsn if (g:flags & 0x80); # synth photometry repaired
     785    tapOK {tmp[] == rsn[]} "tycho objects used for photometry properly marked"
     786  end
    442787end
    443788
    … …  
    456801
    457802  # define the season boundaries
    458   keyword phu TS0_0000 -wf 55000.0
    459   keyword phu TS1_0000 -wf 55010.0
    460   keyword phu TS0_0001 -wf 55010.0
    461   keyword phu TS1_0001 -wf 55020.0
    462   keyword phu TS0_0002 -wf 55020.0
    463   keyword phu TS1_0002 -wf 55030.0
     803  keyword phu S0_MJD0 -wf 55000.0
     804  keyword phu S1_MJD0 -wf 55010.0
     805  keyword phu S0_MJD1 -wf 55010.0
     806  keyword phu S1_MJD1 -wf 55020.0
     807  keyword phu S0_MJD2 -wf 55020.0
     808  keyword phu S1_MJD2 -wf 55030.0
    464809
    465810  # create a single flat-field correction map for a single chip
    466811  mcreate cell_off 2 2
    467   cell_off[0][0] =  0.01
    468   cell_off[1][0] = -0.01
    469   cell_off[0][1] =  0.02
    470   cell_off[1][1] = -0.02
     812  if ($USE_CELL_OFFSETS)
     813    cell_off[0][0] =  0.05
     814    cell_off[1][0] = -0.03
     815    cell_off[0][1] =  0.08
     816    cell_off[1][1] = -0.10
     817  end
    471818
    472819  # in the correction table, we have an image of the full exposure
    … …  
    481828    for iyc 0 $NCELL_Y
    482829      for ix 0 $NCHIP_X
     830        set tcell_off = cell_off
     831        if ($ix < 4)
     832          rotate tcell_off 180
     833        end
    483834        for ixc 0 $NCELL_X
    484           concat cell_off[$ixc][$iyc] image_offset
     835          concat tcell_off[$ixc][$iyc] image_offset
    485836        end
    486837      end
    … …  
    498849  set mjd_obs = mjd_uc
    499850  set zp = zpt_uc
    500   set resid = 0.02*rnd(zpt_uc) - 0.01
     851
     852  if ($SET_UC_RESID)
     853    set resid = 0.02*rnd(zpt_uc) - 0.01
     854  else
     855    set resid = zero(zpt_uc)
     856  end
    501857
    502858  delete -q flatcorr
  • trunk/Ohana/src/addstar/test/simple.dvo

    r37036 r38441  
    1010  test.fields PS1_V2    PS1_V1
    1111  test.fields PS1_V3    PS1_V1
    12   test.fields PS1_V4    PS1_V1
     12  test.fields PS1_V5    PS1_V1
    1313
    1414  test.fields PS1_DEV_0 PS1_V2
    … …  
    1717  test.fields PS1_V2    PS1_V2
    1818  test.fields PS1_V3    PS1_V2
    19   test.fields PS1_V4    PS1_V4
     19  test.fields PS1_V5    PS1_V2
    2020
    2121  test.fields PS1_DEV_0 PS1_V3
    … …  
    2424  test.fields PS1_V2    PS1_V3
    2525  test.fields PS1_V3    PS1_V3
    26   test.fields PS1_V4    PS1_V4
     26  test.fields PS1_V5    PS1_V3
    2727
    2828  test.fields PS1_DEV_0 PS1_V4
    … …  
    3131  test.fields PS1_V2    PS1_V4
    3232  test.fields PS1_V3    PS1_V4
    33   test.fields PS1_V4    PS1_V4
     33  test.fields PS1_V5    PS1_V4
    3434end 
    3535
    … …  
    5454
    5555  mkinput
    56   echo mkcmf test.in.txt test.cmf -date 2008/1/1 -time 01:00:00 -radec $RA $DEC -type $1 $NO_NOISE
    57   exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 01:00:00 -radec $RA $DEC -type $1 $NO_NOISE
    58   if ($TAP_VERBOSE)
    59     echo exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass
    60     exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass
    61   else
    62     echo addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass
    63     exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass >& tmp.log
    64   end
     56  tapEXEC mkcmf test.in.txt test.cmf -date 2008/1/1 -time 01:00:00 -radec $RA $DEC -type $1 $NO_NOISE
     57  tapEXEC addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass
    6558
    6659  list testfields -copy testfields_$1
    … …  
    7972    if ("$name:0" == "SKIP") continue
    8073    if ("$name:2" == "SKIP") continue
     74 
    8175    read -fits Chip.psf $name:0
    8276    mextract $name:2
    … …  
    9286  set d = $name:0 - $name:2
    9387  vstat -q d
    94   tapOK {abs($MEAN)  < 0.001} "$name:0 vs $name:2 (MEAN)"
    95   tapOK {abs($SIGMA) < 0.001} "$name:0 vs $name:2 (SIGMA)"
     88  tapOK {abs($MEAN)  < 0.001} "$name:0 vs $name:2 (MEAN = $MEAN)"
     89  tapOK {abs($SIGMA) < 0.001} "$name:0 vs $name:2 (SIGMA = $SIGMA)"
    9690
    9791  # detection ID must be first for this to work:
    … …  
    142136    if ("$name:0" == "PSF_THETA")
    143137      # echo $MEAN
    144       tapOK {abs($MEAN)  < 0.006} "$name:0 vs $name:2 (MEAN)"
    145       tapOK {abs($SIGMA) < 0.001} "$name:0 vs $name:2 (SIGMA)"
     138      tapOK {abs($MEAN)  < 0.006} "$name:0 vs $name:2 (MEAN = $MEAN)"
     139      tapOK {abs($SIGMA) < 0.001} "$name:0 vs $name:2 (SIGMA = $SIGMA)"
    146140      continue
    147141    end
    148142
    149     tapOK {abs($MEAN)  < 0.001} "$name:0 vs $name:2 (MEAN)"
    150     tapOK {abs($SIGMA) < 0.001} "$name:0 vs $name:2 (SIGMA)"
     143    tapOK {abs($MEAN)  < 0.001} "$name:0 vs $name:2 (MEAN = $MEAN)"
     144    tapOK {abs($SIGMA) < 0.001} "$name:0 vs $name:2 (SIGMA = $MEAN)"
    151145  end   
    152146
    … …  
    231225  PSF_INST_MAG      : mag:inst 
    232226  PSF_INST_MAG_SIG  : mag:err   
    233   AP_MAG_STANDARD   : mag:ap # FAIL
     227# AP_MAG_STANDARD   : mag:ap # FAIL
    234228  AP_MAG_RADIUS     : SKIP # no accessor
    235229  PEAK_FLUX_AS_MAG  : SKIP # no accessor
    … …  
    237231  CAL_PSF_MAG_SIG   : SKIP # photometry is not calibrated in the cmf
    238232  SKY               : sky       
    239   SKY_SIG           : sky_err   
     233  SKY_SIGMA         : sky_err   
    240234  PSF_CHISQ         : psf_chisq
    241235  CR_NSIGMA         : cr_nsigma
    … …  
    267261  PSF_INST_MAG      : mag:inst 
    268262  PSF_INST_MAG_SIG  : mag:err   
    269   AP_MAG_STANDARD   : mag:ap # FAIL
     263# AP_MAG_STANDARD   : mag:ap # FAIL
    270264  AP_MAG_RADIUS     : SKIP # no accessor
    271265  PEAK_FLUX_AS_MAG  : SKIP # no accessor
    … …  
    273267  CAL_PSF_MAG_SIG   : SKIP # photometry is not calibrated in the cmf
    274268  SKY               : sky       
    275   SKY_SIG           : sky_err   
     269  SKY_SIGMA         : sky_err   
    276270  PSF_CHISQ         : psf_chisq
    277271  CR_NSIGMA         : cr_nsigma
    … …  
    303297  PSF_INST_FLUX     : SKIP # not ingested into DVO
    304298  PSF_INST_FLUX_SIG : SKIP # not ingested into DVO
    305   AP_MAG_STANDARD   : mag:aperinst # FAIL
     299# AP_MAG_STANDARD   : mag:aperinst # FAIL
    306300  AP_MAG_RAW        : SKIP # not ingested into DVO
    307301  AP_MAG_RADIUS     : SKIP # not ingested into DVO
    … …  
    312306  PEAK_FLUX_AS_MAG  : SKIP # not ingested into DVO
    313307  SKY               : sky       
    314   SKY_SIG           : sky_err   
     308  SKY_SIGMA         : sky_err   
    315309  PSF_CHISQ         : psf_chisq
    316310  CR_NSIGMA         : cr_nsigma
    … …  
    332326  MOMENTS_R1        : SKIP # not ingested into DVO
    333327  MOMENTS_RH        : SKIP # not ingested into DVO
    334   KRON_FLUX         : mag:kroninst
    335   KRON_FLUX_ERR     : mag:kronerr
     328  KRON_FLUX         : mag:kron:inst
     329  KRON_FLUX_ERR     : mag:kron:err
    336330  KRON_FLUX_INNER   : SKIP # not ingested into DVO
    337331  KRON_FLUX_OUTER   : SKIP # not ingested into DVO
  • trunk/Ohana/src/addstar/test/tap.dvo

    r34405 r38441  
    33if (not($?TAP_BREAK)) set TAP_BREAK = 0
    44if (not($?TAP_VERBOSE)) set TAP_VERBOSE = 0
     5
     6macro tapEXEC
     7  if ($0 < 3)
     8    echo "USAGE: tapEXEC (command)"
     9    break
     10  end
     11
     12  local i cmd result
     13
     14  $cmd = ""
     15  for i 1 $0
     16    $cmd = $cmd $$i
     17  end
     18
     19  if ($TAP_VERBOSE >= 2) echo $cmd
     20
     21  break -auto off
     22  exec $cmd >& tap.log
     23  $result = $STATUS
     24  break -auto on
     25
     26  if (not($result))
     27    exec cat tap.log
     28    echo "not ok : $cmd"
     29    $TAP_NFAIL ++
     30    $TAP_LAST = 0
     31    if ($TAP_BREAK)
     32     break
     33    end
     34  else
     35    if ($TAP_VERBOSE >= 1) echo "ok : $cmd"
     36    $TAP_LAST = 1
     37  end
     38  $TAP_NDONE ++
     39end
    540
    641macro tapOK
    … …  
    1146
    1247  if ($1)
    13     if ($TAP_VERBOSE)
     48    if ($TAP_VERBOSE >= 1)
    1449      echo "ok : $2"
    1550    end
Note: See TracChangeset for help on using the changeset viewer.