Last modified: December 2013

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


AHELP for CIAO 4.16

paramio

Context: paramio

Synopsis

The Python interface to the CXC parameter system

Description

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().


Examples

Example 1

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

Example 2

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

See Also

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