IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33270


Ignore:
Timestamp:
Feb 15, 2012, 7:50:06 AM (14 years ago)
Author:
eugene
Message:

relphot_client -load basically works

Location:
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/BrightCatalog.c

    r33254 r33270  
    474474  }
    475475   
     476  // XXX this prevents different catalogs from having different Nsecfilt values
     477  int Nsecfilt = GetPhotcodeNsecfilt();
     478
    476479  ALLOCATE (bcatalog[0].measure, MeasureTiny, Nmeas);
    477480  ALLOCATE (bcatalog[0].average, AverageTiny, Naves);
     481  ALLOCATE (bcatalog[0].secfilt, SecFilt, Naves*Nsecfilt);
    478482
    479483  int Nm = 0;
    480484  int Na = 0;
    481485  for (i = 0; i < Ncatalog; i++) {
     486    if (!catalog[i].Naverage) continue;
    482487    for (j = 0; j < catalog[i].Naverage; j++) {
    483       CopyAverageTiny (&bcatalog[0].average[Na], &catalog[i].average[j]);
     488      // CopyAverageTiny (&bcatalog[0].average[Na], &catalog[i].average[j]);
     489      bcatalog[0].average[Na] = catalog[i].averageT[j];
    484490      bcatalog[0].average[Na].catID = catalog[i].catID;
    485       int Nsecfilt = catalog[i].Nsecfilt;
    486491      for (k = 0; k < Nsecfilt; k++) {
    487492        bcatalog[0].secfilt[Nsecfilt*Na + k] = catalog[i].secfilt[Nsecfilt*j + k];
     
    491496    }
    492497    for (j = 0; j < catalog[i].Nmeasure; j++) {
    493       CopyMeasureTiny (&bcatalog[0].measure[Nm], &catalog[i].measure[j]);
     498      // CopyMeasureTiny (&bcatalog[0].measure[Nm], &catalog[i].measure[j]);
     499      bcatalog[0].measure[Nm] = catalog[i].measureT[j];
    494500      bcatalog[0].measure[Nm].catID = catalog[i].catID;
    495501      Nm++;
     
    497503    }
    498504  }
     505  bcatalog->Naverage = Na;
     506  bcatalog->Nmeasure = Nm;
    499507  return bcatalog;
    500508}
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/Shutdown.c

    r7080 r33270  
    11# include "relphot.h"
    22
    3 static FITS_DB *db;
     3static FITS_DB *db = NULL;
    44
    55void set_db (FITS_DB *in) {
     
    2222
    2323  SetProtect (TRUE);
    24   gfits_db_close (db);
     24  if (db) gfits_db_close (db);
    2525  fprintf (stderr, "ERROR: addstar halted\n");
    2626  exit (1);
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/args.c

    r33254 r33270  
    291291  if (!HOSTDIR) relphot_client_usage();
    292292
    293   CATDIR[0] = 0;
    294   if ((N = get_argument (argc, argv, "-catdir"))) {
    295     remove_argument (N, &argc, argv);
    296     strcpy (CATDIR, argv[N]);
    297     remove_argument (N, &argc, argv);
    298   }
    299   if (!CATDIR[0]) relphot_client_usage();
     293  // CATDIR[0] = 0;
     294  // if ((N = get_argument (argc, argv, "-catdir"))) {
     295  //   remove_argument (N, &argc, argv);
     296  //   strcpy (CATDIR, argv[N]);
     297  //   remove_argument (N, &argc, argv);
     298  // }
     299  // if (!CATDIR[0]) relphot_client_usage();
    300300
    301301  IMAGES = NULL; // used in -update mode
     
    320320  if (!MODE) relphot_client_usage();
    321321
    322   if (argc != 1) relphot_client_usage ();
     322  /* specify portion of the sky */
     323  UserPatch.Rmin = 0;
     324  UserPatch.Rmax = 360;
     325  UserPatch.Dmin = -90;
     326  UserPatch.Dmax = +90;
     327  UserPatchSelect = FALSE;
     328  if ((N = get_argument (argc, argv, "-region"))) {
     329    remove_argument (N, &argc, argv);
     330    UserPatch.Rmin = atof (argv[N]);
     331    remove_argument (N, &argc, argv);
     332    UserPatch.Rmax = atof (argv[N]);
     333    remove_argument (N, &argc, argv);
     334    UserPatch.Dmin = atof (argv[N]);
     335    remove_argument (N, &argc, argv);
     336    UserPatch.Dmax = atof (argv[N]);
     337    remove_argument (N, &argc, argv);
     338    UserPatchSelect = TRUE;
     339  }
     340
     341  if (argc != 2) relphot_client_usage ();
    323342
    324343  return TRUE;
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/help.c

    r33244 r33270  
    4545
    4646void relphot_client_usage (void) {
    47   fprintf (stderr, "ERROR: USAGE: relphot -load -bcatalog (filename) -hostID (hostID) -hostdir (hostdir) -catdir (catdir)\n");
    48   fprintf (stderr, "       or:    relphot -update -images (filename) -hostID (hostID) -hostdir (hostdir) -catdir (catdir)\n");
     47  fprintf (stderr, "ERROR: USAGE: relphot (photcodes) -load (filename) -hostID (hostID) -hostdir (hostdir) [options]\n");
     48  fprintf (stderr, "       or:    relphot -update (filename) -hostID (hostID) -hostdir (hostdir) [options]\n");
    4949  fprintf (stderr, "  use -h for more usage information\n");
    5050  exit (2);
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/initialize.c

    r33254 r33270  
    11# include "relphot.h"
     2
     3void ParsePhotcodeList (char *word) {
     4
     5  Nphotcodes = 0;
     6  photcodes = NULL;
     7  int NPHOTCODES = 10;
     8  ALLOCATE (photcodes, PhotCode *, NPHOTCODES);
     9
     10  /* parse the comma-separated list of photcodesKeep */
     11  char *myList = strcreate(word);
     12  char *list = myList;
     13  char *codename = NULL;
     14  char *ptr = NULL;
     15  while ((codename = strtok_r (list, ",", &ptr)) != NULL) {
     16    list = NULL; // pass NULL on successive strtok_r calls
     17    fprintf (stderr, "PHOTCODE LIST: %s\n", myList);
     18    fprintf (stderr, "codename: %s\n", codename);
     19    if ((photcodes[Nphotcodes] = GetPhotcodebyName (codename)) == NULL) {
     20      fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);
     21      exit (1);
     22    }
     23    if (photcodes[Nphotcodes][0].type != PHOT_SEC) {
     24      fprintf (stderr, "photcode %s is not an filter type (SEC)\n", codename);
     25      exit (1);
     26    }
     27    Nphotcodes ++;
     28    CHECK_REALLOCATE (photcodes, PhotCode *, NPHOTCODES, Nphotcodes, 10);
     29  }
     30}
    231
    332void initialize (int argc, char **argv) {
     
    2756# endif
    2857
    29     Nphotcodes = 0;
    30     photcodes = NULL;
    31     int NPHOTCODES = 10;
    32     ALLOCATE (photcodes, PhotCode *, NPHOTCODES);
    33 
    34     /* parse the comma-separated list of photcodesKeep */
    35     char *myList = strcreate(argv[N]);
    36     char *list = myList;
    37     char *codename = NULL;
    38     char *ptr = NULL;
    39     while ((codename = strtok_r (list, ",", &ptr)) != NULL) {
    40       list = NULL; // pass NULL on successive strtok_r calls
    41       fprintf (stderr, "PHOTCODE LIST: %s\n", myList);
    42       fprintf (stderr, "codename: %s\n", codename);
    43       if ((photcodes[Nphotcodes] = GetPhotcodebyName (codename)) == NULL) {
    44         fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);
    45         exit (1);
    46       }
    47       if (photcodes[Nphotcodes][0].type != PHOT_SEC) {
    48           fprintf (stderr, "photcode %s is not an filter type (SEC)\n", codename);
    49           exit (1);
    50       }
    51       Nphotcodes ++;
    52       CHECK_REALLOCATE (photcodes, PhotCode *, NPHOTCODES, Nphotcodes, 10);
    53     }
     58    // load the list of photcodes into the globals (photcodes, Nphotcodes)
     59    ParsePhotcodeList (argv[N]);
    5460  }
    5561  // XXX DEP PhotNsec = GetPhotcodeNsecfilt ();
     
    99105
    100106  relphot_client_help (argc, argv);
    101   // ConfigInit (&argc, argv); XXX not sure if we need anything in here (maybe photcode table)
     107  ConfigInit (&argc, argv);
    102108  args_client (argc, argv);
     109
     110  // load the list of photcodes into the globals (photcodes, Nphotcodes)
     111  ParsePhotcodeList (argv[1]);
    103112}
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/relphot.c

    r33254 r33270  
    5858  // XXX need to reduce number of global variables in use.
    5959  // XXX this is fairly lame: argv[1] is photcode if UserPatchSelect is true
     60  // XXX clean this up: deprecate region-name here (can be optional if desired)
    6061  skylist = load_images (&db, argv[1], &UserPatch, UserPatchSelect);
    6162  MARKTIME("-- load images: %f sec\n", dtime);
Note: See TracChangeset for help on using the changeset viewer.