IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 29, 2006, 4:05:29 PM (20 years ago)
Author:
eugene
Message:

fixed line, added cumulative histogram

Location:
trunk/Ohana/src/opihi/cmd.data
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.data/init.c

    r10073 r10307  
    1313int contour          PROTO((int, char **));
    1414int create           PROTO((int, char **));
     15int cumulative       PROTO((int, char **));
    1516int cursor           PROTO((int, char **));
    1617int cut              PROTO((int, char **));
     
    124125  {"contour",      contour,          "create contour from image"},
    125126  {"create",       create,           "create a new vector"},
     127  {"cumulative",   cumulative,       "build a cumulative histogram from a specific histogram"},
    126128  {"cursor",       cursor,           "get coords from cursor"},
    127129  {"cut",          cut,              "extract a cut across an image"},
  • trunk/Ohana/src/opihi/cmd.data/line.c

    r7917 r10307  
    55  int N, Npts;
    66  Graphdata graphmode;
    7   Vector *vecx, *vecy, *dxm, *dxp, *dym, *dyp;
     7  float x[2], y[2];
    88
    99  if (!style_args (&graphmode, &argc, argv, -1)) return FALSE;
    1010
    11   /* decide on error bars */
    12   dxm = dxp = dym = dyp = NULL;
    13   if ((N = get_argument (argc, argv, "-dx"))) {
    14     remove_argument (N, &argc, argv);
    15     if ((dxm = SelectVector (argv[N], OLDVECTOR, TRUE)) == NULL) return (FALSE);
    16     remove_argument (N, &argc, argv);
    17   }
    18   if ((N = get_argument (argc, argv, "+dx"))) {
    19     remove_argument (N, &argc, argv);
    20     if ((dxp = SelectVector (argv[N], OLDVECTOR, TRUE)) == NULL) return (FALSE);
    21     remove_argument (N, &argc, argv);
    22   }
    23   if ((N = get_argument (argc, argv, "-dy"))) {
    24     remove_argument (N, &argc, argv);
    25     if ((dym = SelectVector (argv[N], OLDVECTOR, TRUE)) == NULL) return (FALSE);
    26     remove_argument (N, &argc, argv);
    27   }
    28   if ((N = get_argument (argc, argv, "+dy"))) {
    29     remove_argument (N, &argc, argv);
    30     if ((dyp = SelectVector (argv[N], OLDVECTOR, TRUE)) == NULL) return (FALSE);
    31     remove_argument (N, &argc, argv);
    32   }
    33 
    34   if (argc != 3) {
    35     gprint (GP_ERR, "USAGE: plot <x> <y>\n");
     11  if (argc != 6) {
     12    gprint (GP_ERR, "USAGE: line <x> <y> to <x> <y>\n");
    3613    return (FALSE);
    3714  }
     15  x[0] = atof(argv[1]);
     16  y[0] = atof(argv[2]);
     17  x[1] = atof(argv[4]);
     18  y[1] = atof(argv[5]);
     19
    3820  SetGraph (graphmode);
    3921
    40   /* set errorbar mode (these are NOT sticky) */
     22  /* set point style and errorbar mode (these are NOT sticky) */
     23  graphmode.style = 0;
    4124  graphmode.etype = 0;
    42   if ((dym != NULL) && (dyp == NULL)) dyp = dym;
    43   if ((dyp != NULL) && (dym == NULL)) dym = dyp;
    44   if ((dyp != NULL) || (dym != NULL)) graphmode.etype |= 0x01;
    45   if ((dxm != NULL) && (dxp == NULL)) dxp = dxm;
    46   if ((dxp != NULL) && (dxm == NULL)) dxm = dxp;
    47   if ((dxp != NULL) || (dxm != NULL)) graphmode.etype |= 0x02;
     25
     26  if (!PrepPlotting (2, &graphmode)) return (FALSE);
    4827 
    49   /* find vectors */
    50   if ((vecx = SelectVector (argv[1], OLDVECTOR, TRUE)) == NULL) return (FALSE);
    51   if ((vecy = SelectVector (argv[2], OLDVECTOR, TRUE)) == NULL) return (FALSE);
    52   if (vecy[0].Nelements != vecy[0].Nelements) {
    53     gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[1], argv[2]);
    54     return (FALSE);
    55   }
    56  
    57   Npts = vecx[0].Nelements;
    58   if (!PrepPlotting (Npts, &graphmode)) return (FALSE);
    59  
    60   PlotVector (Npts, vecx[0].elements);
    61   PlotVector (Npts, vecy[0].elements);
    62   if (graphmode.etype & 0x01) {
    63     PlotVector (Npts, dym[0].elements);
    64     PlotVector (Npts, dyp[0].elements);
    65   }
    66   if (graphmode.etype & 0x02) {
    67     PlotVector (Npts, dxm[0].elements);
    68     PlotVector (Npts, dxp[0].elements);
    69   }
     28  PlotVector (2, x);
     29  PlotVector (2, y);
    7030 
    7131  return (TRUE);
    7232
    7333}
    74 
    75 
  • trunk/Ohana/src/opihi/cmd.data/vgauss.c

    r10071 r10307  
    5353  v1 = svec[0].elements;
    5454  v2 = dy;
    55   for (i = 0; i < Npts; i++, v1++, v2++) *v2 = 1.0 / (*v1 * *v1);
     55  for (i = 0; i < Npts; i++, v1++, v2++) {
     56      *v2 = (*v1 == 0.0) ? 0.0 : 1.0 / (*v1 * *v1);
     57  }
    5658 
    5759  ochisq = mrqinit (xvec[0].elements, yvec[0].elements, dy, Npts, par, Npar, fgaussOD, !Quiet);
Note: See TracChangeset for help on using the changeset viewer.