Loading ...
Sorry, an error occurred while loading the content.

Strange output problem

Expand Messages
  • Rajkumar S
    Hi, I am working on plotting of sar data and wrote a custom script for processing it. My problem is that one column of data, which has only whole numbers, when
    Message 1 of 4 , Nov 2, 2003
    • 0 Attachment
      Hi,

      I am working on plotting of sar data and wrote a custom script for
      processing it. My problem is that one column of data, which has only
      whole numbers, when plotted is being plotted has fractions, like 1.5
      and 2.5 etc...

      My data is like this..

      proxy;60;2003-11-02 00:01:02;0;63;0.49;0.48;0.46
      proxy;60;2003-11-02 00:02:02;0;62;0.53;0.49;0.46
      proxy;60;2003-11-02 00:03:02;0;61;0.55;0.51;0.47
      proxy;60;2003-11-02 00:04:02;1;65;0.34;0.46;0.45
      proxy;60;2003-11-02 00:05:02;1;65;0.60;0.51;0.47
      proxy;60;2003-11-02 00:06:02;0;66;0.41;0.49;0.46

      The data I am interested is in column 4, which as you can see can only
      have whole numbers (0 1 2 ), but my output png has fractions, like .5
      1.5 etc, I have tried my best to find what is going on, but now
      surrendered :(

      In the current png, I have multiplied the column with 10, before
      plotting, so instead of .5 you will see 5. but the problem remains.

      I have attached my script, data file, png and the command I used to
      generate the output.

      raj
    • Stephen C. Grubb
      Raj, I think the problem is with your proc getdata filter. Filters are interpreted. ALL variables that are local to the filter must use two at-signs (@@)
      Message 2 of 4 , Nov 5, 2003
      • 0 Attachment
        Raj, I think the problem is with your proc getdata filter. Filters are
        interpreted. ALL variables that are "local" to the filter must use two
        at-signs (@@) when being referenced to protect them from being evaluated
        when the filter code is read initially (sometimes this is desired, but not
        in this case). I realize this can be confusing.

        Your filter should look like this:

        filter: ##set LINE = @@1;@@2
        ##set T = $change( ";", " ", @@LINE )
        ##set TK1 = $ntoken (4, @@T)
        ##set TK2 = $ntoken (5, @@T)
        ##set TK3 = $ntoken (6, @@T)
        ##set TK4 = $ntoken (7, @@T)
        ##set R = $arith(@@TK2*10)
        ##set PSLIST = $arith(@@TK3/10)
        ##print @@TK1 @@R @@PSLIST @@TK4

        Let me know if that doesn't do it.

        -Steve


        On Sun, 2 Nov 2003, Rajkumar S wrote:

        > Hi,
        >
        > I am working on plotting of sar data and wrote a custom script for
        > processing it. My problem is that one column of data, which has only
        > whole numbers, when plotted is being plotted has fractions, like 1.5
        > and 2.5 etc...
        >
        > My data is like this..
        >
        > proxy;60;2003-11-02 00:01:02;0;63;0.49;0.48;0.46
        > proxy;60;2003-11-02 00:02:02;0;62;0.53;0.49;0.46
        > proxy;60;2003-11-02 00:03:02;0;61;0.55;0.51;0.47
        > proxy;60;2003-11-02 00:04:02;1;65;0.34;0.46;0.45
        > proxy;60;2003-11-02 00:05:02;1;65;0.60;0.51;0.47
        > proxy;60;2003-11-02 00:06:02;0;66;0.41;0.49;0.46
        >
        > The data I am interested is in column 4, which as you can see can only
        > have whole numbers (0 1 2 ), but my output png has fractions, like .5
        > 1.5 etc, I have tried my best to find what is going on, but now
        > surrendered :(
        >
        > In the current png, I have multiplied the column with 10, before
        > plotting, so instead of .5 you will see 5. but the problem remains.
        >
        > I have attached my script, data file, png and the command I used to
        > generate the output.
        >
        > raj
        >
        >
        > To unsubscribe from this group, send an email to:
        > ploticus-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        >
        >


        Stephen C. Grubb scg@...
        Scientific Software Engineer, The Jackson Laboratory
        600 Main Street Bar Harbor, Maine 04609 USA
      • Rajkumar S
        ... I have made the changes, but the results are the same. Even before the showresults used to give correct parsed values. I am attaching that also, I have
        Message 3 of 4 , Nov 5, 2003
        • 0 Attachment
          Stephen C. Grubb wrote:
          > filter: ##set LINE = @@1;@@2
          > ##set T = $change( ";", " ", @@LINE )
          > ##set TK1 = $ntoken (4, @@T)
          > ##set TK2 = $ntoken (5, @@T)
          > ##set TK3 = $ntoken (6, @@T)
          > ##set TK4 = $ntoken (7, @@T)
          > ##set R = $arith(@@TK2*10)
          > ##set PSLIST = $arith(@@TK3/10)
          > ##print @@TK1 @@R @@PSLIST @@TK4
          >
          > Let me know if that doesn't do it.

          I have made the changes, but the results are the same. Even before the
          showresults used to give correct parsed values. I am attaching that
          also, I have cleaned up the proc a bit and now it is easy to see the
          problem.

          raj
        • Stephen C. Grubb
          Raj, You re using #proc curvefit to generate the plot.. I believe you just want to plot the points.. if so just use #proc lineplot instead, eg: #proc lineplot
          Message 4 of 4 , Nov 5, 2003
          • 0 Attachment
            Raj,

            You're using #proc curvefit to generate the plot..

            I believe you just want to plot the points.. if so just use #proc lineplot
            instead, eg:

            #proc lineplot
            xfield: time
            yfield: runq-sz
            #set COLOR1 = $icolor(1)
            linedetails: color=@COLOR1 width=.5
            legendlabel: runq-sz

            Proc curvefit generates a curve to fit your data, and by default generates
            a moving average curve, which explains the fractional values.

            Steve

            On Wed, 5 Nov 2003, Rajkumar S wrote:

            > Stephen C. Grubb wrote:
            > > filter: ##set LINE = @@1;@@2
            > > ##set T = $change( ";", " ", @@LINE )
            > > ##set TK1 = $ntoken (4, @@T)
            > > ##set TK2 = $ntoken (5, @@T)
            > > ##set TK3 = $ntoken (6, @@T)
            > > ##set TK4 = $ntoken (7, @@T)
            > > ##set R = $arith(@@TK2*10)
            > > ##set PSLIST = $arith(@@TK3/10)
            > > ##print @@TK1 @@R @@PSLIST @@TK4
            > >
            > > Let me know if that doesn't do it.
            >
            > I have made the changes, but the results are the same. Even before the
            > showresults used to give correct parsed values. I am attaching that
            > also, I have cleaned up the proc a bit and now it is easy to see the
            > problem.
            >
            > raj
            >
            >
            > To unsubscribe from this group, send an email to:
            > ploticus-unsubscribe@yahoogroups.com
            >
            >
            >
            > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
            >
            >


            Stephen C. Grubb scg@...
            Scientific Software Engineer, The Jackson Laboratory
            600 Main Street Bar Harbor, Maine 04609 USA
          Your message has been successfully submitted and would be delivered to recipients shortly.