Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1488
News FAQ
Search Home


next up previous contents index
Next: sditerator.history - Function Up: sditerator - Tool Previous: sditerator.getother - Function


sditerator.getvectors - Function



Package dish
Module dish
Tool sditerator


Get a vector of values for the fields in the template.


Synopsis
getvectors(template)


Description
This allows you to get all of the values for any scalar fields in an sditerator with a single function call. The template has the same structure as an sdrecord except that you only supply those fields that you want extracted. The returned value has the same structure as the template, but the field values are filled in with a vector containing each value from each sdrecord in the sditerator, in order. This function is tuned for a few fields so that they can be retrieved relatively quickly if they are the only fields in the template. These tuned fields are those used in the dish selection GUI: source_name, scan_number, time, chan_width, and restfrequency.



Example
   # tediously extract the individual values
   sdit.origin();
   nrecords := sdit.length();
   scans := array(0,nrecords);
   sources := array("",nrecords);
   restfqs := array(0.0,nrecords); 
   count := 1;
   rec := sdit.get();
   scans[count] := rec.header.scan_number;
   sources[count] := rec.header.source_name;
   restfqs[count] := rec.data.desc.restfrequency;
   while (sdit.more()) {
      sdit.next();
      rec := sdit.get()
      count +:= 1
      scans[count] := rec.header.scan_number;
      sources[count] := rec.header.source_name;
      restfqs[count] := rec.data.desc.restfrequency;
   }

   # or alternatively using getvectors
   template := [data=[desc=[restfrequency=0.0]],
                header=[scan_number=0,source_name=""]];
   vec := sdit.getvectors(template);
   scans := vec.header.scan_number;
   sources := vec.header.source_name;
   restfqs := vec.data.desc.restfrequency;



Arguments

template in The template indicating which fields to fetch.
    Allowed: record


Returns
record




next up previous contents index
Next: sditerator.history - Function Up: sditerator - Tool Previous: sditerator.getother - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-08-01