group name {type name, ...}
Create a new aggregate datatype.
name
type name, ...
group
variables to form observing
lists, and then shows how such an observing list might be used.
Please read the comments to learn how it all works.
# Create a new datatype that contains all of the parameters that # are needed to observe a given source. group Observation { Source src, # The source to be observed. Time earliest, # The earliest time to observe the source. Time latest, # The latest time to observe the source. Interval duration # The desired integration time on the source. } # Form a list of the above type of group, to form # an observing list called mylist. listof Observation mylist = { {3c345, 03:45, 04:45, 5m}, {3c286, 03:30, 05:30, 10m}, {0552+398, 04:50, 07:15, 2m}, } # Iterate sequentially through the above list to observe each # of the listed sources as per their associated parameters. # Each iteration of the foreach loop sets the variable 'obs' to # contain a row of the observing list. foreach(Observation obs) $mylist { # If the observing window for source $obs.src has passed, avoid # waiting for the 24 hours that it might take to come around # again. Instead print a warning message and start the next # iteration of the loop. if($after($obs.latest, LST)) { print "Too late to observe ", $obs.src, "\n" next } # If not already in the observing window, wait for its start # time to pass. until $after($obs.earliest, LST) # Track the listed source until either the end of the observing # window is reached, or the source has been observed for the # desired integration time. track $obs.src until $after($obs.latest) | $elapsed > $obs.duration # Continue on to the next iteration of the foreach loop. }
Observation
argument. If this command were
named observe
then the foreach loop could then be
re-written as:
foreach(Observation obs) $mylist { observe $obs }The individual members of group variables are refered to by appending a period to the name of the group variable, followed by the name of the desired member. Thus in the above examples,
$obs.src
refers to the src
member,
which is a variable of type Source
.