IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37357 for trunk/Ohana


Ignore:
Timestamp:
Sep 4, 2014, 7:55:12 AM (12 years ago)
Author:
eugene
Message:

merge changes from eam branch ipp-20140813 (ingest radial apertures for force photometry [-xrad])

Location:
trunk/Ohana/src/addstar
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/Makefile

    r37116 r37357  
    8686$(SRC)/ReadStarsTEXT.$(ARCH).o \
    8787$(SRC)/ReadStarsSDSS.$(ARCH).o \
     88$(SRC)/ReadXradFITS.$(ARCH).o \
    8889$(SRC)/FilterStars.$(ARCH).o \
    8990$(SRC)/ImageOptions.$(ARCH).o \
  • trunk/Ohana/src/addstar/include/addstar.h

    r37116 r37357  
    3535  char *exthead;
    3636  char *extdata;
     37  char *extxrad;
    3738  char *exttype;
    3839  int extnum_head;
    3940  int extnum_data;
     41  int extnum_xrad;
    4042} HeaderSet;
    4143
     
    146148
    147149int     OLD_RESORT;
     150int     READ_XRAD_DATA;
    148151
    149152int    PARALLEL;
     
    250253Stars     *FilterStars            PROTO((Stars *instars, Image *image, unsigned int imageID, const AddstarClientOptions *options));
    251254Stars     *MergeStars             PROTO((Stars *stars, unsigned int *Nstars, Stars *instars, unsigned int Ninstars));
     255
     256int        ReadXradFITS           PROTO((FILE *f, Header *theader, Stars *stars, unsigned int Nstars));
     257
    252258double     scat_subpix            PROTO((double x, double y));
    253259void       update_coords          PROTO((Average *average, Measure *measure, off_t *next));
  • trunk/Ohana/src/addstar/src/FilterStars.c

    r37036 r37357  
    99
    1010// the imageID supplied here is the sequence **within this set**
    11 // this value is updated based on the image table later
     11// this value is updated based on the image table later (in UpdateImageIDs)
    1212Stars *FilterStars (Stars *instars, Image *image, unsigned int imageID, const AddstarClientOptions *options) {
    1313
     
    127127    stars[N].measure.imageID = imageID; // this value is updated in UpdateImageIDs
    128128
     129    // add imageID to lensing entry, if it exists
     130    if (stars[N].lensing) {
     131      stars[N].lensing->imageID = imageID;
     132    }
     133
    129134    N ++;
    130135  }
  • trunk/Ohana/src/addstar/src/LoadData.c

    r34088 r37357  
    8383      continue;
    8484    }
     85
     86    // XRAD : if we want to read the xrad table, skip to that table here:
     87    if (headerSets[i].extnum_xrad != -1) {
     88      int Nxrad = headerSets[i].extnum_xrad;
     89      Nskip = 0;
     90      for (j = 0; j < Nxrad; j++) {
     91        Nskip += extsize[j];
     92      }
     93      fseeko (f, Nskip, SEEK_SET);
     94     
     95      if (!ReadXradFITS (f, headers[Nxrad], inStars, images[0][Nvalid].nstar)) {
     96        fprintf (stderr, "problem reading the radial flux data for %s\n", headerSets[i].extdata);
     97      }
     98    }
     99
    85100    inStars = FilterStars (inStars, &images[0][Nvalid], Nvalid, options);
    86101    *stars = MergeStars (*stars, Nstars, inStars, images[0][Nvalid].nstar);
  • trunk/Ohana/src/addstar/src/MatchHeaders.c

    r37054 r37357  
    7979    headerSets[Nimage].extdata     = strcreate (extname);
    8080    headerSets[Nimage].exthead     = strcreate (exthead);
     81    headerSets[Nimage].extxrad     = NULL;
    8182    headerSets[Nimage].extnum_data = i;
    8283    headerSets[Nimage].extnum_head = -1;
     84    headerSets[Nimage].extnum_xrad = -1;
     85
     86    // XXX a special case for fforce xrad data
     87    if (READ_XRAD_DATA) {
     88      // extname is foobar.psf, convert to foobar.xrad
     89      int Nchar = strlen (extname); // foobar.psf : Nchar = 10
     90      ALLOCATE (headerSets[Nimage].extxrad, char, Nchar + 2); // xrad is 1 longer than psf
     91      memcpy   (headerSets[Nimage].extxrad, extname, Nchar - 3); // Nchar - 3 = 7
     92      memcpy  (&headerSets[Nimage].extxrad[Nchar-3], "xrad", 4);
     93      headerSets[Nimage].extxrad[Nchar + 1] = 0; // put the 0 at element 11 for foobar.xrad\0
     94    }
    8395
    8496    // find the matching exthead entry
    8597    for (j = 0; j < Nheaders; j++) {
    8698      if (!gfits_scan (headers[j], ExtnameKeyword, "%s", 1, extname)) continue;
    87       if (strcmp (extname, headerSets[Nimage].exthead)) continue;
    88       headerSets[Nimage].extnum_head = j;
    89       break;
     99      if (!strcmp (extname, headerSets[Nimage].exthead)) {
     100        headerSets[Nimage].extnum_head = j;
     101        if (!READ_XRAD_DATA) break;
     102      }
     103      if (READ_XRAD_DATA && !strcmp (extname, headerSets[Nimage].extxrad)) {
     104        headerSets[Nimage].extnum_xrad = j;
     105      }
     106      if ((headerSets[Nimage].extnum_head > -1) && (headerSets[Nimage].extnum_xrad > -1)) {
     107        // we can only get here if READ_XRAD_DATA is true
     108        break;
     109      }
    90110    }
    91111
  • trunk/Ohana/src/addstar/src/UpdateImageIDs.c

    r35579 r37357  
    5555  for (i = 0; i < Nstars; i++) {
    5656    stars[i].measure.imageID += imageID;
     57    if (stars[i].lensing) {
     58      stars[i].lensing->imageID += imageID;
     59    }
    5760  }
    5861
  • trunk/Ohana/src/addstar/src/addstar.c

    r37116 r37357  
    11# include "addstar.h"
     2
     3# define RESETTIME { gettimeofday (&startTimer, (void *) NULL); }
    24
    35// LARGEFILES: this program currently limits Nstars (input file) to < 2^31
     
    1820  SkyList *newlist = NULL;
    1921
    20   double dtime;
    21   struct timeval start, stop;
    22 
    23   gettimeofday (&start, NULL);
     22  struct timeval startAddstar, stopAddstar;
     23  gettimeofday (&startAddstar, (void *) NULL);
     24
     25  INITTIME;
    2426
    2527  SetSignals ();
     
    4446  }
    4547
     48  MARKTIME ("init and config: %f sec\n", dtime); RESETTIME;
     49
    4650  stars = NULL;
    4751
     
    5054    case ADDSTAR_MODE_IMAGE:
    5155      stars = LoadStars (argv[1], &Nstars, &images, &Nimages, &options);
     56      MARKTIME ("load smf: %f sec\n", dtime); RESETTIME;
    5257
    5358      // set and update the imageID sequence
     
    127132      }
    128133    }
     134    MARKTIME ("load cpt: %f sec\n", dtime); RESETTIME;
    129135
    130136    // Naves_disk == 0 implies an empty catalog file
     
    157163        break;
    158164    }
     165    MARKTIME ("match stars: %f sec\n", dtime); RESETTIME;
     166
    159167    /* report total updated values */
    160168    Naverage += catalog.Naverage;
     
    175183    dvo_catalog_unlock (&catalog);
    176184    dvo_catalog_free (&catalog);
     185    MARKTIME ("save cpt: %f sec\n", dtime); RESETTIME;
    177186
    178187    if (options.mode == ADDSTAR_MODE_REFCAT) free (stars);
     
    208217  dvo_image_unlock (&db); /* unlock? */
    209218
    210   gettimeofday (&stop, NULL);
    211   dtime = DTIME (stop, start);
     219  gettimeofday (&stopAddstar, (void *) NULL);
     220  float dtime = DTIME (stopAddstar, startAddstar);
    212221  fprintf (stderr, "SUCCESS: elapsed time %9.4f sec for %5d stars (%5d matches), "OFF_T_FMT" average, "OFF_T_FMT" measure, "OFF_T_FMT" lensing\n", dtime, Nstars, Nmatch,  Naverage,  Nmeasure, Nlensing);
    213222
  • trunk/Ohana/src/addstar/src/args.c

    r37116 r37357  
    8181    PMM_CCD_TABLE = strcreate (argv[N]);
    8282    remove_argument (N, &argc, argv);
     83  }
     84
     85  READ_XRAD_DATA = FALSE;
     86  if ((N = get_argument (argc, argv, "-xrad"))) {
     87    remove_argument (N, &argc, argv);
     88    READ_XRAD_DATA = TRUE;
    8389  }
    8490
Note: See TracChangeset for help on using the changeset viewer.