SUBSIDIARY PROGRAM RDGEN

  .. and a link to vpfit extension.

Last revision: 28 September2004


RDGEN- for general handling of data.


This is a collection of routines for data handling, display, and adjusting, with a facility which helps to set up files for using with VPFIT, and it is included in the VPFIT distribution file. See the VPFIT description for details on acquiring and installing the program.  It is useful (hopefully) for setting region boundaries and initial guesses for VPFIT, for displaying the accumulated results, for examining by eye particular redshift systems and fits to them, testing that the error array is a true reflection of the rms scatter in the data, comparing spectra and generally examining and even modifying the data. Inevitably this means it becomes a personal set of tools which probably mean it has some gross deficiencies or really annoying features as far as other people are concerned.  It is there in case it is useful - if you don't like it, don't use it. There is an attempt to make the routines (and especially any I/O) compatible with the VPFIT ones, but nothing is guaranteed. Comments here often started out simply as reminders for me, and so the descriptions are pretty patchy. And if something does not work, don't be surprised ...

If you decide to try this program and it does not start up properly, then try looking here.

If you click on one of the linked options you'll get a more detailed description for it. Others are either obvious (and prompt for any parameters) or I've not used them for a while.

Routines included:

ab generate absorption list (p1:file)
ad linearize and sum spectra
bb generate a black body spectrum
cy copy data arrays
dc divide data by continuum (p1: low threshold)
ex exit program
gp generate Voigt profiles in continuum
hd dust extinction from Hb/Ha
he (or ?) give a list of commands
le set data array length
lo exit program (for IRAF devotees)
mf median filter data, result to continuum (p1: no. of pixels)
mu multiprocess files
no add noise to continuum -> new spectrum
pc close plot device
pf linelist file name input
pl plot the data (same as sp)
pg plot with cursor control
pw print wavelength coefficients
qu quit program
rc recall internal data
rd read FITS, IRAF or ASCII data file
sm (p1) boxcar smooth p1 pixels
sp plot the data
st store data internally
sw swap spectrum with stored one
sz data stacker
tp tickmarked velocity plot in a standard format
uc estimate upper limit to the column density for an ion
un set continuum to unity for current data
wa wavelength coefficient reset
wl set linear wavelength coefficients and length
wr write an IRAF data file
wt write data as a text (ASCII) file (p1: filename)
zr redshift correct to rest wavelength (p1: redshift, p2:n,b,[i])
zt ztable function
<  redirect input (p1: filename)
 
 

Startup:

If the environment variable  RDSTART is set to a filename (like  rd_start.dat) which contains a list of commands, then these commands will be executed before the command prompt. This is useful if you always want to read in the same linelist files, or the same data. An example file is:

pf /data/cass72/rfc/qsos/hiion.pg
pf /data/cass72/rfc/qsos/loion.pg
pf /data/cass72/rfc/qsos/lyman.pg
pf /data/cass72/rfc/qsos/lowz.pg
?

which will read in the four named line lists for use with cursor-controlled data plotting, and then list the available commands.

Command list:

The command list is held on a file called rd_prhelp.dat (which is included in the tarfile), rather than internally. There are no particular advantages, except that the program does not have to be recompiled when I remember I have not updated the help list! It goes to the file given by the environment variable RD_PRSETUP, unless you happen to be on the Institute of Astronomy, Cambridge, cluster of machines. So you should 'setenv RD_PRSETUP /path/rd_prhelp.dat' before running the program, where '/path' refers to wherever in your filespace the file is. Failure to do so does not matter, but you may get a 'Failed to find help file' message occasionally when otherwise you'd get a list of available options.
 

A few things you might want to do are:

Data reading and moving around:

Just rd <filename> and FITS, IRAF or ASCII data will be read in. It tries them in that order, so if you omit file extensions and us 'rd something', then if both exist something.fits will be read and something.imh (and something.pix) will not.

wr will write the current data to a new file. You will be prompted fo a filename if you do not give it on the command line. Note that it writes out ONLY the data, and not the error estimate or the continuum. If you want to write them as well you have to copy (cy) the data from the array in which it is held to the data array. If the file already exists, then the attempt to write it will fail.

cy gives
  Copy data array
  Enter two letter code in order (from)(to)
  continuum=c, scrunched (summed) array=s, workspace=w
  e.g. cw for cont. to work (help for more info.)

