Last modified: December 2013

Jump to: Description · Examples · See Also

AHELP for CIAO 4.16


Context: paramio


The Python interface to the CXC parameter system


The paramio module is the interface between the Python interpreter and the CXC parameter system. For more information on the parameter system see "ahelp parameter". Detailed descriptions of each function are provided by individual ahelp pages.

The paramio module is not available by default; to use it in a Python program, it must be loaded using the Python import function by either of:

from paramio import *
import paramio

Functions provided by the module

The following functions are provided by the module (also try "ahelp -c paramio"); use "ahelp <function>" to get a detailed description of a function:

Function name Description
paramopen Open a parameter file
paramclose Close a parameter file
plist Return a list of parameter name
pset Set a value in a parameter file
pget Find the value stored in a parameter file
pquery Query a parameter value
paccess Locate a parameter file
paramgetpath Locate a parameter file
punlearn Reset the contents of a paremeter file
pgeti Get an integer parameter value
pgetb Get a boolean parameter value
pgetd Get a floating-point parameter value
pgetstr Get a string parameter value
pputi Set an integer parameter value
pputb Set a boolean parameter value
pputd Set a floating-point parameter value
pputstr Set a string parameter value

Accessing parameter files

Except for paramopen() and paramclose(), all the functions accept either a Param_File object or a name to denote the parameter file to operate upon. The use of filenames is more convenient for simple operations, but results in an implicit file open/close per call. For more iterative/intensive I/O operations, better performance will result from the use of the object returned by paramopen().


Example 1

>>> from paramio import *
>>> punlearn("dmextract")
>>> print(pget("dmextract", "opt"))
>>> pset("dmextract", "infile", "in.fits")
>>> print(pget("dmextract", "infile"))

Example 2

>>> from paramio import *
>>> ph = paramopen("dmextract")
>>> print(pget(ph, "opt"))
>>> pset(ph, "infile", "in.fits")
>>> print(pget(ph, "infile"))
>>> paramclose(ph)

See Also

coords, level, pileup, times
autoname, ciao, ciao-install, history, parameter, stack, subspace
dm, dmascii, dmbinning, dmfiltering, dmmasks, dmopt, dmregions
paccess, paramclose, paramopen, pget, pgets, plist, pquery, pset, punlearn