comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: continuous update of plot
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: continuous update of plot [message #9117] Tue, 03 June 1997 00:00 Go to next message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
Tim Patterson wrote:
>
> A quick test is to use the spawn command to list the file,
> save the returned data, and then next time around the loop, you can do
> the same and see if the returned string has changed.
>
>
> ������� �������� wrote:
>>
>> Hello,
>>
>> suppose I have a simulation that every so often writes out a 2d array.
>> Is there a way for idl to detect that the file has changed, and
>> replot or display the new data?
>> This would be under unix (digital and/or sparc) with the data
>> being produced by fortran.
>>

If you do not want to have to be in a loop when the plot gets
updated, you could do what Tim suggests but use timer events
so that the file is "polled" every N seconds, and the plot updated
accordingly. This way, you could have the plot updated while you are
doing other useful things with your program.

dave
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2200
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~

"I have this theory that if we're told we're bad,
then that's the only idea we'll ever have.
But maybe if we are surrounded in beauty,
someday we will become what we see." - Jewel Kilcher
Re: continuous update of plot [message #9128 is a reply to message #9117] Mon, 02 June 1997 00:00 Go to previous messageGo to next message
Tim Patterson is currently offline  Tim Patterson
Messages: 65
Registered: October 1995
Member
A quick test is to use the spawn command to list the file, =

save the returned data, and then next time around the loop, you can do
the same and see if the returned string has changed.

A nasty mix of IDL and pseudocde comments might make it clearer...

; do some processing

; write out your data file 'myfile.dat'

; get a check string for use later

spawn, 'ls -l myfile.dat', returned_data

while data_to_process do begin ; just start some sort of loop

; do some more processing

; now check file to see if it's changed

spawn, 'ls -l myfile.dat', =


if returned_data2(0) NE returned_data(0) THEN BEGIN ; file date changed!

returned_data =3D returned_data2
=

; display your new data
end if

endwhile


This depends on the fact that returned_data contains the normal
"ls -l" listing which will have a different date/time and maybe size
each time the file is changed. It's very unix dependent though, but
might be a quick solution, if not the cleanest.

Tim





=C3=E9=FE=F1=E3=EF=F2 =C2=E5=F4=EF=FD=EB=E7=F2 wrote:
> =

> Hello,
> =

> suppose I have a simulation that every so often writes out a 2d array.
> Is there a way for idl to detect that the file has changed, and
> replot or display the new data?
> This would be under unix (digital and/or sparc) with the data
> being produced by fortran.
> =

> I suppose that even a delay loop would serve, in the sense that
> it would redisplay the file every, say, 10 sec irrespectively of
> whether it changed or not. But this sounds wasteful.
> =

> Any ideas?
> =

> Thanks a lot!
> =

> =

> --
> Georgios Vetoulis, Institute for Plasma Research
> University of Maryland at College Park
Re: continuous update of plot [message #9240 is a reply to message #9128] Wed, 04 June 1997 00:00 Go to previous message
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <slrn5p63uq.q12.vetoulis@dyson.umd.edu>, vetoulis@dyson.umd.edu (������� ��������) writes:

> suppose I have a simulation that every so often writes out a 2d array.
> Is there a way for idl to detect that the file has changed, and
> replot or display the new data?
> This would be under unix (digital and/or sparc) with the data
> being produced by fortran.
>
> I suppose that even a delay loop would serve, in the sense that
> it would redisplay the file every, say, 10 sec irrespectively of
> whether it changed or not. But this sounds wasteful.
>

The simplest way is to just spawn 'ls -l filename' periodically to see if the
file has changed.

IDL> spawn, 'ls -l chart1.ps', result
IDL> print, result
-rw-r--r-- 1 epics epics 163527 Jan 11 12:29 chart1.ps
IDL> print, strmid(result, 41, 12)
Jan 11 12:29

____________________________________________________________
Mark Rivers (773) 702-2279 (office)
CARS (773) 702-9951 (secretary)
Univ. of Chicago (773) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars.uchicago.edu (e-mail)

or:
Argonne National Laboratory (630) 252-0422 (office)
Building 434A (630) 252-0405 (lab)
9700 South Cass Avenue (630) 252-1713 (beamline)
Argonne, IL 60439 (630) 252-0443 (FAX)
Re: continuous update of plot [message #9247 is a reply to message #9128] Wed, 04 June 1997 00:00 Go to previous message
R. Bauer is currently offline  R. Bauer
Messages: 137
Registered: November 1996
Senior Member
=C3=E9=FE=F1=E3=EF=F2 =C2=E5=F4=EF=FD=EB=E7=F2 wrote:
> =

> Hello,
> =

> suppose I have a simulation that every so often writes out a 2d array.
> Is there a way for idl to detect that the file has changed, and
> replot or display the new data?
> This would be under unix (digital and/or sparc) with the data
> being produced by fortran.
> =

> I suppose that even a delay loop would serve, in the sense that
> it would redisplay the file every, say, 10 sec irrespectively of
> whether it changed or not. But this sounds wasteful.
> =

> Any ideas?
> =


Yes,

I think you can use fstat or spawn,'ls',result to detect if the file is
new.
If it is new you can use:

resolve_routine,'plscript' =

a =3D execute('plscript') =


resolve_routine will compile the procedure plscript and the following
function will execute it.

plscript will be the routine which reads the data and will produce the
plot.



R.Bauer

-- =

R.Bauer =


Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: widget arrangement under IDL 5
Next Topic: Getting current MAIN procedure filename

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:06:20 PDT 2025

Total time taken to generate the page: 0.00642 seconds