[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: linking programs/ procedures



I've found another use for the much-maligned '@' symbol.
I often have a program that has the form:

; define a bunch of specific varibles, such as 
datafile='saturn.dat'
images_to_plot=[2,4,6,7]
; ***************** END OF USER INPUT **************
;
; now do operations that make use of USER input
; blah 
; blah
; blah

I like to separate the specific user input from the generic commands,
but
keep them as a MAIN routine so that I have access to all of the
variables
when I am done.

For example, When I generate figures for a publication, I like to have a
separate procedure
file for each figure - one that takes NO interactive input and simply
makes the
damn plot the right way - guaranteed.  SO, I might do something like
this:


; figure1.pro
datafile='saturn.dat'
images_to_plot=[2,4,6,7]
; ***************** END OF USER INPUT **************
@main_program_commands_that_produce_a_plot.pro
end


; figure2.pro
datafile='mars.dat'
images_to_plot=[0,3,4]
; ***************** END OF USER INPUT **************
@main_program_commands_that_produce_a_plot.pro
end

This makes the 'driver' files very short, and it guarantees that
the generic plotting routine is the same for all of the plots. 

One of the reason I have not gotten into object graphics and the other
fancy interactive stuff is that, when all is said and done, and I have
a plot I like, I want to be able to generate it again without having to
do any user interaction - I want a file of commands that reproduce the
plot exactly, and which are easily changed if I want to use a different
data file, for example.

I'd be curious to know if others out there are similarly stubborn about
wanting to have command files that are guaranteed to make a SPECIFIC
figure for a publication. It is most of what I end up using IDL for.

Dick French