IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32055


Ignore:
Timestamp:
Aug 9, 2011, 12:25:01 PM (15 years ago)
Author:
eugene
Message:

add merge-source mode; modified getimages API to avoid a wasteful copy of the image table; fix the parallax measurement

Location:
branches/eam_branches/ipp-20110710/Ohana/src/relastro
Files:
2 added
16 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/Makefile

    r31635 r32055  
    6262$(SRC)/high_speed_objects.$(ARCH).o  \
    6363$(SRC)/high_speed_utils.$(ARCH).o  \
     64$(SRC)/relastro_merge_source.$(ARCH).o  \
     65$(SRC)/resort_catalog.$(ARCH).o  \
    6466$(SRC)/relastroVisual.$(ARCH).o
    6567
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/include/relastro.h

    r31664 r32055  
    1515typedef enum {FIT_NONE, FIT_AVERAGE, FIT_PM_ONLY, FIT_PAR_ONLY, FIT_PM_AND_PAR} FitMode;
    1616
    17 typedef enum {TARGET_NONE, TARGET_OBJECTS, TARGET_SIMPLE, TARGET_CHIPS, TARGET_MOSAICS, TARGET_HIGH_SPEED} FitTarget;
     17typedef enum {TARGET_NONE, TARGET_OBJECTS, TARGET_SIMPLE, TARGET_CHIPS, TARGET_MOSAICS, TARGET_HIGH_SPEED, TARGET_MERGE_SOURCE} FitTarget;
    1818
    1919typedef struct {
     
    9494char   SKY_TABLE[256];
    9595int    SKY_DEPTH;  /** XXX EAM : depth of catalog tables, fix usage */
     96
     97unsigned int OBJ_ID_SRC;
     98unsigned int CAT_ID_SRC;
     99unsigned int OBJ_ID_DST;
     100unsigned int CAT_ID_DST;
    96101
    97102double SIGMA_LIM;
     
    210215void          getfullregion       PROTO((Image *image, off_t Nimage, GSCRegion *fullregion));
    211216Image        *getimage            PROTO((off_t N));
    212 Image        *getimages           PROTO((off_t *N));
     217Image        *getimages           PROTO((off_t *N, off_t **line_number));
    213218void          global_stats        PROTO((Catalog *catalog, int Ncatalog));
    214219void          initGrid            PROTO((int dX, int dY));
    215220void          initGridBins        PROTO((Catalog *catalog, int Ncatalog));
    216221void          initImageBins       PROTO((Catalog *catalog, int Ncatalog, int FULLINIT));
    217 void          initImages          PROTO((Image *input, off_t N));
     222void          initImages          PROTO((Image *input, off_t *line_number, off_t N));
    218223void          initMosaicBins      PROTO((Catalog *catalog, int Ncatalog));
    219224void          initMosaicGrid      PROTO((Image *image, off_t Nimage));
     
    372377int applyConstraintsB(Catalog *catalog, off_t i);
    373378void setupAreaSelection(SkyRegion *region);
     379
     380int relastro_merge_source ();
     381void resort_catalog (Catalog *catalog);
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/src/CoordOps.c

    r27581 r32055  
    1313  Image *images;
    1414
    15   images = getimages (&N);
     15  images = getimages (&N, NULL);
    1616
    1717  NoldCoords = N;
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/src/FitPM.c

    r17210 r32055  
    7373  chisq = 0.0;
    7474  for (i = 0; i < Npts; i++) {
    75       Xf = fit[0].Ro + fit[0].uR*T[i];
    76       Yf = fit[0].Do + fit[0].uD*T[i];
    77       chisq += SQ(X[i] - Xf) / SQ(dX[i]);
    78       chisq += SQ(Y[i] - Yf) / SQ(dY[i]);
     75    Xf = fit[0].Ro + fit[0].uR*T[i];
     76    Yf = fit[0].Do + fit[0].uD*T[i];
     77    chisq += SQ(X[i] - Xf) / SQ(dX[i]);
     78    chisq += SQ(Y[i] - Yf) / SQ(dY[i]);
    7979  }
    8080  fit[0].Nfit = Npts;
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/src/FitPMandPar.c

    r16060 r32055  
    99  double wx, wy, Wx, Wy, Tx, Ty, Tx2, Ty2, Xs, Ys, XT, YT;
    1010  double PR, PD, PRT, PDT, PRX, PDY, PR2, PD2;
     11  double chisq, Xf, Yf;
    1112
    1213  A = array_init (5, 5);
     
    9596  /* get the chisq from the matrix values */
    9697
     98  // add up the chi square for the fit
     99  chisq = 0.0;
     100  for (i = 0; i < Npts; i++) {
     101    Xf = fit[0].Ro + fit[0].uR*T[i] + fit[0].dp*pR[i];
     102    Yf = fit[0].Do + fit[0].uD*T[i] + fit[0].dp*pD[i];
     103    chisq += SQ(X[i] - Xf) / SQ(dX[i]);
     104    chisq += SQ(Y[i] - Yf) / SQ(dY[i]);
     105  }
     106  fit[0].Nfit = Npts;
     107
     108  // the reduced chisq is divided by (Ndof = 2*Npts - 5)
     109  fit[0].chisq = chisq / (2.0*Npts - 5.0);
    97110  return (TRUE);
    98111}
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/src/FixProblemImages.c

    r27581 r32055  
    1515  ALLOCATE (sublist.filename, char *, 1);
    1616
    17   image = getimages (&Nimage);
     17  image = getimages (&Nimage, NULL);
    1818
    1919  Nbad = 0;
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/src/ImageOps.c

    r31664 r32055  
    1111static Image        *image;   // list of available images
    1212static off_t        Nimage;   // number of available images
     13static off_t       *LineNumber; // match of subset to full image table
    1314
    1415static int         *Ncatlist;  // catalogs associated with each image
     
    2728# endif
    2829
    29 Image *getimages (off_t *N) {
     30Image *getimages (off_t *N, off_t **line_number) {
     31
    3032  *N = Nimage;
     33  if (line_number) *line_number = LineNumber;
    3134  return (image);
    3235}
     
    4245}
    4346
    44 void initImages (Image *input, off_t N) {
     47void initImages (Image *input, off_t *line_number, off_t N) {
    4548
    4649  off_t i;
    4750
    4851  image = input;
     52  LineNumber = line_number;
    4953  Nimage = N;
    5054
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/src/StarMaps.c

    r30616 r32055  
    4040  off_t i, Nimages;
    4141
    42   images = getimages(&Nimages);
     42  images = getimages(&Nimages, NULL);
    4343
    4444  ALLOCATE (starmap, StarMap, Nimages);
     
    6464  gettimeofday (&start, (void *) NULL);
    6565
    66   images = getimages(&Nimages);
     66  images = getimages(&Nimages, NULL);
    6767
    6868  for (i = 0; i < catalog[0].Nmeasure; i++) {
     
    9090  int ix, iy;
    9191
    92   images = getimages(&Nimages);
     92  images = getimages(&Nimages, NULL);
    9393
    9494  for (i = 0; i < Nimages; i++) {
     
    129129  double L, M, dLmax, dMmax;
    130130
    131   images = getimages(&Nimages);
     131  images = getimages(&Nimages, NULL);
    132132
    133133  dLmax = dMmax = 0.0;
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/src/UpdateChips.c

    r30616 r32055  
    1818  Nskip = Nmosaic = NnewFit = NoldFit = 0;
    1919
    20   image = getimages (&Nimage);
     20  image = getimages (&Nimage, NULL);
    2121
    2222  // save fit results for summary plot
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/src/UpdateMeasures.c

    r29001 r32055  
    1313    ID_IMAGE_ASTROM_FEW;
    1414
    15   image = getimages (&Nimage);
     15  image = getimages (&Nimage, NULL);
    1616
    1717  for (i = 0; i < Nimage; i++) {
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/src/UpdateObjects.c

    r31450 r32055  
    196196      }
    197197     
    198       XVERB = FALSE && (catalog[i].measure[m].dM < 0.01) && (N == 6) && (mode == FIT_PM_ONLY);
     198      XVERB = (catalog[i].measure[m].dM < 0.01) && (N == 6) && (mode == FIT_PM_ONLY);
    199199
    200200      // to judge the quality of the PM and PAR fits, we need to fit all three models and compare Chisq
     
    225225
    226226      if (mode == FIT_PM_AND_PAR) {
    227         fprintf (stderr, "parallax fitting is still untested (%s, %d)", __FILE__, __LINE__);
    228         exit (2);
     227        // fprintf (stderr, "parallax fitting is still untested (%s, %d)\n", __FILE__, __LINE__);
    229228
    230229        for (k = 0; k < N; k++) {
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/src/UpdateSimple.c

    r27581 r32055  
    88  StarData *raw, *ref;
    99
    10   image = getimages (&Nimage);
     10  image = getimages (&Nimage, NULL);
    1111
    1212  for (i = 0; i < Nimage; i++) {
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/src/args.c

    r31664 r32055  
    11# include "relastro.h"
    22void usage (void);
     3void usage_merge_source (void);
     4void usage_merge_source_id (char *name);
    35
    46int args (int argc, char **argv) {
     
    68  int N;
    79  double trange;
     10  char *endptr;
    811
    912  /* possible operations */
    1013  FIT_TARGET = TARGET_NONE;
    1114  FIT_MODE = FIT_AVERAGE;
     15
     16  if ((N = get_argument (argc, argv, "-merge-source"))) {
     17    if (N > argc - 6) usage_merge_source();
     18    if (strcmp(argv[N+3], "into")) usage_merge_source();
     19    FIT_TARGET = TARGET_MERGE_SOURCE;
     20    remove_argument (N, &argc, argv);
     21    OBJ_ID_SRC = strtol(argv[N], &endptr, 0);
     22    if (*endptr) usage_merge_source_id (argv[N]);
     23    remove_argument (N, &argc, argv);
     24    CAT_ID_SRC = strtol(argv[N], &endptr, 0);
     25    if (*endptr) usage_merge_source_id (argv[N]);
     26    remove_argument (N, &argc, argv);
     27    remove_argument (N, &argc, argv); // remove the 'into'
     28    OBJ_ID_DST = strtol(argv[N], &endptr, 0);
     29    if (*endptr) usage_merge_source_id (argv[N]);
     30    remove_argument (N, &argc, argv);
     31    CAT_ID_DST = strtol(argv[N], &endptr, 0);
     32    if (*endptr) usage_merge_source_id (argv[N]);
     33    remove_argument (N, &argc, argv);
     34
     35    if (argc != 1) usage ();
     36    return TRUE;
     37  }
     38
    1239  if ((N = get_argument (argc, argv, "-update-objects"))) {
    1340    remove_argument (N, &argc, argv);
     
    307334  fprintf (stderr, "ERROR: USAGE: relastro -region RA RA DEC DEC\n");
    308335  fprintf (stderr, "       OR:    relastro -catalog (ra) (dec)\n\n");
     336  fprintf (stderr, "       OR:    relastro -high-speed [options]\n\n");
     337  fprintf (stderr, "       OR:    relastro -merge-source [options]\n\n");
    309338  fprintf (stderr, "  specify one of the following modes: \n");
    310339  fprintf (stderr, "  -update-objects\n");
     
    340369}
    341370
     371void usage_merge_source_id (char *name) {
     372
     373  fprintf (stderr, "ERROR: invalid ID %s (remember to prefix 0x to hex IDs)\n", name);
     374  exit (2);
     375}
     376
     377void usage_merge_source () {
     378  fprintf (stderr, "ERROR: USAGE: relastro -merge-source (objID) (catID) into (objID) (catID)\n");
     379  exit (2);
     380}
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/src/initialize.c

    r31635 r32055  
    1010  ConfigInit (&argc, argv);
    1111  args (argc, argv);
     12
     13  if (FIT_TARGET == TARGET_MERGE_SOURCE) return;
    1214
    1315  /* build a list of accepted photcodes. these will be used by bcatalog to accept or
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/src/load_images.c

    r31664 r32055  
    4444  MARKTIME("  select images: %f sec\n", dtime);
    4545
    46   // generate db->vtable from db->ftable based on the selection
    47   // XXX does this simply duplicate the memory needlessly?  we recreate these lines
    48   // in reload_images.  If we had saved the line numbers, we could avoid this
    49   // vtable points *another* copy of the subset rows
    50   // (the later call to 'reload_images' copies the subset elements back on top of
    51   // the rows of the vtable)
    52   // gfits_vtable_from_ftable (&db[0].ftable, &db[0].vtable, LineNumber, Nsubset);
    53   // MARKTIME("converted ftable to vtable: %f sec\n", dtime);
    54 
    55   initImages (subset, Nsubset);
     46  initImages (subset, LineNumber, Nsubset);
    5647  MARKTIME("  init images: %f sec\n", dtime);
    5748
     
    6859
    6960  Image     *image;
    70   off_t     Nimage, Nx, i;
     61  off_t     Nimage, Nx, i, *LineNumber;
    7162  VTable    *vtable;
    7263
    73   image = getimages (&Nimage);
     64  image = getimages (&Nimage, &LineNumber);
    7465
     66  gfits_vtable_from_ftable (&db[0].ftable, &db[0].vtable, LineNumber, Nimage);
    7567  vtable = &db[0].vtable;
    7668
  • branches/eam_branches/ipp-20110710/Ohana/src/relastro/src/relastro.c

    r30616 r32055  
    2323  if (FIT_TARGET == TARGET_HIGH_SPEED) {
    2424    high_speed_catalogs ();
     25    exit (0);
     26  }
     27
     28  /* the object analysis is a separate process iterating over catalogs */
     29  if (FIT_TARGET == TARGET_MERGE_SOURCE) {
     30    relastro_merge_source ();
    2531    exit (0);
    2632  }
Note: See TracChangeset for help on using the changeset viewer.