Wave plotting app misbehaves when "standard input" is not a terminal [message #39426] |
Wed, 19 May 2004 12:05 |
cchiesa1
Messages: 1 Registered: May 2004
|
Junior Member |
|
|
I have an extremely trivial Wave procedure named "scrollGraph"
(attached below).
When I invoke Wave interactively at a command prompt (this is on
Solaris 8) and type the commands to load-and-run "scrollGraph," it
accepts numeric values from the keyboard, one at a time, and for each,
draws a nice complete graph with horizontal and vertical axes, tick
marks, and of course a 2D trace of the last 'xnumPts' values entered.
When I invoke Wave as a child process from a parent program (in this
case a Perl/Tk script) and feed it the same commands-and-data through
a pipe, scrollGraph seems to start up okay, but Wave in general seems
to go slightly insane. The Wave output window appears, but it
flickers-and-flutters as various PARTS of the graph -- axes, tickmarks
-- VER-R-R-R-RRRRRY SLO-W-W-W-WW-LY accumulate in the window. (Just
when you think it has finally gotten around to where it's about to
graph the actual data, the window clears and the whole show starts
over.)
A similar program that omits READ and just graphs a static dataset,
once, has no such problems, so I conclude that READ is the culprit
here. Specifically, it looks like Wave is going crazy trying to
draw-and-redraw the graph over and over again at a very high repeat
rate, "just" because READ is connected to a pipe, rather than a
terminal, as "standard input."
I have not been able to find any mention of such behavior in any of
the Wave documentation, anywhere on VNI's website, or in this
newsgroup; has anybody else ever seen this, know what causes it, know
how to fix/avoid it? "scrollGraph" is just a simple prototype; in the
end I need to be able to feed "simple" commands to a Wave script that
generates complex graphs on behalf of another program. I'm
uncomfortable with this bad sign so early on... Much appreciation
awaits anyone who can shed some light on this matter! :-)
Thanks in advance,
Chris Chiesa
Lead Programmer/Analyst
University of Rochester Laboratory for Laser Energetics
;-------- example Wave procedure ------
pro scrollGraph,xnumPts,yscale
x=intarr(xnumPts)
plot,x,yrange=[0,yscale]
ans=0
while ans ne -1 do begin
read,ans
if ans ne -1 then begin
y=x
x(1:xnumPts-1) = y(0:xnumPts-2)
x(0) = ans
plot,x,yrange=[0,yscale]
endif
endwhile
end
|
|
|