The internal arrays are workspace (w), error (e), continuum (c), scrunched (linearized summed) data (s) and its error estimate (t)
ws copies data and error to scrunched data and error
sw copies scrunched data and error to data and error
You can suppress the copying of the error arrays by appending an "n" to the above two commands-- swn & wsn copy data but not errors
ew is error to workspace - so only one array is copied
we is workspace to error
cw is continuum to workspace
wc is workspace to continuum

A few specialist options are also available. Type "help" (after cy) to see what they are.

[top]
 
 

Displaying the data
 
 

Generating Voigt Profiles:

Voigt profiles, convolved with a Guassian instrument profile, can be inserted in the continuum array.The parameters may be entered by hand, or read from files generated by the VPFIT program.

>gp
 ion,level,col,bval,zed?    ..  or ...
 <filename> (fmt,clo,chi,zlo,zhi,blo,bhi,binc,type)
               [26,everything,everywhere]

If a filename is given (so don't make SiII, or HI a filename!), then the format is needed, and you may care to restrict the ranges of the parameters for inclusion:
clo < log column density < chi,
zlo < redshift < zhi, and
blo < Doppler parameter < bhi  are included
(for all these blank or zero is taken as 'no limit' i.e. 1e20 for upper limits and -1e20 for lower limits),
and anything with Doppler parameter < binc whether or not the other criteria are satisfied (ignored if blank or zero).
The final parameter in the list, 'type', if present, is used to include or exclude classes of ions. If you put 'l' there, only Lyman alpha will be put in for each HI found in the list. It will also suppress the Lyman limit for this or any subsequent profile generation. There are other parameters you can put in here: 'i' results in the special parameters '<>' and '__' being ignored, and 'n' results in metals from the list being omitted. You can string these together in any order, so 'nil' results in Ly-a only, with no metals and no special parameters.

Special parameters, such as <> and __, are restricted in range to the wavelength limits of the regions (marked by %% in the 26-style list) which contain them.

If you want to save the result, then you can either write out an ASCII file  (wt filename) or copy to data area and then write as a fits file (cy cw followed by  wr filename).

Note added 18.12.02:
There is one incompatibility between the way things are done here and for vpfit, and that concerns the interpolation between the last Lyman series line in the list and the Lyman limit. In VPFIT this is done properly, but here it is just interpolation between the residual flux at the last line and the limit, and if other lines were put in earlier this gives the wrong result. The easy way around this is to put systems with appreciable Lyman limits in first in the input file, then they will be OK. It might be fixed sometime.

[top]
 

Stacking spectra:

This is a multistage process at present -- you need to fit Voigt profiles, divide by the continuum, and then stack the redshift corrected spectra. So a combination of gp, dc, and sz is used.
 

Stack redshift-corrected spectra:

>sz
 <filename> (fmt,elm,ion,clo,chi,zlo,zhi,blo,bhi,binc)

The filename with the line parameters must be given, and the other parameters are optional.

Default values for parameter line:
 
Quantity Default Comments
fmt 26 File format. Alternative is 13. For any other value 26 is used
elm H Any from atom.dat list
ion I Any from atom.dat list which is compatible with elm
clo 0.0 Minimum log column density for inclusion
chi Infinity Maximum log column density for inclusion
zlo -1000 Minimum redshift for inclusion
zhi 1E25 Maximum redshift
blo 0.0 Minimum b-value (km/s)
bhi 1E25 Maximum b-value
binc 0.0 Include ALL lines with b-value < this, even if other criteria not satisfied

[top]
 

Adding noise for simulated spectra:
 

To add roughly Gaussian noise to the continuum just type

>no
 random number seed
 (<CR> for one based on the internal clock)
 s/n relative to peak continuum? <CR> = infinity
 (OR c1,c2 gives sigma=sqrt(cont*c1**2 + c2**2))
 40
 work arrays replaced with synthetic spectrum
 

If you want to add noise to the data array just type ' no da' instead of 'no'.

[top]


Cross-correlate spectrum with wavelength table:

In an effort to help identify redshift systems a crude cross-correlation between the deviations below the continuum and a line list of the type nnn.pg (above) can be invoked by 'zt'. The data is replaced by the cross-correlation as a function of redshift. It was written in the hope of extracting information on metal systems hiding in the Ly-a forest, but is not particularly useful.