add_param

The purpose of this routine is to add a new parameter to an existing parameter file.

The routine uses a paremeter already existing in the parameter file to find where to place the new parameter

Command line usage (if any):

usage:

add_param.py new_param value old_param
where
new_param

is the new variable including what is normally included in parentheses. This string will be written to the new .pf file.

value

is the default value to assign to the new parameter, which can be a string

old_param

is the the variable after which the new parameter is to be placed. Note that this is a minimum match, which is to say that one does not need to include any more of the old parameter than what is required to make a unique identification

The various paremeters may need to be enclosed in quotes.

Description:

The routine first searches the parameter file to see whether the new parameter exists, if it does then it does not create a new .pf file

If that is not the case then the routine puts the new parameter with its value after the old_param.

If a new paremeter file is merited it is written to a file with a prefix of new_

If new parameter files are written a command file MoveEm is created, which can be run by “source MoveEm” to replace the old .pf files with the new ones.

Primary routines:

doit- the master routine for doing all of the pf files in a directory do_one - the routine that processes each pf file

Notes

This is not intended to be a bulled-proof routine so one should use it with care, inspecting at least some of the new files before replacing the old parameter files is strongly advised.

History:

190803 ksl Coding begun

Functions

do_one(filename, new_param, value, old_param)

Precess a single file

doit(new_param, value, old_param)

Do something magnificent

read_file(filename[, char])

Read a file and split it into words, eliminating comments

read_table([filename, format])

Read a file using astropy.io.ascii and return this