IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36084


Ignore:
Timestamp:
Aug 31, 2013, 5:31:39 AM (13 years ago)
Author:
eugene
Message:

merge changes from EAM branch (medianfilter list error; handle empty kapa message; add join and vlist cmds, match2d help, excel-style lists: foo:A equiv to foo:0, time-based dvo temp-file purging, fix avmatch parallel coordlist bug, sub-pixel resolve sersic model, dgaussjordan needs larger dynamic range, avextract psfqf, psfqfperf, stargal)

Location:
trunk/Ohana
Files:
27 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/dvomerge

  • trunk/Ohana/src/dvomerge/src/dvoverify_catalogs.c

    r34405 r36084  
    143143      continue;
    144144    }
    145     fscanf (results, "%*s %d %*s %d", &NbadHost, &NNotSortedHost);
     145    int Nresults = fscanf (results, "%*s %d %*s %d", &NbadHost, &NNotSortedHost);
     146    if (Nresults != 2) {
     147      fprintf (stderr, "warning: failure scanning results\n");
     148      fclose (results);
     149      continue;
     150    }
    146151    *Nbad += NbadHost;
    147152    NNotSorted += NNotSortedHost;
  • trunk/Ohana/src/getstar/src/dvoImagesAtCoords.c

    r36057 r36084  
    1616  int status;
    1717  Image *dbImages;
    18   int Npoints;
    1918  FITS_DB db;
    2019
     
    2524  Point *points;
    2625  int readStdin = 0;
     26  int Npoints = 0;
    2727  if (coordsFile) {
    2828      if (strcmp(coordsFile, "-") == 0) {
  • trunk/Ohana/src/kapa2/include/constants.h

    r35766 r36084  
    1515// XXX for the moment, this is set to match the values in SetColorScale3D_CC
    1616# define NPIXELS_STATIC 128
    17 // # define NPIXELS_STATIC 1000
     17// # define NPIXELS_STATIC 4600 -- if we want fullcolor to work, need this
    1818
    1919# define PAD1  3
  • trunk/Ohana/src/libdvo/include/dvo.h

    r35755 r36084  
    696696void sort_coords_index (double *X, double *Y, off_t *S, off_t N);
    697697void sort_coords_indexonly (double *X, double *Y, off_t *S, off_t N);
     698void sort_IDs_indexonly (opihi_int *X, off_t *S, off_t N);
    698699void sort_regions (SkyRegion *region, off_t N);
    699700
  • trunk/Ohana/src/libdvo/include/dvodb.h

    r35416 r36084  
    174174      AVE_TMEAN,
    175175      AVE_TRANGE,
     176      AVE_PSF_QF,
     177      AVE_PSF_QF_PERF,
     178      AVE_STARGAL,
    176179      AVE_Xp,
    177180      AVE_NMEAS,
  • trunk/Ohana/src/libdvo/src/dbExtractAverages.c

    r35416 r36084  
    151151    case AVE_TRANGE:
    152152      value.Flt = TimeValue (average[0].Trange, 0, TimeFormat);
     153      break;
     154
     155    case AVE_PSF_QF:
     156      value.Flt = average[0].psfQF;
     157      break;
     158    case AVE_PSF_QF_PERF:
     159      value.Flt = average[0].psfQFperf;
     160      break;
     161    case AVE_STARGAL:
     162      value.Flt = average[0].stargal;
    153163      break;
    154164
  • trunk/Ohana/src/libdvo/src/dbFields.c

    r35416 r36084  
    314314  }
    315315
    316   if (!strcasecmp (fieldName, "RA"))        ESCAPE (AVE_RA,        MAG_NONE, OPIHI_FLT);
    317   if (!strcasecmp (fieldName, "DEC"))       ESCAPE (AVE_DEC,       MAG_NONE, OPIHI_FLT);
    318   if (!strcasecmp (fieldName, "GLON"))      ESCAPE (AVE_GLON,      MAG_NONE, OPIHI_FLT);
    319   if (!strcasecmp (fieldName, "GLAT"))      ESCAPE (AVE_GLAT,      MAG_NONE, OPIHI_FLT);
    320   if (!strcasecmp (fieldName, "ELON"))      ESCAPE (AVE_ELON,      MAG_NONE, OPIHI_FLT);
    321   if (!strcasecmp (fieldName, "ELAT"))      ESCAPE (AVE_ELAT,      MAG_NONE, OPIHI_FLT);
    322   if (!strcasecmp (fieldName, "dRA"))       ESCAPE (AVE_RA_ERR,    MAG_NONE, OPIHI_FLT);
    323   if (!strcasecmp (fieldName, "dDEC"))      ESCAPE (AVE_DEC_ERR,   MAG_NONE, OPIHI_FLT);
    324   if (!strcasecmp (fieldName, "uRA"))       ESCAPE (AVE_U_RA,      MAG_NONE, OPIHI_FLT);
    325   if (!strcasecmp (fieldName, "uDEC"))      ESCAPE (AVE_U_DEC,     MAG_NONE, OPIHI_FLT);
    326   if (!strcasecmp (fieldName, "duRA"))      ESCAPE (AVE_U_RA_ERR,  MAG_NONE, OPIHI_FLT);
    327   if (!strcasecmp (fieldName, "duDEC"))     ESCAPE (AVE_U_DEC_ERR, MAG_NONE, OPIHI_FLT);
    328   if (!strcasecmp (fieldName, "PAR"))       ESCAPE (AVE_PAR,       MAG_NONE, OPIHI_FLT);
    329   if (!strcasecmp (fieldName, "dPAR"))      ESCAPE (AVE_PAR_ERR,   MAG_NONE, OPIHI_FLT);
    330   if (!strcasecmp (fieldName, "ChiSqPos"))  ESCAPE (AVE_CHISQ_POS, MAG_NONE, OPIHI_FLT);
    331   if (!strcasecmp (fieldName, "ChiSqPM"))   ESCAPE (AVE_CHISQ_PM,  MAG_NONE, OPIHI_FLT);
    332   if (!strcasecmp (fieldName, "ChiSqPar"))  ESCAPE (AVE_CHISQ_PAR, MAG_NONE, OPIHI_FLT);
    333   if (!strcasecmp (fieldName, "Tmean"))     ESCAPE (AVE_TMEAN,     MAG_NONE, OPIHI_FLT);
    334   if (!strcasecmp (fieldName, "Trange"))    ESCAPE (AVE_TRANGE,    MAG_NONE, OPIHI_FLT);
    335   if (!strcasecmp (fieldName, "NMEAS"))     ESCAPE (AVE_NMEAS,     MAG_NONE, OPIHI_INT);
    336   if (!strcasecmp (fieldName, "NMISS"))     ESCAPE (AVE_NMISS,     MAG_NONE, OPIHI_INT);
    337   if (!strcasecmp (fieldName, "NPOS"))      ESCAPE (AVE_NPOS,      MAG_NONE, OPIHI_INT);
    338   if (!strcasecmp (fieldName, "NASTROM"))   ESCAPE (AVE_NPOS,      MAG_NONE, OPIHI_INT);
    339   if (!strcasecmp (fieldName, "FLAGS"))     ESCAPE (AVE_OBJ_FLAGS, MAG_NONE, OPIHI_INT);
    340   if (!strcasecmp (fieldName, "OBJ_FLAGS")) ESCAPE (AVE_OBJ_FLAGS, MAG_NONE, OPIHI_INT);
    341   if (!strcasecmp (fieldName, "OBJFLAGS"))  ESCAPE (AVE_OBJ_FLAGS, MAG_NONE, OPIHI_INT);
    342   if (!strcasecmp (fieldName, "OBJID"))     ESCAPE (AVE_OBJID,     MAG_NONE, OPIHI_INT);
    343   if (!strcasecmp (fieldName, "CATID"))     ESCAPE (AVE_CATID,     MAG_NONE, OPIHI_INT);
    344   if (!strcasecmp (fieldName, "EXTID_HI"))  ESCAPE (AVE_EXTID_HI,  MAG_NONE, OPIHI_INT);
    345   if (!strcasecmp (fieldName, "EXTID_LO"))  ESCAPE (AVE_EXTID_LO,  MAG_NONE, OPIHI_INT);
     316  if (!strcasecmp (fieldName, "RA"))          ESCAPE (AVE_RA,          MAG_NONE, OPIHI_FLT);
     317  if (!strcasecmp (fieldName, "DEC"))         ESCAPE (AVE_DEC,         MAG_NONE, OPIHI_FLT);
     318  if (!strcasecmp (fieldName, "GLON"))        ESCAPE (AVE_GLON,        MAG_NONE, OPIHI_FLT);
     319  if (!strcasecmp (fieldName, "GLAT"))        ESCAPE (AVE_GLAT,        MAG_NONE, OPIHI_FLT);
     320  if (!strcasecmp (fieldName, "ELON"))        ESCAPE (AVE_ELON,        MAG_NONE, OPIHI_FLT);
     321  if (!strcasecmp (fieldName, "ELAT"))        ESCAPE (AVE_ELAT,        MAG_NONE, OPIHI_FLT);
     322  if (!strcasecmp (fieldName, "dRA"))         ESCAPE (AVE_RA_ERR,      MAG_NONE, OPIHI_FLT);
     323  if (!strcasecmp (fieldName, "dDEC"))        ESCAPE (AVE_DEC_ERR,     MAG_NONE, OPIHI_FLT);
     324  if (!strcasecmp (fieldName, "uRA"))         ESCAPE (AVE_U_RA,        MAG_NONE, OPIHI_FLT);
     325  if (!strcasecmp (fieldName, "uDEC"))        ESCAPE (AVE_U_DEC,       MAG_NONE, OPIHI_FLT);
     326  if (!strcasecmp (fieldName, "duRA"))        ESCAPE (AVE_U_RA_ERR,    MAG_NONE, OPIHI_FLT);
     327  if (!strcasecmp (fieldName, "duDEC"))       ESCAPE (AVE_U_DEC_ERR,   MAG_NONE, OPIHI_FLT);
     328  if (!strcasecmp (fieldName, "PAR"))         ESCAPE (AVE_PAR,         MAG_NONE, OPIHI_FLT);
     329  if (!strcasecmp (fieldName, "dPAR"))        ESCAPE (AVE_PAR_ERR,     MAG_NONE, OPIHI_FLT);
     330  if (!strcasecmp (fieldName, "ChiSqPos"))    ESCAPE (AVE_CHISQ_POS,   MAG_NONE, OPIHI_FLT);
     331  if (!strcasecmp (fieldName, "ChiSqPM"))     ESCAPE (AVE_CHISQ_PM,    MAG_NONE, OPIHI_FLT);
     332  if (!strcasecmp (fieldName, "ChiSqPar"))    ESCAPE (AVE_CHISQ_PAR,   MAG_NONE, OPIHI_FLT);
     333  if (!strcasecmp (fieldName, "Tmean"))       ESCAPE (AVE_TMEAN,       MAG_NONE, OPIHI_FLT);
     334  if (!strcasecmp (fieldName, "Trange"))      ESCAPE (AVE_TRANGE,      MAG_NONE, OPIHI_FLT);
     335  if (!strcasecmp (fieldName, "psfqf"))       ESCAPE (AVE_PSF_QF,      MAG_NONE, OPIHI_FLT);
     336  if (!strcasecmp (fieldName, "psfqfperf"))   ESCAPE (AVE_PSF_QF_PERF, MAG_NONE, OPIHI_FLT);
     337  if (!strcasecmp (fieldName, "psf_qf"))      ESCAPE (AVE_PSF_QF,      MAG_NONE, OPIHI_FLT);
     338  if (!strcasecmp (fieldName, "psf_qf_perf")) ESCAPE (AVE_PSF_QF_PERF, MAG_NONE, OPIHI_FLT);
     339  if (!strcasecmp (fieldName, "stargal"))     ESCAPE (AVE_STARGAL,     MAG_NONE, OPIHI_FLT);
     340  if (!strcasecmp (fieldName, "NMEAS"))       ESCAPE (AVE_NMEAS,       MAG_NONE, OPIHI_INT);
     341  if (!strcasecmp (fieldName, "NMISS"))       ESCAPE (AVE_NMISS,       MAG_NONE, OPIHI_INT);
     342  if (!strcasecmp (fieldName, "NPOS"))        ESCAPE (AVE_NPOS,        MAG_NONE, OPIHI_INT);
     343  if (!strcasecmp (fieldName, "NASTROM"))     ESCAPE (AVE_NPOS,        MAG_NONE, OPIHI_INT);
     344  if (!strcasecmp (fieldName, "FLAGS"))       ESCAPE (AVE_OBJ_FLAGS,   MAG_NONE, OPIHI_INT);
     345  if (!strcasecmp (fieldName, "OBJ_FLAGS"))   ESCAPE (AVE_OBJ_FLAGS,   MAG_NONE, OPIHI_INT);
     346  if (!strcasecmp (fieldName, "OBJFLAGS"))    ESCAPE (AVE_OBJ_FLAGS,   MAG_NONE, OPIHI_INT);
     347  if (!strcasecmp (fieldName, "OBJID"))       ESCAPE (AVE_OBJID,       MAG_NONE, OPIHI_INT);
     348  if (!strcasecmp (fieldName, "CATID"))       ESCAPE (AVE_CATID,       MAG_NONE, OPIHI_INT);
     349  if (!strcasecmp (fieldName, "EXTID_HI"))    ESCAPE (AVE_EXTID_HI,    MAG_NONE, OPIHI_INT);
     350  if (!strcasecmp (fieldName, "EXTID_LO"))    ESCAPE (AVE_EXTID_LO,    MAG_NONE, OPIHI_INT);
    346351
    347352  // check for code:mode in photcode name
  • trunk/Ohana/src/libdvo/src/dvosorts.c

    r35263 r36084  
    6060
    6161/* sort a coordinate pair (X,Y) and the associated index (S) */
     62void sort_IDs_indexonly (opihi_int *X, off_t *S, off_t N) {
     63 
     64# define SWAPFUNC(A,B){ off_t itmp; \
     65  itmp = S[A]; S[A] = S[B]; S[B] = itmp; \
     66}
     67# define COMPARE(A,B)(X[S[A]] < X[S[B]])
     68
     69  OHANA_SORT (N, COMPARE, SWAPFUNC);
     70
     71# undef SWAPFUNC
     72# undef COMPARE
     73
     74}
     75
     76/* sort a coordinate pair (X,Y) and the associated index (S) */
    6277void sort_coords_indexonly (double *X, double *Y, off_t *S, off_t N) {
    6378 
  • trunk/Ohana/src/libkapa/src/IOfuncs.c

    r35761 r36084  
    5454  va_end (argp);
    5555
    56   if (!Nbyte) return (FALSE);
     56  if (!Nbyte) {
     57    KiiSendCommand (device, 16, "LEN: %11d", 0);
     58    return (FALSE);
     59  }
    5760
    5861  /* the message may contain up to 99,999,999,999 bytes (100MB) */
     
    8487  /* find the message length, allocate space */
    8588  sscanf (buffer, "%*s %d", &Nbytes);
     89  if (Nbytes == 0) {
     90    return TRUE;
     91  }
     92
    8693  ALLOCATE (message, char, Nbytes + 1);
    8794  memset (message, 0, Nbytes + 1);
     95
    8896
    8997  /* read Nbytes from the device */
  • trunk/Ohana/src/libohana/src

  • trunk/Ohana/src/libohana/src/gaussj.c

    r24080 r36084  
    11# include <ohana.h>
    22# define GROWTHTEST 0
    3 # define MAX_RANGE 1.0e7
     3# define MAX_RANGE 1.0e9
    44
    55// Gauss-Jordan elimination using full pivots based on Press et al's description.  Substantially
     
    9191    /* rescale by pivot reciprocal */
    9292    double tmpval = 1.0 / A[maxcol][maxcol];
     93    // XXX why is this here (don't I double count this element?) A[maxcol][maxcol] = 1.0;
    9394    A[maxcol][maxcol] = 1.0;
    9495    for (col = 0; col < N; col++) A[maxcol][col] *= tmpval;
     
    117118    }
    118119  }
     120
     121# if (GROWTHTEST)
     122    fprintf (stderr, "final A matrix:\n");
     123    for (row = 0; row < N; row++) {
     124        for (col = 0; col < N; col++) {
     125            fprintf (stderr, "%10.3e ", A[row][col]);
     126        }
     127        fprintf (stderr, "\n");
     128    }
     129    fprintf (stderr, "\n");
     130# endif
    119131
    120132  // swap back the inverse matrix based on the row swaps above
  • trunk/Ohana/src/opihi

  • trunk/Ohana/src/opihi/cmd.astro

  • trunk/Ohana/src/opihi/cmd.astro/Makefile

    r35416 r36084  
    6060$(SRC)/scale.$(ARCH).o             \
    6161$(SRC)/sexigesimal.$(ARCH).o       \
     62$(SRC)/sersic.$(ARCH).o    \
    6263$(SRC)/spec.$(ARCH).o              \
    6364$(SRC)/specpairfit.$(ARCH).o       \
  • trunk/Ohana/src/opihi/cmd.astro/init.c

    r35757 r36084  
    4949int scale                   PROTO((int, char **));
    5050int sexigesimal             PROTO((int, char **));
     51int sersic                  PROTO((int, char **));
    5152int spec                    PROTO((int, char **));
    5253int specpairfit             PROTO((int, char **));
     
    107108  {1, "scale",       scale,        "get / set real bzero / bscale values"},
    108109  {1, "sexigesimal", sexigesimal,  "convert to/from sexigesimal/decimal"},
     110  {1, "sersic",      sersic,       "generate sub-pixel resolved sersic model"},
    109111  {1, "spec",        spec,         "extract a spectrum"},
    110112  {1, "specpairfit", specpairfit,  "fit spectrum to another spectrum"},
  • trunk/Ohana/src/opihi/cmd.basic/list.c

    r33662 r36084  
    22# define D_NLINES 100
    33static char prompt[] = ">> ";
     4
     5static int set_list_varname (char *line, char *base, int N, int excelStyle);
    46
    57int list (int argc, char **argv) {
     
    2123  }
    2224
     25  int EXCEL_STYLE = FALSE;
     26  if ((N = get_argument (argc, argv, "-excel-style"))) {
     27    remove_argument (N, &argc, argv);
     28    EXCEL_STYLE = TRUE;
     29  }
     30  if ((N = get_argument (argc, argv, "-excel"))) {
     31    remove_argument (N, &argc, argv);
     32    EXCEL_STYLE = TRUE;
     33  }
     34
    2335  if ((N = get_argument (argc, argv, "-vectors"))) {
    2436    remove_argument (N, &argc, argv);
     
    4961   
    5062    for (i = 0; i < argc - 3; i++) {
    51       sprintf (line, "%s:%d", argv[1], i);
     63      set_list_varname (line, argv[1], i, EXCEL_STYLE);
    5264      set_str_variable (line, argv[i+3]);
    5365    }
     
    8395        if (!word) break;
    8496       
    85         sprintf (line, "%s:%d", argv[1], nWords);
     97        // sprintf (line, "%s:%d", argv[1], nWords);
     98        set_list_varname (line, argv[1], nWords, EXCEL_STYLE);
     99
    86100        set_str_variable (line, word);
    87101        FREE (word);
     
    120134      sprintf (line, "%s:%d", argv[3], i);
    121135      value = get_variable (line);
    122       sprintf (line, "%s:%d", argv[1], i);
     136      // sprintf (line, "%s:%d", argv[1], i);
     137      set_list_varname (line, argv[1], i, EXCEL_STYLE);
    123138      set_str_variable (line, value);
    124139    }
     
    136151    N = get_int_variable (line, &found);
    137152    for (i = 0; i < argc - 3; i++) {
    138       sprintf (line, "%s:%d", argv[1], N + i);
     153      // sprintf (line, "%s:%d", argv[1], N + i);
     154      set_list_varname (line, argv[1], N + i, EXCEL_STYLE);
    139155      set_str_variable (line, argv[i+3]);
    140156    }
     
    159175    N = get_int_variable (line, &found);
    160176    for (i = 0; i < N; i++) {
    161       sprintf (line, "%s:%d", argv[1], i);
     177      // sprintf (line, "%s:%d", argv[1], i);
     178      set_list_varname (line, argv[1], i, EXCEL_STYLE);
    162179      value = get_variable (line);
    163180      if (value == NULL) continue;
     
    165182        free (value);
    166183        for (j = i + 1; j < N; j++) {
    167           sprintf (line2, "%s:%d", argv[1], j);
     184          // sprintf (line2, "%s:%d", argv[1], j);
     185          set_list_varname (line2, argv[1], j, EXCEL_STYLE);
    168186          next_value = get_variable (line2);
    169187          set_str_variable (line, next_value);
     
    235253      if (B != (char *) NULL) { *B = 0; }
    236254      if (*A != 0) {
    237         sprintf (line, "%s:%d", argv[1], i);
     255        // sprintf (line, "%s:%d", argv[1], i);
     256        set_list_varname (line, argv[1], i, EXCEL_STYLE);
    238257        set_str_variable (line, A);
    239258        A = B + 1;
     
    283302
    284303    if (*input) {
    285       sprintf (line, "%s:%d", argv[1], i);
     304      // sprintf (line, "%s:%d", argv[1], i);
     305      set_list_varname (line, argv[1], i, EXCEL_STYLE);
    286306      set_str_variable (line, input);
    287307      free (input);
    288308      i++;
    289    }
     309    }
    290310  }
    291311  return (TRUE);
    292312}
     313
     314static int set_list_varname (char *line, char *base, int N, int excelStyle) {
     315
     316  int i;
     317   
     318  // A-Z correspond to 0 - 25
     319
     320  if (excelStyle) {
     321    float f = log(26.0);
     322    float g = (N == 0) ? 0.0 : log(1.0*N);
     323    int Ndigit = (int) (g / f) + 1;
     324    if (Ndigit > 10) {
     325      sprintf (line, "%s:ZZZZZZZZZZ", base);
     326      return FALSE;
     327    }
     328    char name[12];
     329    memset (name, 0, 12);
     330    for (i = 0; i < Ndigit; i++) {
     331      float Npow = Ndigit - i - 1;
     332      float g = pow(26.0, Npow);
     333      int V = (int) (N / g);
     334      name[i] = (Npow == 0.0) ? 'A' + V : 'A' + V - 1;
     335      N -= V * g;
     336    }
     337    sprintf (line, "%s:%s", base, name);
     338  } else {
     339    sprintf (line, "%s:%d", base, N);
     340  }
     341  return TRUE;
     342}
  • trunk/Ohana/src/opihi/cmd.data

  • trunk/Ohana/src/opihi/cmd.data/Makefile

    r35416 r36084  
    6666$(SRC)/integrate.$(ARCH).o      \
    6767$(SRC)/interpolate.$(ARCH).o    \
     68$(SRC)/join.$(ARCH).o           \
    6869$(SRC)/jpeg.$(ARCH).o           \
    6970$(SRC)/kern.$(ARCH).o           \
     
    143144$(SRC)/vmaxwell.$(ARCH).o          \
    144145$(SRC)/vgrid.$(ARCH).o             \
     146$(SRC)/vlist.$(ARCH).o             \
    145147$(SRC)/vload.$(ARCH).o             \
    146148$(SRC)/vzload.$(ARCH).o            \
  • trunk/Ohana/src/opihi/cmd.data/init.c

    r35416 r36084  
    5555int integrate        PROTO((int, char **));
    5656int interpolate      PROTO((int, char **));
     57int join             PROTO((int, char **));
    5758int jpeg             PROTO((int, char **));
    5859int kern             PROTO((int, char **));
     
    133134int vmaxwell         PROTO((int, char **));
    134135int vload            PROTO((int, char **));
     136int vlist            PROTO((int, char **));
    135137int vzload           PROTO((int, char **));
    136138int vstats           PROTO((int, char **));
     
    209211  {1, "integrate",    integrate,        "integrate a vector"},
    210212  {1, "interpolate",  interpolate,      "interpolate between vector pairs"},
     213  {1, "join",         join,             "find the join of two ID vectors"},
    211214  {1, "jpeg",         jpeg,             "convert display image to JPEG"},
    212215  {1, "kern",         kern,             "convolve with 3x3 kernel"},
     
    290293  {1, "vgrid",        vgrid,            "generate an image from a triplet of vectors"},
    291294  {1, "vhistogram",   histogram,        "generate histogram from vector"},
     295  {1, "vlist",        vlist,            "append values to a vector from command line"},
    292296  {1, "vload",        vload,            "load vectors as overlay on image display"},
    293297  {1, "vmaxwell",     vmaxwell,         "fit a Maxwellian to a vector"},
  • trunk/Ohana/src/opihi/cmd.data/match2d.c

    r33963 r36084  
    1414  Vector *index1, *index2;
    1515
     16  if ((N = get_argument (argc, argv, "-h"))) goto usage;
     17  if ((N = get_argument (argc, argv, "--help"))) goto usage;
     18
    1619  CLOSEST = FALSE;
    1720  if ((N = get_argument (argc, argv, "-closest"))) {
     
    3841  if (argc != 6) {
    3942    gprint (GP_ERR, "USAGE: match2d X1 Y1 X2 Y2 Radius [-index1 (index1)] [-index2 (index2)] [-closest]\n");
    40     gprint (GP_ERR, "  if -closest is provided, index1 & index2 will have the same length as X1 and X2 (respectively)\n");
    41     gprint (GP_ERR, "    with either the index of the match or a value of -1 for non-matches\n");
     43    gprint (GP_ERR, "  use -h or --help for more detail\n");
    4244    return (FALSE);
    4345  }
     
    9092
    9193  return (TRUE);
     94
     95usage:
     96  gprint (GP_ERR, "we have two modes of operation:\n\n");
     97
     98  gprint (GP_ERR, "without -closest, we are finding all matched pairs within the match radius.  in this\n");
     99  gprint (GP_ERR, "case, the two index vectors have the same length, one entry per matched pair.\n");
     100  gprint (GP_ERR, "x1[index1],y1[index1] matches to x2[index2],y2[index2].\n\n");
     101
     102  gprint (GP_ERR, "with -closest selected, we are finding the closest element of set 1 to each of set 2\n");
     103  gprint (GP_ERR, "and vice versa.  in this case, index1 is always the same length as x1,y1, while index2\n");
     104  gprint (GP_ERR, "is the same lengths as x2,y2.  x2[index1],y2[index1] matches x1,y1 while\n");
     105  gprint (GP_ERR, "x1[index2],y1[index2] matches x2,y2\n\n");
     106
     107  gprint (GP_ERR, "if -index1 or -index2 is not supplied, the vectors are created with names index1 or index2\n");
     108  gprint (GP_ERR, "use 'reindex' to generate new vectors based on these index vectors\n");
     109
     110  return FALSE;
    92111}
    93112
  • trunk/Ohana/src/opihi/dvo/avmatch.c

    r35416 r36084  
    7070  dbExtractAveragesInit ();
    7171
    72   // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
    7372  RAvec  = NULL;
    7473  DECvec = NULL;
    75   if (PARALLEL && !HOST_ID) {
    76     if (!CoordsFile) {
    77       // get vectors corresponding to coordinates of interest
    78       if ((RAvec  = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto help;
    79       if ((DECvec = SelectVector (argv[2], ANYVECTOR, TRUE)) == NULL) goto help;
    80      
    81       ALLOCATE (vec, Vector *, 2);
    82       vec[0] = RAvec;
    83       vec[1] = DECvec;
    84 
    85       CoordsFile = abspath("coords.fits", 1024);
    86       int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, NULL);
    87       if (!status) goto escape;
    88     }
    89 
    90     char *targv1 = argv[1];
    91     char *targv2 = argv[2];
    92     argv[1] = strcreate ("-coords");
    93     argv[2] = strcreate (CoordsFile);
    94     free (CoordsFile);
    95 
    96     // I need to pass the RA & DEC vectors to the remote clients...
    97     int status = HostTableParallelOps (skylist, argc, argv, RESULT_FILE, TRUE, RAvec->Nelements, VERBOSE);
    98     if (vec) free (vec);
    99    
    100     free (argv[1]);
    101     free (argv[2]);
    102     argv[1] = targv1;
    103     argv[2] = targv2;
    104 
    105     return status;
    106   }
    107 
    10874  // get vectors corresponding to coordinates of interest
    10975  if (CoordsFile) {
     
    12086    remove_argument (1, &argc, argv);
    12187  }
     88
     89  /* load regions which contain all supplied RA,DEC coordinates */
     90  if ((skylist = SelectRegionsByCoordVectors (RAvec, DECvec)) == NULL) goto escape;
     91
     92  // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
     93  if (PARALLEL && !HOST_ID) {
     94
     95    // We need to copy the args to a temp array and modify them so that we send the
     96    // correct set to the remote client.  The args list looks like this:
     97    // if (!CoordsFile) : avmatch (RADIUS) field, ... [we removed RA & DEC above]
     98    // if ( CoordsFile) : avmatch (RADIUS) field, ... [because we stripped off the -coords filename elements]
     99
     100    // allocate the temp array and copy all but (RA) (DEC)
     101    int targc = 0;
     102    char **targv = NULL;
     103    ALLOCATE (targv, char *, argc + 2);
     104    for (i = 0; i < argc; i++) {
     105      targv[targc] = strcreate (argv[i]);
     106      targc ++;
     107    }
     108
     109    // if not specified, create the coords.fits input file
     110    // NOTE: RAvec, DECvec were set above
     111    if (!CoordsFile) {
     112      ALLOCATE (vec, Vector *, 2);
     113      vec[0] = RAvec;
     114      vec[1] = DECvec;
     115
     116      CoordsFile = abspath("coords.fits", 1024);
     117      int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, NULL);
     118      if (!status) goto escape;
     119    }
     120
     121    // add the coords file to the args list
     122    targv[targc+0] = strcreate ("-coords");
     123    targv[targc+1] = CoordsFile; // this gets freed with targv
     124    targc += 2;
     125   
     126    // I need to pass the RA & DEC vectors to the remote clients...
     127    int status = HostTableParallelOps (skylist, targc, targv, RESULT_FILE, TRUE, RAvec->Nelements, VERBOSE);
     128    if (vec) free (vec);
     129   
     130    // free up targv
     131    for (i = 0; i < targc; i++) {
     132      free (targv[i]);
     133    }
     134    free (targv);
     135
     136    return status;
     137  }
     138
    122139  RADIUS = atof (argv[1]);
    123140  remove_argument (1, &argc, argv);
     
    140157    if (fields[i].photcode[0].type == PHOT_DEP) needMeasures = TRUE;
    141158  }
    142 
    143   /* load regions which contain all supplied RA,DEC coordinates */
    144   if ((skylist = SelectRegionsByCoordVectors (RAvec, DECvec)) == NULL) goto escape;
    145159
    146160  /* create output storage vectors */
  • trunk/Ohana/src/opihi/dvo/hosts.c

    r35757 r36084  
    1212    gprint (GP_ERR, "  commands:\n");
    1313    gprint (GP_ERR, "    purge-temp : delete all tempfiles for this shell\n");
    14     gprint (GP_ERR, "               : [-old-pid] [-all-pid] [-v] [-verbose] [-commit] [-type type]\n");
     14    gprint (GP_ERR, "               : [-old-pid] [-all-pid] [-v] [-verbose] [-commit] [-type type] [-age hours]\n");
    1515    gprint (GP_ERR, "    get-results : determine name of RESULTS file\n");
    1616    return FALSE;
     
    3333    }
    3434   
     35    struct timeval now;
     36    gettimeofday (&now, NULL);
     37
     38    float AGE = 0;
     39    int NOW = now.tv_sec;
     40    if ((N = get_argument (argc, argv, "-age"))) {
     41      remove_argument (N, &argc, argv);
     42      AGE = atof(argv[N]);
     43      remove_argument (N, &argc, argv);
     44    }
     45
    3546    int VERBOSE = FALSE;
    3647    if ((N = get_argument (argc, argv, "-v"))) {
     
    121132      glob (name, 0, NULL, &pglob);
    122133      int j;
     134      struct stat filestats;
    123135      for (j = 0; j < pglob.gl_pathc; j++) {
     136        if (AGE > 0) {
     137          if (stat(pglob.gl_pathv[j], &filestats)) {
     138            gprint (GP_ERR, "failed to get stats for %s\n", pglob.gl_pathv[j]);
     139            continue;
     140          }
     141          float myAge = (NOW - filestats.st_mtime) / 3600.0;
     142          if (myAge < AGE) continue;
     143        }
    124144        if (VERBOSE) gprint (GP_ERR, "unlink %s\n", pglob.gl_pathv[j]);
    125145        if (!DRYRUN) unlink (pglob.gl_pathv[j]);
  • trunk/Ohana/src/opihi/lib.shell/ListOps.c

    r33963 r36084  
    189189int is_list_data (char *line) {
    190190
    191   char *comm, *temp;
    192 
    193   temp = thisword (nextword (nextword (line)));
    194   comm = thisword (line);
    195 
     191  char *comm = NULL;
     192  char *temp = NULL;
     193  char *ptr  = NULL;
     194
     195  comm = thisword (line);
    196196  if (comm == NULL) goto escape;
    197 
    198197  if (strcmp (comm, "list")) goto escape;
     198
     199  ptr = nextword (line);
     200  if (!strncmp("-excel", ptr, strlen("-excel"))) ptr = nextword (ptr);
     201  if (!strncmp("-excel-style", ptr, strlen("-excel-style"))) ptr = nextword (ptr);
     202  ptr = nextword (ptr);
     203  if (!strncmp("-excel", ptr, strlen("-excel"))) ptr = nextword (ptr);
     204  if (!strncmp("-excel-style", ptr, strlen("-excel-style"))) ptr = nextword (ptr);
     205  temp = thisword (ptr);
    199206
    200207  /* if (cond) (command) does not define a complete block */
  • trunk/Ohana/src/relastro/src

  • trunk/Ohana/src/tools/src/medianfilter.c

    r20652 r36084  
    9696    for (j = 0; j < Npixrd; j++, O++) {
    9797      Nvalid = 0;
     98      int debug = FALSE && (n == 5) && (j >= 1776779) && (j <= 1776789);
    9899      for (k = 0; k < Nfiles; k++) {
    99100        v = (float *)tmpmatr[k].buffer;
     101        if (debug) {
     102            fprintf (stderr, "%8.2f ", v[j]);
     103        }
    100104        if (v[j] < MinValid) continue;
    101         if (isnan(v[j])) continue;
    102         if (isinf(v[j])) continue;
    103         list[k] = v[j];
     105        if (isnan(v[j])) {
     106            continue;
     107        }
     108        if (isinf(v[j])) {
     109            continue;
     110        }
     111        list[Nvalid] = v[j];
    104112        Nvalid ++;
    105113      }
     114      if (debug) fprintf (stderr, "\n");
    106115      if (Nvalid == 0) {
    107116        *O = 0.0;
     117        if (debug) {
     118            fprintf (stderr, "Nvalid is 0\n");
     119        }
    108120        continue;
    109121      }
     
    111123      sum = 0;
    112124      Nval = 0;
     125      if (debug) fprintf (stderr, "list : ");
    113126      for (k = fmin*Nvalid; k < fmax*Nvalid; k++) {
     127        if (debug) {
     128            fprintf (stderr, "%8.2f ", list[k]);
     129        }
    114130        sum += list[k];
    115131        Nval ++;
    116132      }
    117133      *O = (sum / Nval);
     134      if (debug) {
     135          fprintf (stderr, " = %f / %f = %f\n", sum, Nval, *O);
     136          fprintf (stderr, "\n");
     137      }
    118138    }
    119139
Note: See TracChangeset for help on using the changeset viewer.