|
From: Ethan M. <merritt@u.washington.edu> - 2008-01-31 18:16:55
|
Dan:
The binary data file supposedly contains 1 set of 7 points
(yes the original poster counted wrong but it shouldn't matter since
the error is on the *first* point, not the last one).
> The array=1:8 specification indicates that there are two single dimensional arrays of data, one 1 element long, another 8 elements long. However, that doesn't seem to match what the user is intending if there are only 7 data points.
> (There should be nine.) Perhaps the user just wants array=7.
Sorry for introducing that "array=1:8" artifact. The original failing command
was
plot "histdata.bin" binary record=8 format="%int" u 1
In trying to debug it, I tried substituting "array" for "record" but
apparently got it wrong. Sorry for the confusion on that point but
the original error remains the same.
Binary data case:
-----------------
# Curve 0 of 1, 7 points
# Curve title: ""histdata.bin" binary record=11 format="%int" u 1"
Tabular output of plot style 392 not fully implemented
# x y type
-1 102 i
0 42 i
1 38 i
2 28 i
3 26 i
4 108 i
5 156 i
Ascii data case:
----------------
# Curve 0 of 1, 7 points
# Curve title: "'dump' u 2"
Tabular output of plot style 392 not fully implemented
# x y type
0 102 i
1 42 i
2 38 i
3 28 i
4 26 i
5 108 i
6 156 i
The ascii file 'dump' was created by dumping the data
as read in from the binary file.
In the ascii input case it correctly starts the 'datum'
(column 0) at 0.
In reading the binary data file, it incorrectly starts
the 'datum' at -1.
The comments in the source code say:
df_datum = -1; /* it will be preincremented before use */
and that is indeed true in the df_readascii() case.
But the code is differnt in df_readbinary(). I changed the obvious line,
but my concern is that even though it appears to fix the 1D case it may
not be correct for "array" or "matrix" cases. Can you comment on that?
Ethan
On Thursday 31 January 2008 00:11, Daniel J Sebald wrote:
> Ethan Merritt wrote:
> > On Wednesday 30 January 2008 12:42, Ethan Merritt wrote:
> >
> >>I help is needed from someone more familiar with the binary data modes.
> >>Anyone care to take over this bug report?
> >
> >
> >
> > The following one-liner makes your test case work.
> >
> > However, I am *not* applying this to CVS because I just don't understand
> > the code well enough. The binary read code at this point is not parallel
> > to the ascii input code, which simply does ++df_datum as it goes.
> > Why is this different? Is it correct? Will it break other things?
> > I don't know.
> >
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > --- gnuplot/src/datafile.c 2008-01-25 12:59:41.000000000 -0800
> > +++ gnuplot-cvs/src/datafile.c 2008-01-30 23:01:30.000000000 -0800
> > @@ -4937,7 +4937,7 @@
> > }
> > }
> > } else { /* Not matrix file, general binray. */
> > - df_datum = point_count;
> > + df_datum = point_count+1; /* EAM DEBUG */
> > if (i != df_no_bin_cols) {
> > if (feof(data_fp)) {
> > if (i != 0)
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> >
> >
> >
> >>On Wednesday 30 January 2008 12:15, Ralf Juengling wrote:
> >>
> >>>Here you go. The binary data is in intel pentium endianess
> >>>(whatever that is).
> >>
> >>Thanks. So far as I can tell from a quick test, the problem is
> >>not specific to histograms. Any other plot type also gets incorrect
> >>x coordinates when using the binary read command on that data file.
> >>If I dump the contents after reading them in, I get this:
> >>
> >>gnuplot> set style data linespoints
> >>gnuplot> plot "histdata.bin" binary array=1:8 format="%int" using 1
> >>gnuplot> set table
> >>gnuplot> replot
>
> The array=1:8 specification indicates that there are two single dimensional arrays of data, one 1 element long, another 8 elements long. However, that doesn't seem to match what the user is intending if there are only 7 data points. (There should be nine.) Perhaps the user just wants array=7.
>
> >>
> >># Curve 0 of 1, 7 points
> >># Curve title: ""histdata.bin" binary array=1:8 format="%int" using 1"
> >># x y type
> >> 0 102 i
>
> The above would be the first "line" of data.
>
> >> 0 42 i
> >> 1 38 i
> >> 2 28 i
> >> 3 26 i
> >> 4 108 i
> >> 5 156 i
>
> The rest constitutes the second "line" of data, even though there isn't enough to fill out eight elements.
>
> Both of the above start at zero. If you want the inherent x value assigned to begin at 1 with the above patch, that's fine. (Is that what the ASCII data default is? Then matching the two would be good.)
>
> The thing that is a bit of a problem is what the table displays. Curve 0 of 1 should maybe be curve 1 of 1, but more importantly, one might expect it to be Curve 1 of 2 and Curve 2 of 2 if the user specifies array=L1:L2, where L means "length".
>
> However, this trait isn't unique to binary data. Try the following:
>
> Terminal type set to 'x11'
> gnuplot> set table
> gnuplot> plot '-' with lines
> input data ('e' ends) > 1
> input data ('e' ends) > 2
> input data ('e' ends) > 3
> input data ('e' ends) > 4
> input data ('e' ends) >
> input data ('e' ends) >
> input data ('e' ends) > 5
> input data ('e' ends) > 6
> input data ('e' ends) > 7
> input data ('e' ends) > 8
> input data ('e' ends) > e
>
> # Curve 0 of 1, 9 points
> # Curve title: "'-'"
> # x y type
> 0 1 i
> 1 2 i
> 2 3 i
> 3 4 i
> 0 0 u
> 0 5 i
> 1 6 i
> 2 7 i
> 3 8 i
>
> gnuplot>
>
> The x-values assigned begin at 0. There is an extra "undefined" in the middle, which doesn't happen for binary data. Note that the comment says curve 0 of 1 (perhaps that is correct, i.e., multiple scan lines but still a single curve). But 9 points instead of 8?
>
> Dan
>
--
Ethan A Merritt Courier Deliveries: 1959 NE Pacific
Dept of Biochemistry
Health Sciences Building
University of Washington - Seattle WA 98195-7742
|