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


next up previous contents
Next: Development Plan Up: NOTE 236 - DISH: User's Manual Previous: Operation template

Subsections


Recipes

Recipe 1: Reduce an ON/OFF Total Power scan

Goal: To reduce an on/off total power scan pair by extracting the 'on' and the 'off' source scans from an opened data set, constructing a difference scan from them, and inserting the result into the DISH results manager.

Assume: You have a data set named rawdata opened and available in the dish results manager. An 'on' scan is located at the first record in rawdata and an 'off' scan is located at the third record in rawdata.

AIPS++/Glish commands and results   Purpose and Background 

rawdata.setlocation(1)              Move the rawdata pointer so that it 
                                    points at the first record, where the
                                    'on' scan is located.

on:=rawdata.get()                   Get that scan and assign it to a variable
                                    named on. on is a glish record having a 
                                    known structure. For example, the data and
                                    its description (axis type, value, etc.) is
                                    in a subrecord, data, and a subfield of
                                    that, arr, contains the data array.

rawdata.setlocation(3)              Move the pointer to point at the 'off'
                                    scan location.

off:=rawdata.get()                  Get it and assign it to 'off'.

result:=off;			    Set result initially to 'off' so that it
				    is a complete SDRECORD. Now adjust the
				    the data array...

result.data.arr:=(on.data.arr -     Subtract the 'on' data array from the 'off'
       off.data.arr)/off.data.arr   data array and divide the result by the 
                                    'off' data array. Additional operations to 
                                    appropriately scale the data and adjust
                                    relevant header words would be done here.

dish.rm().add('result','Difference  Add this result to the DISH results
       of rows 1 and 3',result,     manager. The final argument tells the
       'SDRECORD')                  results manager that this is an SDRECORD
                                    something the results manager knows how
                                    to display and interact with.

Recipe 2: Add a function to DISH (or fun with extensibility)

DISH is intrinsically enabled for extensibility. Currently, any files of the type dishops_xxxxx.gp (where xxxxx can be any string, e.g. dishops_cli.gp is used for the gaufit operation to indicate it is a command-line-interface operation), within the working directory will be automatically loaded. Functions within these files will be added to the those naturally available within dish. A simple template example is the following:

# dishops_template.gp -- template file for adding command line operations
#                        to dish
# Copyright (C) 1999,2000
# Associated Universities, Inc. Washington DC, USA.
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
# License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with this library; if not, write to the Free Software Foundation,
# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
#
# Correspondence concerning AIPS++ should be addressed as follows:
#        Internet email: aips2-request@nrao.edu.
#        Postal address: AIPS++ Project Office
#                        National Radio Astronomy Observatory 
#                        520 Edgemont Road
#                        Charlottesville, VA 22903-2475 USA
#

pragma include once;

dishops_template:=[=];

dishops_template.attach := function(ref public) {

        # now add whatever command line operation needed
        # for a specific example look at dishops_cli.gp which includes
        # the gaufit operation
	# Add your functions here vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
        public.myfunction := function(input1='yes',input2=3.1415926) {
                print 'This is my function and it will do whatever I want';
                print 'My arguments are: ',input1,input2;
                print 'If these are yes and 3.1415925 then I used the defaults';
                print 'I can have as many arguments as needed.';
                return;
        }
	# End of your function ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	# you can add as many functions as you desire

        return T; # to indicate the attachment went successfully

}

Running this operation within dish looks like the following:

- field_names(dish)
done dismiss gui rm ops addop normalcursor busycursor savestate restorestate debug open showscript message plotter gaufit myfunction
- dish.myfunction()
This is my function and it will do whatever I want
My arguments are:  yes 3.1415926
If these are yes and 3.1415926 then I used the defaults
I can have as many arguments as needed.
F


next up previous contents
Next: Development Plan Up: NOTE 236 - DISH: User's Manual Previous: Operation template   Contents
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-10-15