IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 17, 2012, 11:14:15 AM (14 years ago)
Author:
eugene
Message:

force synthetic photometry for bright (saturated) objects; write out log points for client

Location:
branches/eam_branches/ipp-20120405/Ohana/src/relphot
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120405/Ohana/src/relphot/include/relphot.h

    r33886 r33887  
    336336int ImageSubsetSave(char *filename, ImageSubset *image, off_t Nimage);
    337337ImageSubset *ImageSubsetLoad(char *filename, off_t *nimage);
     338
     339int client_logger_init ();
     340int client_logger_message (char *format,...);
     341
  • branches/eam_branches/ipp-20120405/Ohana/src/relphot/src/StarOps.c

    r33886 r33887  
    354354      int Next = 0;
    355355      int haveSynth = FALSE;
     356
     357      int forceSynth = FALSE;
     358      int forceSynthEntry = -1;
     359
    356360      int haveUbercal = FALSE;
    357361
     
    425429            }
    426430          }
    427           // ignore SYNTH photocdes until PASS == 4 (where we also accept saturated stars)
     431
     432          // Blindly accepth the SYNTH mags if we are above saturation, otherwise,
     433          // ignore SYNTH photcodes until PASS == 4 (where we also accept saturated stars)
    428434          if ((catalog[Nc].measure[m].photcode >= 3001) && (catalog[Nc].measure[m].photcode <= 3005)) {
    429             if (pass < 4) {
    430               SKIP_THIS_MEAS(Nbad);
    431               continue;
     435            // something of a hack: force object to use synth values if synth mags >>
     436            // saturation (3pi instrumental mags < -15)
     437            float MaxMagForceSynth = NAN;
     438            switch (catalog[Nc].measure[m].photcode) {
     439              case 3001:
     440                MaxMagForceSynth = 13.64;
     441                break;
     442              case 3002:
     443                MaxMagForceSynth = 13.76;
     444                break;
     445              case 3003:
     446                MaxMagForceSynth = 13.74;
     447                break;
     448              case 3004:
     449                MaxMagForceSynth = 12.94;
     450                break;
     451              case 3005:
     452                MaxMagForceSynth = 12.01;
     453                break;
    432454            }
    433             haveSynth = TRUE;
     455            if (catalog[Nc].measureT[m].M < MaxMagForceSynth) {
     456              forceSynth = TRUE;
     457              forceSynthEntry = N;
     458            } else {
     459              if (pass < 4) {
     460                SKIP_THIS_MEAS(Nbad);
     461                continue;
     462              }
     463              haveSynth = TRUE;
     464            }
    434465          }
    435466        }
     
    476507      }
    477508
     509      if (forceSynth) {
     510        // use the single SYNTH value instead of the other mags here
     511        myAssert ((forceSynthEntry < N) && (forceSynthEntry >= 0), "programming error");
     512        list[0]  = list[forceSynthEntry];
     513        dlist[0] = dlist[forceSynthEntry];
     514        wlist[0] = wlist[forceSynthEntry];
     515        N = 1;
     516      }
    478517      liststats (list, dlist, wlist, N, &stats);
    479518
  • branches/eam_branches/ipp-20120405/Ohana/src/relphot/src/relphot_client.c

    r33651 r33887  
    1919  // get configuration info, args, lockfile (set CATDIR, HOST_ID, HOSTDIR, etc)
    2020  initialize_client (argc, argv);
     21  client_logger_init ();
    2122
    2223  // load the current sky table (layout of all SkyRegions)
     
    3334      exit (2);
    3435  }
     36  client_logger_message ("loaded sky table and defined patch\n");
    3537 
    3638  switch (MODE) {
     
    4244          exit (2);
    4345      }
     46      client_logger_message ("loaded catalogs\n");
     47
    4448      BrightCatalog *bcatalog = BrightCatalogMerge (catalog, Ncatalog);
     49      client_logger_message ("generated subset data\n");
     50
    4551      if (!BrightCatalogSave (BCATALOG, bcatalog)) {
    4652          fprintf (stderr, "ERROR saving bright catalog from %s\n", CATDIR);
    4753          exit (2);
    4854      }
     55      client_logger_message ("generated subset table\n");
    4956      break;
    5057    }
     
    5865          exit (2);
    5966      }
     67      client_logger_message ("loaded image subset data\n");
    6068     
    6169      // save the available image information in the static array in ImageOps.c
     
    6674      snprintf (flatcorrFile, 1024, "%s/flatcorr.fits", CATDIR);
    6775      FlatCorrectionTable *flatcorr = FlatCorrectionLoad (flatcorrFile, VERBOSE);
     76      client_logger_message ("loaded flat-field correction data\n");
    6877
    6978      reload_catalogs (skylist, flatcorr, HOST_ID, HOSTDIR);
     79      client_logger_message ("updated catalogs\n");
    7080      break;
    7181    }
     
    7383    case MODE_UPDATE_OBJECTS: {
    7484      relphot_objects (HOST_ID, HOSTDIR);
     85      client_logger_message ("updated objects\n");
    7586      break;
    7687    }
     
    8091      abort();
    8192  }
     93  client_logger_message ("done with relphot_client\n");
    8294
    8395  exit (0);
    8496}
     97
     98// I'm getting unlogged errors and failures.  I need a log ouput that the clients can
     99// write independent of the master
     100
     101static FILE *logfile = NULL;
     102int client_logger_init () {
     103
     104  char filename[DVO_MAX_PATH];
     105
     106  snprintf (filename, DVO_MAX_PATH, "%s/relphot.client.XXXXXX.log", HOSTDIR);
     107   
     108  int fd = mkstemp (filename);
     109  if (fd == -1) {
     110    fprintf (stderr, "failed to open client logger, exiting\n");
     111    exit (50);
     112  }
     113
     114  logfile = fdopen (fd, "w");
     115  if (!logfile)  {
     116    fprintf (stderr, "failed to fdopen client logger, exiting\n");
     117    exit (51);
     118  }
     119  return TRUE;
     120}
     121
     122int client_logger_message (char *format,...) {
     123
     124  va_list argp;
     125
     126  va_start (argp, format);
     127  vfprintf (logfile, format, argp);
     128  va_end (argp);
     129  return TRUE;
     130}
Note: See TracChangeset for help on using the changeset viewer.