IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32346


Ignore:
Timestamp:
Sep 6, 2011, 11:15:56 AM (15 years ago)
Author:
eugene
Message:

added concept of merging multiple objects into a single object in DVO / relastro; avoid memory-hogging duplication of the images array in relastro / relphot; enable parallax fitting; fix nan/inf bug in color points; add -no-return option to opihi/echo

Location:
trunk/Ohana/src
Files:
22 edited
9 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kapa2/src/DrawObjects.c

    r31665 r32346  
    408408          (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) {
    409409        if (scaleColor) {
     410          if (!finite(z[i])) continue;
    410411          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    411412          XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel);
     
    424425          (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) {
    425426        if (scaleColor) {
     427          if (!finite(z[i])) continue;
    426428          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    427429          XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel);
     
    440442          (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) {
    441443        if (scaleColor) {
     444          if (!finite(z[i])) continue;
    442445          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    443446          XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel);
     
    457460          (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) {
    458461        if (scaleColor) {
     462          if (!finite(z[i])) continue;
    459463          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    460464          XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel);
     
    475479          (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) {
    476480        if (scaleColor) {
     481          if (!finite(z[i])) continue;
    477482          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    478483          XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel);
     
    495500          (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) {
    496501        if (scaleColor) {
     502          if (!finite(z[i])) continue;
    497503          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    498504          XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel);
     
    513519          (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) {
    514520        if (scaleColor) {
     521          if (!finite(z[i])) continue;
    515522          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    516523          XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel);
     
    531538          (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) {
    532539        if (scaleColor) {
     540          if (!finite(z[i])) continue;
    533541          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    534542          XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel);
     
    547555          (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) {
    548556        if (scaleColor) {
     557          if (!finite(z[i])) continue;
    549558          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    550559          XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel);
     
    567576          (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) {
    568577        if (scaleColor) {
     578          if (!finite(z[i])) continue;
    569579          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    570580          XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel);
     
    589599          (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) {
    590600        if (scaleColor) {
     601          if (!finite(z[i])) continue;
    591602          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    592603          XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel);
  • trunk/Ohana/src/kapa2/src/PSObjects.c

    r31665 r32346  
    323323      {
    324324        if (scaleColor) {
     325          if (!finite(z[i])) continue;
    325326          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    326327          fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]);
     
    340341      {
    341342        if (scaleColor) {
     343          if (!finite(z[i])) continue;
    342344          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    343345          fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]);
     
    357359      {
    358360        if (scaleColor) {
     361          if (!finite(z[i])) continue;
    359362          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    360363          fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]);
     
    375378      {
    376379        if (scaleColor) {
     380          if (!finite(z[i])) continue;
    377381          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    378382          fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]);
     
    393397      {
    394398        if (scaleColor) {
     399          if (!finite(z[i])) continue;
    395400          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    396401          fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]);
     
    415420      {
    416421        if (scaleColor) {
     422          if (!finite(z[i])) continue;
    417423          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    418424          fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]);
     
    434440      {
    435441        if (scaleColor) {
     442          if (!finite(z[i])) continue;
    436443          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    437444          fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]);
     
    453460      {
    454461        if (scaleColor) {
     462          if (!finite(z[i])) continue;
    455463          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    456464          fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]);
     
    470478      {
    471479        if (scaleColor) {
     480          if (!finite(z[i])) continue;
    472481          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    473482          fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]);
     
    491500      {
    492501        if (scaleColor) {
     502          if (!finite(z[i])) continue;
    493503          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    494504          fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]);
     
    514524      {
    515525        if (scaleColor) {
     526          if (!finite(z[i])) continue;
    516527          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    517528          fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]);
  • trunk/Ohana/src/kapa2/src/bDrawObjects.c

    r31665 r32346  
    307307      {
    308308        if (scaleColor) {
     309          if (!finite(z[i])) continue;
    309310          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    310311          buffer->bColor_R = pixel1[pixel];
     
    326327      {
    327328        if (scaleColor) {
     329          if (!finite(z[i])) continue;
    328330          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    329331          buffer->bColor_R = pixel1[pixel];
     
    345347      {
    346348        if (scaleColor) {
     349          if (!finite(z[i])) continue;
    347350          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    348351          buffer->bColor_R = pixel1[pixel];
     
    365368      {
    366369        if (scaleColor) {
     370          if (!finite(z[i])) continue;
    367371          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    368372          buffer->bColor_R = pixel1[pixel];
     
    385389      {
    386390        if (scaleColor) {
     391          if (!finite(z[i])) continue;
    387392          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    388393          buffer->bColor_R = pixel1[pixel];
     
    405410      {
    406411        if (scaleColor) {
     412          if (!finite(z[i])) continue;
    407413          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    408414          buffer->bColor_R = pixel1[pixel];
     
    424430      {
    425431        if (scaleColor) {
     432          if (!finite(z[i])) continue;
    426433          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    427434          buffer->bColor_R = pixel1[pixel];
     
    445452      {
    446453        if (scaleColor) {
     454          if (!finite(z[i])) continue;
    447455          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    448456          buffer->bColor_R = pixel1[pixel];
     
    464472      {
    465473        if (scaleColor) {
     474          if (!finite(z[i])) continue;
    466475          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    467476          buffer->bColor_R = pixel1[pixel];
     
    487496      {
    488497        if (scaleColor) {
     498          if (!finite(z[i])) continue;
    489499          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    490500          buffer->bColor_R = pixel1[pixel];
     
    511521      {
    512522        if (scaleColor) {
     523          if (!finite(z[i])) continue;
    513524          int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1)));
    514525          buffer->bColor_R = pixel1[pixel];
  • trunk/Ohana/src/opihi/cmd.basic/echo.c

    r14190 r32346  
    33int echo (int argc, char **argv) {
    44 
    5   int i;
     5  int i, N, RETURN_CHAR;
     6
     7  RETURN_CHAR = TRUE;
     8  if ((N = get_argument (argc, argv, "-no-return"))) {
     9    remove_argument (N, &argc, argv);
     10    RETURN_CHAR = FALSE;
     11  }
    612
    713  for (i = 1; i < argc - 1; i++) {
     
    915  }
    1016  if (argc >= 2) {
     17    if (RETURN_CHAR) {
    1118      gprint (GP_LOG, "%s\n", argv[argc - 1]);
     19    } else {
     20      gprint (GP_LOG, "%s", argv[argc - 1]);
     21    }
    1222  }
    1323  return (TRUE);
  • trunk/Ohana/src/opihi/cmd.data/plot.c

    r20936 r32346  
    5353    return (FALSE);
    5454  }
     55  if (dypvec && (dypvec->Nelements != xvec->Nelements)) goto mismatch;
     56  if (dymvec && (dymvec->Nelements != xvec->Nelements)) goto mismatch;
     57  if (dxpvec && (dxpvec->Nelements != xvec->Nelements)) goto mismatch;
     58  if (dxmvec && (dxmvec->Nelements != xvec->Nelements)) goto mismatch;
     59
    5560  Npts = xvec[0].Nelements;
    5661  if (Npts == 0) return (TRUE);
     
    6974  }
    7075  return (TRUE);
     76
     77mismatch:
     78  gprint (GP_ERR, "error and data vector lengths are mismatched\n");
     79  return (FALSE);
    7180}
  • trunk/Ohana/src/relastro/Makefile

    r31635 r32346  
    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
  • trunk/Ohana/src/relastro/include/relastro.h

    r31664 r32346  
    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);
  • trunk/Ohana/src/relastro/src/CoordOps.c

    r27581 r32346  
    1313  Image *images;
    1414
    15   images = getimages (&N);
     15  images = getimages (&N, NULL);
    1616
    1717  NoldCoords = N;
  • trunk/Ohana/src/relastro/src/FitPM.c

    r17210 r32346  
    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;
  • trunk/Ohana/src/relastro/src/FitPMandPar.c

    r16060 r32346  
    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}
  • trunk/Ohana/src/relastro/src/FixProblemImages.c

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

    r31664 r32346  
    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
  • trunk/Ohana/src/relastro/src/StarMaps.c

    r30616 r32346  
    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;
  • trunk/Ohana/src/relastro/src/UpdateChips.c

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

    r29001 r32346  
    1313    ID_IMAGE_ASTROM_FEW;
    1414
    15   image = getimages (&Nimage);
     15  image = getimages (&Nimage, NULL);
    1616
    1717  for (i = 0; i < Nimage; i++) {
  • trunk/Ohana/src/relastro/src/UpdateObjects.c

    r31450 r32346  
    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++) {
  • trunk/Ohana/src/relastro/src/UpdateSimple.c

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

    r31664 r32346  
    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}
  • trunk/Ohana/src/relastro/src/initialize.c

    r31635 r32346  
    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
  • trunk/Ohana/src/relastro/src/load_images.c

    r31664 r32346  
    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
  • trunk/Ohana/src/relastro/src/relastro.c

    r30616 r32346  
    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  }
  • trunk/Ohana/src/relphot/src/load_images.c

    r31668 r32346  
    8585  }
    8686
    87 
    88   // generate db->vtable from db->ftable based on the selection
    89   // XXX does this simply duplicate the memory needlessly?  we recreate these lines
    90   // in reload_images.  If we had saved the line numbers, we could avoid this
    91   // vtable points *another* copy of the subset rows
    92   // (the later call to 'reload_images' copies the subset elements back on top of
    93   // the rows of the vtable)
    94   // gfits_vtable_from_ftable (&db[0].ftable, &db[0].vtable, LineNumber, Nsubset);
    95   // MARKTIME("converted ftable to vtable: %f sec\n", dtime);
    96 
    9787  // save the subset of images in the static reference in ImageOps, set up indexes
    9888  initImages (subset, LineNumber, Nsubset);
Note: See TracChangeset for help on using the changeset viewer.