Last modified: December 2013

URL: https://cxc.cfa.harvard.edu/ciao/ahelp/paramio_api.html
Jump to: Description · Examples · See Also


AHELP for CIAO 4.17

pgets

Context: paramio

Synopsis

Read/write individual parameter values.

Syntax

pgetb(paramfile, param)
pgeti(paramfile, param)
pgetd(paramfile, param)
pgetstr(paramfile, param)

pputb(paramfile, param, intval)
pputi(paramfile, param, intval)
pputd(paramfile, param, doubleval)
pputstr(paramfile, param, stringval)

Description

These functions provide read and write access to individual parameter values for a tool. Unlike the generic pget() and pset() routines provided by paramio, these functions typecast the variable into the given type.

Booleans

Boolean values are represented as integers, where 1 is True and 0 is False, rather than the native Python boolean type. Since Python converts True and False to 1 and 0 respectively, boolean values can be used in calls to pputb(), but the return value from pgetb() will be 1 or 0.

The paramio module is not available by default; see "ahelp paramio" for information on loading the module.


Examples

Example 1

>>> from paramio import *
>>> err = pgetd("dmextract", "sys_err")
>>> print(err)
0

pgetd() is used to return the value of the sys_err parameter of dmextract as a double.

Example 2

>>> vali = pgeti("dmextract", "verbose")
>>> vald = pgetd("dmextract", "verbose")
>>> valstr = pgetstr("dmextract", "verbose")
>>> print("i={0} d={1} str={2}".format(vali, vald, valstr))
i=0 d=0.00 str=0

Here we get the value of the "verbose" parameter as an integer, double, and string.

See Also

paramio
paccess, paramclose, paramio, paramopen, pget, plist, pquery, pset, punlearn