PSRCHIVE user documentation: psredit

1.0 Purpose

The Pulsar Archive Editor, psredit, enables one to query or change the parameters in a Pulsar Archive. The output format of this program is different to vap, and is designed to facilitate the development of shell scripts that require access to Pulsar Archive parameters.

2.0 Usage

psredit commands are of the form:
psredit -c command[s] [output options] filename[s]
where command[s] is a string of one or more commands, separated by commas. (Multiple commands may also be specified by using multiple -c options.)

Each command either gets or sets a parameter value. A get command is simply the name of the paramter to be queried; e.g.

psredit -c bw,freq filename[s]
will query the bandwidth and center frequency of the specified archives. A set command is an assignment expression with the parameter name on the left; e.g.
psredit -c dm=10.35 -e new filename[s]
Here, the command dm=10.35 sets the dispersion measure attribute and -e new is one of the standard output options.

To print a list of every parameter in the data file, including a short description of each parameter and its current value,

psredit filename[s]

Note that some parameters may be either vectors or attributes of a vector. If only the parameter name is specified, then the set or get command will be applied to all elements of the vector. When querying the value of a vector parameter, multiple output values will be separated by commas, as in the following example:

psredit -c int:mjd file.ar
file.ar int:mjd=52678.077,52751.281,52794.848,52795.401,52795.688,52804.146,52812.626,52812.695,52839.118
Here, the epoch (MJD) of each sub-integration in file.ar is output as a comma-separated list.

It is also possible to specify an element or range of elements, using a simple array syntax; e.g.

psredit -c 'int[2,5-]:duration' file.ar
fild.ar int[2,5-]:duration=8686.6640625,8686.6640625,8686.6640625,8686.6640625,8686.6640625
Here, the integration length, or duration, of the sub-integrations indexed by 2 and 5 through 8 (there are 9 sub-integrations) are output as a comma-separated list.

NOTE: the single quotation marks on the above command line example are necessary to protect the square brackets from interpretation by the shell.

2.1 Usage in Shell Scripts

The output of psredit -q facilitates its use in shell scripts. With the -q command line option, psredit will not output the name of the file from which the parameters are queried; e.g.
psredit -qc bw,freq filename.ar
freq=1420 bw=-64
This output can be used to set environment variables, as in
set vars=`psredit -qc param1,param2 filename.ar`
set $vars
These lines would define two environment variables param1 and param2. It is necessary to perform this operation in two lines, otherwises the string param1=value2 param2=value2 would be passed as a single word to the set built-in shell command.

3.0 Algorithms

For a description of the TextInterface::Class, please set the Building a text interface tutorial.

4.0 Testing and examples

  • None at this time.

5.0 Known bugs and features that require implementation

  • None at this time.