|
From: <pl...@pi...> - 2011-09-30 21:45:07
|
On 09/30/11 23:06, Ethan Merritt wrote: > On Friday, September 30, 2011 12:20:57 pm pl...@pi... wrote: >> Hi, >> >> I am calling a simple function max() to detect the two largest peaks in >> the data. >> >> >> #function to do sample/hold >> max(x,y)=(ymax<y) ? ( xmax=x, ymax=y) :ymax ; >> >> # dummy plot to scan data for biggest peak >> set term unknown >> plot ymax=xmax=0, datafile using 1:( max(($1),($2)) ); >> pk0=xmax; ymax=xmax=0; >> plot [pk0+100:] datafile using 1:( max(($1),($2)) ); >> pk1=xmax; > >> It's hitting the first one both times. > >> Now unless I'm getting sleepy, this seems to show that the second call >> to plot with a specified limited range is still going through the >> motions. and evaluating the using clause for all data points in the >> file. Thus all the mechanics are still being gone through only to have >> null output created. > > How would it know if $1 and/or $2 are out of range without > evaluating them first? > clearly it has to read the data lines but what needs evaluating, then range is a given constant. It seems it is evaluation the using clause , yet this is not what the range applies to , it applies to $1. Am I mistaken? >> Is this : >> >> ? >> a) correctly what's happening >> b) necessary >> c) desirable. >> >> ? >> >> If I have a huge data file (that I do sometimes.) it would seem >> advantageous if setting a range pre-empted the rest of plot activity >> until the range condition is true. >> >> Best regards. Peter. > > If the values in column(1) are monotonic increasing in your data file, > then you can skip the leading N records via the "plot ... using every ..." > option. Otherwise each line will be processed and stored with flag > INRANGE/OUTRANGE/UNDEFINED as appropriate. After all the data records > are read in, the INRANGE points are plotted. > Does that answer the question? > |