Chandra X-Ray Observatory
Skip to the navigation links
Last modified: December 2013

Jump to: Description · Examples · See Also

AHELP for CIAO 4.9


Context: paramio


Get list of parameter names.


mylist = plist(paramfile)


The plist routine can be used to retrieve the list of parameter names in a parameter file. This can be used to quickly retrieve all the parameter name / value pairs.

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

Example 1

>>> pars = plist("dmcopy")
>>> pars
['infile', 'outfile', 'kernel', 'option', 'verbose', 'clobber', 'mode']
>>> values = {}
>>> for p in pars:
... values[p] = pget( "dmcopy", p )
>>> values
{'kernel': 'default', 'verbose': '0', 'clobber': 'no', 'outfile':
'cbe.fits', 'mode': 'ql', 'infile': 'acisf06616N003_evt2.fits',
'option': ''}
>>> values["clobber"]

The plist command is used to discover all the parameter names associated with dmcopy.par. The list of names is returned in the same order as in the .par file. It is then easy to iterate over the parameter names and using pget, retrieve the values. In this example we have stored the parameters in a Python dictionary.

Make note that pget always returns a string value regardless of the data-type associated with the parameter value.

Example 2

>>> dmc = paramopen("dmcopy")
>>> pars = plist(dmc)
>>> pars
['infile', 'outfile', 'kernel', 'option', 'verbose', 'clobber', 'mode']

Same as above except it uses the parameter object returned by dmcopy.

See Also

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

Last modified: December 2013
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: Smithsonian Institution, Copyright © 1998-2017. All rights reserved.