[daip] saving and restoring arrays

Eric Greisen egreisen at cv3.cv.nrao.edu
Thu Sep 5 12:06:44 EDT 2002


Adam Fallon writes:
 > Hi - I have a procedure that I am running over and over on
 > small portions of a large image. Each time I run it I store
 > a list of box sizes in a (4,100) array. I later use these
 > box sizes to define areas to fit using jmfit.  When I start
 > a new section of the image I clear the array and store new
 > box sizes.
 > 
 > Right now my only option (that I know of) if I want to work
 > with the box sizes again is to enter all the old array elements
 > by hand -  I would like to somehow save the array each time I
 > finished with a section, so that I can later restore this
 > information to adjust the sizes, run other programs, etc.
 > Is there some way to save an array like this as a data file
 > outside of aips, and then later load the array back into aips?
 > 
 > Thank you very much,
 > Adam.
 > _______________________________________________

There is no simple way to write out values and then read them back in.

But, how do you enter the values the first time?  If it is by hand,
consider using a RUN file instead.  You could use your emacs or other
editor to make a file that looks like (where I take your adverb as
MYBOXS) :

$ first line is comment anyway
MYBOXS(1,1) = 1,2,3,4
MYBOXS(1,2) ~ 5,6,7,8
MYBOXS(1,3) ~ 9,10,11,12

etc.

Then you just RUN filename to set the adverb values.

Note the use of the relatively new verb ~ which only inserts the
number of values on the RHS into the address on the LHS while = 0
fills the whole array before inserting the values.

If you already have values in your AIPS session consider:

CLRMSG
PRINT MYBOXS
outprint = 'MYAREA:Myboxs.source
PRTMSG

This will have to be edited to insert the adverb name but is a very
good start.

Eric Greisen



More information about the Daip mailing list