GBT Balance API
The Balance API provides the programmer with an interface to perform balancing of the IF Rack, Spectral Processor, Spectrometer and Prime Focus receivers. It is written in python and can be used within other programs, from the Python Console, from the Astrid "Command Console", or within a session of the config_tool application.
The astronomical observer has three choices, and should follow the instructions on other pages, linked here:
The Balance API consists of the following classes: Balance, acs, pf, sp and ifrack. The programmer using the API needs only to create a Balance object. All functionality of the underlying classes are exposed through the Balance class interface.
The Balance class serves as the interface to the API. Its function is to promote a clean interface to the observing API. Its use can most easily be described by an example.
First a Balance object is created with a list of the managers to be balanced.
b = Balance(["pf", "ifrack"])
If no parameters are specifed (e.g. if b = Balance() is used), the ifrack is the default device.
To perform the balance, the balance method is called.
b.balance()
The balance method performs a balance on each of the devices specified. In this example, balancing is performed with the default balancing options for each device. The devices are balanced in the order specified in the list. In the above example, the Prime Focus receiver is balanced first, followed by the IFRack.
An optional parameter to the balance method can be provided. This parameter must be a dictionary that contains 1 or more of the following
balancing options. Items which are not in the dictionary are assigned their default values. Non applicable options are ignored.
The supported keywords and their default values are:
target_level = -11 Applicable when balancing the SpectralProcessor (sp)
port = (1..41) Applicable to the Spectrometer (acs) :
sample_time = 2 Applicable when balancing the Prime Focus Receivers (pf)
cal = 'off' Applicable when balancing the Prime Focus Receivers (pf)
Supported dictionary keys/value type are:
target_level / float
sample_time / int
cal / string containing "on" or "off" -- other values will be treated as if "on" was specified
port/ tuple containing integers from 1 to 41
An example of a dictionary containing valid options and its use in a balance method call is:
opt = { "target_level": 4,
"sample_time" : 5,
"cal" : "on",
"port" : (9,13)
}
b.balance(opt)
The Balance API is a programmer's interface to balancing. The Observation API (and thus Scheduling Blocks and the turtle application) provide a simplified syntax to balancing. The observer should be aware that when he or she is writing a Scheduling Block, the syntax described in the "Balance" section of ObservingDirectives should be used. If the observer is balancing manually to satisfy special requirements of his or her observing, and does so from the Python command line or the Astrid "Command Console", the slightly more verbose syntax described at BalanceUsage#BalancingWithAstrid must be used.
-- MelindaMello - 02 Dec 2004
|
Revision r1.8 - 15 Feb 2005 - 15:57 GMT - NicoleRadziwill
|
Content copyright © 1999-2007 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
|
| |