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


next up previous contents index
Next: aipsrc.findint - Function Up: aipsrc - Tool Previous: aipsrc.findbool - Function


aipsrc.findfloat - Function



Package utility
Module misc
Tool aipsrc


lookup a float value resource definition


Synopsis
findfloat(value, keyword, def, undef, unres)


Description
findfloat will return T if the specified keyword was found in an aipsrc file, F otherwise. If a find was made, its value is returned, otherwise the specified (or default) default value def will be used. The value defined in the keyword is converting according to standard rules, i.e. the field upto a non-conforming character will be returned.
The value can be defined with optional units in the aipsrc file. By specifying in the findint a default unit string that has to be used in the absence of given units, and specifying units the result will be converted to before the value is returned. E.g.
drc.findfloat(x, 'test.float' , 5, 'h', 'd')
will assume that if the keyword is not present, the value of 5 is returned in x. If the keyword is given, but has no units specified, it will be assumed that the user has given the value in 'h'. The value returned will be converted to 'd' (i.e. twenty-four times smaller). If the user has specified units, the value returned will be converted to these ('d' in this case).



Example
With the following aipsrc keywords:
test.float:		5
test.float2:		5:30
test.float3:		5a
The following will be the result:
- arc:=aipsrc()
- arc.findfloat(x, 'test.float')
T 
- x
5 
- arc.findfloat(x, 'test.float1')
F 
- x
0 
- arc.findfloat(x, 'test.float1', 7)
F 
- x
7 
- arc.findfloat(x, 'test.float', undef='h', unres='d')  
T 
- x
0.208333333
- arc.findfloat(x, 'test.float2', undef='h', unres='d')
T 
- x
0.229166667
- arc.findfloat(x, 'test.float3', undef='h', unres='d') 
T 
- x
1826.25
- arc.done()            # remove tool



Arguments

value   The value of the resource (Out)
    Allowed: Double
keyword   The name of the resource to look up (In)
    Allowed: String
def   Default to use if keyword not found
    Allowed: Numeric
    Default: 0
undef   Default units to use if none given in aipsrc file
    Allowed: valid unit string
    Default: F
unres   The units the result will be converted to before giving the value from aipsrc file
    Allowed: valid unit string
    Default: F


Returns
Bool - is the resource defined?




next up previous contents index
Next: aipsrc.findint - Function Up: aipsrc - Tool Previous: aipsrc.findbool - 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-10-15