SRP > Manual

Table of content (hide)

  1.   1.  Description
  2.   2.  Features
  3.   3.  SRP screen-shots
  4.   4.  Requirements, installation and running
  5.   5.  Installation
  6.   6.  Running options
  7.   7.  Before you start
  8.   8.  Main configuration file: start.ini
    1.   8.1  File names and extensions
    2.   8.2  Observatory and observer
    3.   8.3  Object coordinates
    4.   8.4  What to do section
    5.   8.5  Bias and debias options
    6.   8.6  Trace options
    7.   8.7  Cosmic options
    8.   8.8  PSF options
    9.   8.9  Oned options
    10.   8.10  Flat correction options
    11.   8.11  Reidentify options
    12.   8.12  Wav options
    13.   8.13  Contrem options
    14.   8.14  Makeone options
  9.   9.  Other configuration files
    1.   9.1  contrem.ini
    2.   9.2  flat.ini
    3.   9.3  id.txt
    4.   9.4  makeone.ini
    5.   9.5  thar_list.txt
  10. 10.  Additional files that may be used as input by SRP
    1. 10.1  _trace
    2. 10.2  _disp.txt
  11. 11.  Converting to IRAF
  12. 12.  Download
  13. 13.  Example of a reduction with SRT
  14. 14.  Copyrights

1.  Description

SRP is a program for reduction of echelle spectrograph CCD frames. It is designed for fully automatic, unattended reduction but some procedures may also be used in interactive mode. SRP can perform bias and flat correction, cosmic rays removal, trace 2D spectrum and extraction of 1D spectrum, reference spectrum lines identification, dispersion function calculation, continuum removal, combining all rows into a single one and then export spectra to txt files which are easily imported to IRAF for further analysis. SRP is optimized for Poznań Spectroscopic Telescope but should be also able to handle spectra from other instruments as well.

2.  Features

  • reading FITS files up to 2048x2048 pixels with up to 100 echelle rows;
  • combining up to 10 bias and flat files, working with up to 1000 object and comparison spectra;
  • with at least 2 object spectra cosmic rays removal is performed by comparing them and removing any significant differences;
  • converting 2D spectra into 1D functions taking into account spectral lines tilt;
  • performing flat correction which corrects for pixel-by-pixel sensitivity differences as well as fringing effects;
  • identifying comparison spectra emission lines and fits dispersion function separately into each echelle rows or fits a common dispersion model;
  • removing continuum from objects spectra and combines + re-samples all rows into a single long row with constant dispersion step;
  • exporting combined spectra into txt files which are easily imported IRAF using task "rspectext";
  • creating nice pictures (in postscript files) for afterwards inspection after fully automatic reduction;

Most of limits listed here can be easily extended when needed by adjusting red.h file before compiling SRP.

3.  SRP screen-shots

On the separate page you can see how SRP actually looks during a typical reduction. SRP screen-shots

4.  Requirements, installation and running

The SRP package is written in C and distributed as a source code.

For compilation it requires (at least in my case):

  • gcc version 4.3.3
  • cfitsio version 3.13
  • pgplot version 5.2.2
  • gfortran version 4.4.1
  • libx11-dev version 1.2.2

All of them can bee easily installed in Ubuntu/Kubuntu 9.04 from their repository by typing:

sudo apt-get install pgplot5 libcfitsio3-dev libx11-dev gcc

Additionally you may need to install make program (useful for compiling):

sudo apt-get install make

After that all u need is to download source code, unpack it and compile it with "make" command in a terminal inside the directory with source code. Compilation should create many *.o files (which will not be used further) and an executable file "red" which should not be started by typing ./red because it requires a large amount of RAM memory and that may exceed stack size allowed for the program by an operating system. Instead you should use ./start command which is a simple bash script allowing for the program "red" to use more than default amount of RAM. This script will also create "ps" directory which is necessary for the SRP to output several postscript files during the reduction.

5.  Installation

6.  Running options

7.  Before you start

To start reduction with the SRP package you need to create working directory and copy all your spectra from a single night (bias, flat, comparison and object FITS files) into it. After that you need to copy the following files created by compiling SRP into that directory:

  • red
  • start

Remember to give them both permissions to execute. You cn do this with the following command: chmod u+x red start. After that you need to create ini directory inside your working directory and copy the following files into it:

  • contrem.ini
  • flat.ini
  • id.txt
  • makeone.ini
  • start.ini
  • thar_list.txt

Now you should inspect all files from ini directory and after that you can start reduction by typing ./start in a terminal inside your working directory.

Additionally you may need few more files before starting reduction. These are the following files inside your working directory:

  • *_trace
  • *_disp.txt

Depending on your configuration of start.ini file these two files should be created during a reduction. If you want to use the same dispersion model for several nights you may want to copy *_disp.txt file/files from the first night into other directories and adjust start.ini file (switch off reidentification and choose a proper wav_system). Similarly if you want to use the same trace in several nights (which is recommended when combining observations of the same object from several nights) you may want to copy *_trace file from the first night into other directories and adjust start.ini file (switch off tracing and choose a proper trace_name).

After reduction it is likely that you will want to convert resulting spectra into IRAF fits files. If this is the case you should also copy login.cl file and uparm directory that are distributed with the SRP into your working directory. With them it is easy to make the conversion.

8.  Main configuration file: start.ini

This is a short description of all parameters in start.ini file which should be present in ini directory among other *.ini files.

There are 15 procedures SRP can perform. Most of them have several parameters to adjust. All of them can be switched on and off if necessary. The order of parameters inside start.ini is meaningless as procedures are performed always in this order:

  • combine_thars - Used only when parameter wav_system=5. Combines all comparison spectra taken before the first object spectrum into a single file: comb_before.fits. Appropriately all comparison spectra taken after the last object spectrum are combined into comb_after.fits file. All intermediate comparison spectra are neglected and only these two combined files are used later.
  • fits_header - Adds the following header keywords into all selected fits files: DATE-OBS, EXPTIME, IMAGETYP, JD, OBSERVAT, OBSLONG, LONGITUD, OBSLAT, LATITUDE, OBSELEV, ALTITUDE, OBSERVER, MST. Additionally adds the following header keywords into selected object files: RA, DEC, EPOCH, HA, AIRMASS, HJD. All necessary data and calculations are based on either parameters in start.ini file or previously present keywords which are: EXPOSURE and DATE.
  • master_bias - Creates master bias file by calculating median of all pixels of all biases and excluding pixels which are too many sigmas away from median. Overwrights previous master bias file.
  • debias - Simply subtracts master bias from all other selected fits files (of course except bias files). Substruction is not performed if keyword DEBIAS in a given fits header is set to YES.
  • cosmic - Cosmic ray removal is performed by comparing all object fits and assuming that the spectrum should not change too much between close exposures. Not possible with a single object file. In such case I suggest to use a spectrum from another night if the previous assumption still applies. Cosmic ray removal is not performed if keyword COSMIC in a given fits header is set to YES.
  • trace_selected - Tracing of selected (usually flat) file and fitting polynomials to each echelle row. The result is saves into a file *_trace.
  • psf - Fits 2D gaussian profile into a selected emission line from comparison spectrum. This is used to determine line tilt angle. This angle is used in the following procedure of extraction 1D spectrum form 2D fits image. This angle is assumed to be constant allover the spectrum and allover the night. The result is saved into a file: *_psf.
  • oned - Extracts the spectrum from 2D fits image into 1D discreet function. The result is saved for each fits file into a new fits file: *_1D.fits.
  • master_flat - Creates master flat file by calculating median of all pixels of all flats. After that resulting spectrum may be normalized to 1.0 by dividing with fitted polynomials. Uses flat.ini file as input parameters for fitting polynomials to each row. Overwrights previous master flat file.
  • flatcor - Performs flat correction (using previously created master flat) of all object and comparison files.
  • reidentify - Performs identification of all emission lines in all selected comparison spectra. Uses identification file: id.txt for that purpose. When a line list is present (such as default thar_list.txt file) this procedure can search for additional lines identifications and create new identification file: id_new.txt which is than used to identify all subsequent comparison spectra. After identification this procedure performs a fit of a dispersion models and saves them into *_disp.txt files separately for each comparison spectrum.
  • wav - Applies dispersion model fitted previously to all object spectra in a selected way.
  • contrem - Fits and removes continuum level in all object spectra. Uses contrem.ini file as a definition of polynomials which should be used in each echell row.
  • makeone - Combines and resamples all echell rows together creating a single, long spectrum with a common dispersion step. Uses makeone.ini file as a definition of boundaries for each row defining regions to be combined (borders of each row are excluded as they have the lowest S/N ratio).
  • toiraf - Converts combines spectra into *_iraf.txt files. These are text files that can be directly imported in IRAF for further analysis.

Inside start.ini file you can use # sign at the beginning of a line to mark this line as a comment (it will be ignored by the package). Every line which is not a comment should have the structure of: parameter_name = parameter_value. You should avoid any spaces inside parameter names and values. Values can be numeric (integer of float) or text, depending on the kind of a given parameters. Parameters not defined in start.ini file will be given their default values.

8.1  File names and extensions

SRP identifies different file types by their names. These parameters are used to identify different type of files. Dark current files are currently not implemented. SRT only identifies them and lists on a screen but do not uses them at all. Only simple file name masks can be used (combinations of many * and ? signs may not work properly).

bias_name = bias*.fits (string with a single * or ? sign)

dark_name = dark*.fits (string with a single * or ? sign)

flat_name = flat*.fits (string with a single * or ? sign)

arc_name = thar*.fits (string with a single * or ? sign)

obj_name = object*.fits (string with a single * or ? sign)

These are master bias and master flat output file names:

mbias_name = MBIAS (string)

mflat_name = MFLAT (string)

This is the root of a name of files created by the last SRT procedure 'toiraf'. Output file names will begin with this text and end with creation date ex. object_2008-11-11_02-34.fits

iraf_name = object (string)

This is the fits files extension used when creating any new fits file.

fits_extension = fits (string)

8.2  Observatory and observer

I suggest to use observatory name that is understandable by IRAF - this helps further analysis. Longitude and latitude are positive for East and North. Altitude is in meters. Geographic coordinates are used to calculates several fits header keywords.

obsname = bor (string)

obslong = +17.0746 (float)

obslat = +52.2770 (float)

obselev = 124.4 (float)

Observer name or symbol is only for information purpose.

observer = KK (string)

8.3  Object coordinates

You can only reduce single object at one time. You should provide equatorial coordinates that will be used to calculate several fits header keywords.

ra = 2.34567 (float, hours)

dec = 12.3456 (float, deg)

epoch = 2000.0 (float, years)

8.4  What to do section

All parameters in this section have only two possible text values: yes or no. Here you can choose which procedure should be performed and which should be skipped. Skipping procedures can be useful when you want to re-reduce your data from a given point or when you had to break reduction process and want to resume it. It should be safe to restart reduction from any stage but sometimes several parameters should be adjusted as well.

fits_header = yes (string: yes or no)

master_bias = yes (string: yes or no)

debias = yes (string: yes or no)

cosmic = yes (string: yes or no)

trace_selected = yes (string: yes or no)

psf = yes (string: yes or no)

oned = yes (string: yes or no)

master_flat = yes (string: yes or no)

flatcor = yes (string: yes or no)

reidentify = yes (string: yes or no)

wav = yes (string: yes or no)

contrem = yes (string: yes or no)

makeone = yes (string: yes or no)

toiraf = yes (string: yes or no)

8.5  Bias and debias options

This parameter is the number of sigmas used when rejecting deviated pixels form biases before creating master bias file.

bias_sigma = 5.0 (positive float)

This is a constant value added to each master bias pixel only to avoid negative values.

add_const = 100 (positive integer)

8.6  Trace options

This parameter switches on or off plotting of some graphs during reduction. These plots are only informative.

trace_inter = yes (string: yes or no)

This is the name of a file (with extension) to be used for tracing the spectrum. This should be a well exposed spectrum. Program will first try to determine number and position of rows in a central part of spectrum then trace (fit with low order polynomial) every individual rows. With 'auto' option you allow the program to use first flat spectrum to trace, otherwise a full name of a chosen file should be given. This name will be also used as a beginning of a name of the output file (file_name + _trace).

trace_name = auto (string)

This is the order of a polynomial used to trace each echell row.

trace_order = 4 (integer between 2 and 6)

This is the width in pixels of a central strip used when this procedure searches for rows.

trace_width = 40 (even positive integer)

This is the number of columns the traced file will be divided in. In each column pixels are median averaged and position of rows is determined. These points are then fitted with polynomials.

trace_nr_of_col = 200 (even positive integer)

This is the threshold level used when determining rows position in each column of the traced file. Lower values will rise the probability of detecting noise pixels as a pixels of a given row.

trace_sigma = 1.5 (positive float)

8.7  Cosmic options

Cosmic rays removal is made by comparing at least two object and at least two flat files. When in given file pixels much higher than in the reference file are detected then they are "erased" and filled with values taken from reference file. Different exposure levels are of course taken into account. The search for cosmic rays is done in two stages. In the first stage cosmic_min1 and cosmic_grow1 are used. The threshold level should be higher to exclude false detections. The threshold level (=maximum difference between given and reference spectrum) is calculated as: cosmic_min1 + cosmic_grow1*pixel_value^cosmic_exponent

cosmic_exponent = 0.8 (positive float)

cosmic_min1 = 25.0 (positive float)

cosmic_grow1 = 1.5 (positive float)

The second stage is using the same threshold equation just with lower coefficients of cosmic_min2 and cosmic_grow2. This time only pixels close to previous detections are checked, other detections are neglected. Thanks to that also weak borders of cosmic rays are detected without the risk of false detections.

cosmic_min2 = 0.0 (positive float)

cosmic_grow2 = 0.8 (positive float)

This parameters switches on or off cosmic ray removal procedure for selected object files.

cosmic_files = yes (string: yes or no)

This parameters switches on or off cosmic ray removal procedure for selected flat fields.

cosmic_flat = yes (string: yes or no)

8.8  PSF options

This parameter switches on or off plotting of a nice graph during reduction. This plot is only informative.

psf_inter = yes (string: yes or no)

Here you can type name (with extension) of a file to be used by this procedure. Typing 'auto' will result in automatic selection of a first comparison spectrum.

psf_name = auto (string)

This is a position of a center of selected emission line to fit with 2D gaussian profile.

psf_x = 753 (positive integer)

psf_y = 2022 (positive integer)

This a size of a square box selected around he point selected above. Only this box will be fitted.

psf_size = 21 (odd integer <=41)

This is used primarily as a starting parameter by a fitting routine (angle between longest emission line axis and X axis of a fits file). Additionally if 'psf_fit' is set to 'no' then this angle is used directly without fitting.

psf_ang = 1.5 (positive float, radians)

psf_fit = yes (string: yes or no)

8.9  Oned options

This routine performs conversion of 2D spectrum into 1D function of all object, flat and comparison spectra. It requires *_trace file defined above (with 'trace_name' parameter) as well as *_psf file (defined by 'psf_name' parameter) or alternatively 'psf_ang' if 'psf_fit' is set to 'no'. If 'oned_inter' is set to 'yes' than some nice plots are projected on screen that allow user inspection of spectral extraction results.

oned_inter = yes (string: yes or no)

The signal level is a sum of pixel values around trace function inside a tilted stripe in y range defined by the following parameters:

oned_ymin = -8.0 (negative float)

oned_ymax = 8.0 (positive float)

The first 'pixel size' (= x step in extracted 1D function) used when extracting spectrum in each row is defined here. The following x steps are calculated automatically to preserve the tilted strip width. This usually means that the x steps are not equal inside a row and not changing in the same way in every row.

oned_x_first_step = 1.0 (positive float <= 1.0)

There are two areas of a tilted stripe used to estimate background level. Inside each area (one above and one below trace function) median level is calculated and linear function is fitted between these two medians. This fitted function is then used to estimate background level at pixels occupied by spectral rows.

oned_top_ymin = 8.0 (positive float)

oned_top_ymax = 13.0 (positive float > oned_top_ymin)

oned_bottom_ymin = -13.0 (negative float)

oned_bottom_ymax = -8.0 (negative float > oned_bottom_ymin)

Is a signal level of even one pixel inside spectral signal or background estimation area is greater than the value below than that pixel is marked as overexposed. Nevertheless it will be used further in reduction process. This is only for user information purpose.

oned_overexpose = 60000 (positive integer)

8.10  Flat correction options

The flat correction routine performs the following operations: creates master flat, optionally normalizes master flat to 1.0, divides 1D spectra with master flat. It uses flat.ini file and normalization can be performed interactively. In such a mode a graph will be plotted on screen with a given row and a fit of a polynomial defined in flat.ini file. User can then change polynomial parameters inside flat.ini file and order to refit that row. In such a way all parameters for all rows can be adjusted.

flat_inter = yes (string: yes or no)

This procedure is looking for FLATCOR header keyword. If its value is YES than flat correction is omitted. This behavior can be overridden with 'flat_force' parameter set to yes.

flat_force = no (string: yes or no)

With 'flat_mode' parameter user can switch on (0) or off (1) master flat normalization.

flat_mode = 1 (integer: 0 or 1)

Function fitted to each master flat row defines a kind of continuum level. If an actual spectral point is greater than continuum level more times than 'flat_limit' or is smaller than (continuum level)/'flat_limit' than that point is excluded. Normalized master flat spectrum is set to 1.0 in such points. This parameter is ignored when normalization is not performed.

flat_limit = 3.0 (positive float > 1.0)

Sometimes signal level even in master flat is too low and noise pixel to pixel variations are greater than real sensitivity variations. To prevent such situations every point which has fitted continuum level lower than 'flat_min' is set to 1.0 (for normalized master flat) or 0.0 (when normalization is switched off).

flat_min = 800.0 (positive float)

8.11  Reidentify options

Reidentification routine uses 'reid_database' file to identify as many as possible emission lines in comparison spectra. In interactive mode (parameter below is set to yes) user is allowed to refit dispersion model for each echelle row after modifying 'reid_database' file. When 'reid_type' is set to '1' than even more interaction is allowed. User can select and exclude from fitting some emission lines as well as save (overwrite) current set of emission lines into currently used database file.

reid_inter = yes (string: yes or no)

When 'reid_type' is set to '1' than the parameter below sets the order of polynomial used to fit each echelle row. Otherwise it is not used.

reid_order = 5 (positive integer)

This is the maximum difference in pixels between line position defined in 'reid_database' file and line position found in a comparison spectrum.

reid_delta = 3.0 (positive float)

These are signal limits. The line maximum signal must be between these to values for the line to be used when fitting dispersion function.

reid_min = 200.0 (positive float)

reid_max = 6000000.0 (positive float)

This is the name of a text file with line identification used with the first comparison spectrum (when 'reid_mode' is set to '1') or with all comparison spectra (when 'reid_mode' is set to '0').

reid_database = id.txt (string)

When mode is set to '0' then 'reid_database' is used with all comparison spectra. When mode is set to '1' then 'reid_database' file is used to identify emission lines only with first comparison spectrum defined by 'reid_first_file'. Than that the dispersion model fitted to the first file is used to identify new lines using line list defined by 'reid_line_list' text file. The result is saved into 'reid_new_db' text file. After that reidentification of emission lines starts again for all comparison spectra but with newly created line identification file.

reid_mode = 1 (integer: 0 or 1)

When type is set to '0' then separate dispersion function fits are performed for each row (and less interaction with user is allowed). When type is set to '1' then a common dispersion model is fitted into all rows at once. This last option is preferred when comparison spectra have less than five identifiable emission lines in each of its echelle rows.

reid_type = 1 (integer: 0 or 1)

The first file name (with extension) used when 'reid_mode' is set to '1'. When 'auto' is typed than first selected comparison spectrum is used.

reid_first_file = auto (string)

This is a file name (with extension) of a file created when 'redi_mode' is set to '1'.

reid_new_db = id_new.txt (string)

This is a file name (with extension) of a line list used when 'redi_mode' is set to '1'.

reid_line_list = thar_list.txt (string)

This is the maximum difference between a given emission line wavelength from 'reid_line_list' file and from 'reid_first_file' spectrum used when 'redi_mode' is set to '1'.

reid_delta_lam = 0.05 (positive float)

When common dispersion model is used ('reid_type' is set to '1') than the weighting mechanism may be used. If 'reid_weight' is set to '1' then for each row the same common model is used (as expected). If 'reid_weight' is greater than 1 than stronger weights are applied to a given row lines than for other lines. In this way user can adjust the level of a row binding to other rows. With 'reid_weight' of a very high value (say 1000) the common dispersion model will resemble totally separate fits to each rows (as when 'reid_type' is set to '0'). This mechanism was introduced when I realized that a common dispersion model alone used in SRP does not represent properly dispersion function for several rows despite any adjustments applied to the model. With weighting mechanism a common dispersion model can be kept as simple as possible (it has 26 parameters) and numerical errors are in control.

reid_weight = 100 (positive integer > 0)

8.12  Wav options

This routine is used to calculate and apply dispersion function for object (and flat) spectra. It uses the results from reidentification routine which are saved into *_disp.txt files. There are several possible ways in doing that. If 'wav_system' is set to '1' than this routine is searching for the closest (in JD time) comparison spectrum and copies its dispersion into a given object and flat file. If the parameter is set to '2' then two side closest comparison spectra are selected and linear interpolation between then is used. If the parameter is set to '3' then a dispersion function from a single comparison spectrum (selected with 'wav_thar') is used for all object and flat spectra. With the parameter set to '4' mean of all dispersion functions from all comparison spectra is used for all object and flat spectra. Finally when the parameter is set to '5' then the program uses only two special averaged comparison spectra: comp_before.fits and comp_after.fits. These are means of all comparison spectra made before and after every object spectrum. They both are used as in mode '2'.

wav_system = 2 (integer: 1, 2, 3, 4, 5)

This is the name (with extension) of a comparison file used when 'wav_system' is set to '3'

wav_thar = thar_01.fits (string)

8.13  Contrem options

This routine uses contrem.ini file as input. It divides each point of each row with a polynomial fitted to the spectrum and hoped to resemble true continuum. When interactive mode is selected you are allowed to inspect the result for each row and modify contrem.ini file during that time. After any modification you can press 'r' to refit the row and verify the results of modification.

contrem_inter = yes (string: yes or no)

Sometimes fitted continuum have unrealistic low value or even negative one. In such case dividing by it has no sens. Therefore continuum is removed only from this parts of spectrum which have continuum level above 'contrem_min' value. The lowest safe value is about 1.0.

contrem_min = 1.0 (float)

8.14  Makeone options

This routine combines and resamples all rows of all your reduced object spectra. It uses makeone.ini file as input. With interactive mode set to 'yes' nice plots are drawn o screen.

makeone_inter = yes (string: yes or no)

This routine can conserve the amount of signal in each bin during resampling of a spectrum. This is useless when continuum removal was performed but otherwise can be necessary when flux calibration is planned further in IRAF.

makeone_conserve = no (string: yes or no)

When 6 is selected then true signal (after background removal) is saved in resampled spectra. With 3 full signal is used.

makeone_type = 6 (integer: 3 or 6)

9.  Other configuration files

9.1  contrem.ini

Below there is the beginning of a configuration file used by continuum removal procedure. Lines beginning with # are ignored.

 #row nr is significant here!
 #row   polynomial   sigma   sigma
 #nr    order        up      down
  0      10            2.0     0.5
  1      10            2.0     0.5
  2      10            2.0     0.5
  3      10            2.0     0.5
  4      10            2.0     0.5
  5      10            2.0     0.5

You can define here order of a polynomial fitted during continuum removal procedure for each row. You can also define point rejection rules by setting number of sigma used for that purpose. The number of rows in this file should match the number of rows in your echelle spectra.

9.2  flat.ini

This is a full flat.ini file used when normalizing master flat spectrum. Again lines beginning with # are ignored.

 #fited  row       reference row   polynomial   eps      bin
 #start  stop      start    stop   order
  0       0          0        0       12        1.0e-4    1
  1       1          1        1       12        1.0e-4    1
  2       2          2        2       12        1.0e-4    1
  3       3          3        3       12        1.0e-4    1
  4       4          4        4       12        1.0e-4    1
  5       5          5        5       12        1.0e-4    1
  6       6          6        6       12        1.0e-4    1
  7       7          7        7       12        1.0e-4    1
  8       8          8        8       12        1.0e-4    1
  9       9          9        9       12        1.0e-4    1
 10      10         10       10       16        1.0e-4    1
 11      11         11       11       16        1.0e-4    1
 12      12         12       12       16        1.0e-4    1
 13      13         13       13       16        1.0e-4    1
 14      14         14       14       16        1.0e-4    1
 15      15         15       15       16        1.0e-4    1
 16      16         16       16       16        1.0e-4    1
 17      17         17       17       16        1.0e-4    1
 18      18         18       18       16        1.0e-4    1
 19      19         19       19       16        1.0e-4    1
 20      20         20       20       20        1.0e-4    1
 21      21         21       21       20        1.0e-4    1
 22      22         22       22       20        1.0e-4    1
 23      23         23       23       20        1.0e-4    1
 24      24         24       24       20        1.0e-4    1
 25      25         25       25       20        1.0e-4    1
 26      26         26       26       20        1.0e-4    1
 27      27         27       27       20        1.0e-4    1
 28      28         28       28       20        1.0e-4    1
 29      29         29       29       20        1.0e-4    1
 30      39         30       39       12        1.0e-6    2
 40      63         40       63       12        1.0e-6    2

There are two ways of using this file. In a typical way you can define polynomial order for a single echelle row. In such case the row nr should be repeated four times. After these numbers you should put the order of polynomial fitted into a given row. The last two parameters should also be written but are not used. With such a configuration given row will be simply fitted with a polynomial of a given order. Example:

 12      12         12       12       16        1.0e-4    1

The second way is useful when several orders of a master flat are distorted by fringing or other effects. In such case direct polynomial fit can give very bad results. In order to deal with this problem the procedure first simply fits selected range of rows with a polynomial, than selects the best fit (lowest sum of squares residuals) and after that uses that specific (best) polynomial to fit again selected rows. This time only simple shifts and scale adjustments are allowed, other polynomial parameters are fixed. In configuration file the first two numbers define the range of rows used for the first fit while third and fourth numbers define the range of rows for the second turn fit with the best polynomial. The fifth parameter is again the order of a polynomial while sixth is the ending condition for the second turn fitting algorithm. The last parameters define optional binning which can speed up fitting and smooth distorted rows. Example:

 40      63         40       63       12        1.0e-6    2

9.3  id.txt

This is the beginning of a file used to identify emission lines in comparison spectra by the reidentify routine. Again lines beginning with # are ignored.

 #nr of rows
 #row nr (int) (the value is ignored - this is just for human reader),  x shift [pixels] (double),  nr of lines (int)
 #x [pixels] (double), lambda [A](double)
 64
  0    0.0     17
       274.3    4545.0518
       389.3    4540.9990
       483.8    4537.6426
       550.2    4535.2544
       904.6    4522.3232
       934.9    4521.1938
       987.1    4519.2593
      1097.8    4515.1182
      1136.4    4513.6797
      1148.3    4513.2231
      1214.1    4510.7334
      1325.9    4506.4731
      1359.1    4505.2168
      1418.8    4502.9268
      1495.4    4499.9834
      1522.4    4498.9399
      1666.8    4493.3335
  1    0.0     16
        49.3    4589.8979
       349.2    4579.3496
       582.0    4570.9722
       684.3    4567.2402
       761.3    4564.4053
       843.7    4561.3477
       924.5    4558.3457
       992.1    4555.8125
      1088.9    4552.1538
      1204.5    4547.7588
      1218.1    4547.2500
      1252.8    4545.9155
      1275.4    4545.0518
      1306.3    4543.8691
      1380.9    4540.9990
      1467.2    4537.6426

The first line tells the program how many rows we describe in the file. The second line is the header, similar for each echelle row. It describes the echelle row number, the echelle row shift in pixels (usually = 0.0) and nr of lines in configuration file below the header. After such a header there are several lines with position of an emission line in pixels and its wavelength in Angstroms. The same structure: header + several lines before, should appear in this file for every single row of echelle spectrum. Such a file is the primary source of emission line identification by the SRP package.

When using the SRP package for the first time it is possible that you will have to create such a configuration file by hand. You should describe at least 4-5 emission lines for each echelle row. Only them the program will be able to fit a useful dispersion model. After that you can turn on automatic identification of other emission lines with reidentify options in start.ini file and other lines will be automatically identified.

9.4  makeone.ini

This is the beginning of a configuration file used by makeone procedure. Again lines beginning with # are ignored.

 #lambda limits for rows (should be 1 more then rows number) sic! ordered list!
 4500.0
 4536.8
 4573.8
 4611.4
 4649.6
 4688.6
 4727.9
 4768.2
 4809.1
 4850.8

This file contains a simple list of values in Angstrems to be used when combining given spectrum. For example makeone routine will select spectrum from 4500.0 to 4536.8 from the first row, from 4536.8 to 4573.8 from the second row and so on. Only selected in this configuration file, central parts of echelle rows will be combined and resampled. Edges wilt the lowest S/N ratio are ignored. Obviously there should be one more entries in this file than the nr of rows in echelle spectrum.

9.5  thar_list.txt

This is the beginning of a very long configuration file containing a list of wavelengths of all possible emission lines in comparison spectra. This may be needed by reidentify procedure.

 3220.3508 ThII
 3229.0095 ThII
 3230.8679 ThII
 3235.8401 Th
 3238.1157 ThII
 3238.9343 ThI
 3243.6887 ArII
 3244.4487 ThI
 3245.7603 ThII
 3249.8003 ArII
 3251.9160 ThI
 3252.9644 Th
 3253.8660 ThI
 3254.8098 ThII

Only the first column is red by the routine, line names are ignored. This file is only needed when '' option is set to 'yes'.

10.  Additional files that may be used as input by SRP

The following files are normally created by the SRP during reduction inside your working directory (not in ini directory). They contain results of some procedures needed by other procedures further. Optionally they may be used as input files when for example you want to use exactly the same trace functions in several nights. In order to do that first you must switch off a proper procedure by setting a proper parameter in start.ini file. Second, you must supply appropriate file before starting reduction into your working directory. Third, you must set a proper file name in several parameters in start.ini file. After that the SRP will use supplied trace or dispersion files instead of creating new ones.

10.1  *_trace

This is a beginning of a *_trace file created by the SRP during a normal reduction process.

 64 4
 22.326165 0.061917 -0.000037 -0.000000
 69.574968 0.062254 -0.000037 -0.000000
 116.016186 0.063023 -0.000037 -0.000000
 161.688835 0.063898 -0.000037 -0.000000
 206.672019 0.064387 -0.000037 -0.000000
 251.231462 0.063767 -0.000035 -0.000000
 294.658903 0.065355 -0.000037 0.000000
 337.760783 0.065078 -0.000036 -0.000000
 379.862623 0.066016 -0.000036 -0.000000
 421.798924 0.065398 -0.000035 -0.000000
 462.693961 0.066416 -0.000035 -0.000000
 503.110630 0.066771 -0.000035 -0.000000
 543.029715 0.066800 -0.000035 -0.000000
 582.133700 0.067016 -0.000034 -0.000000
 620.765330 0.067997 -0.000035 0.000000

First line tells the program how many rows there are in this file (after the first one) and how many parameters there are in each row. The number of rows should match the number of echelle rows in your spectra. This file is a result of trace procedure and contains information of a polynomial fitted into each row of a selected file (usually a flat field). To use this *_trace file as an input you must set 'trace_selected' to 'no' and 'trace_name' to a file name of a file which was used to create your *_trace file. For example if you want to use trace file: flat_01.fits_trace than you must set 'trace_name' to 'flat_01.fits'.

10.2  *_disp.txt

This is a beginning of a *_disp.txt file created by the SRP during a normal reduction process.

 #nr of rows
 #nr of parameters
 #list of parameters
 64
 5
 4.5545609837833235e+03 -3.4181043303480499e-02 -1.7153032406182708e-06 1.1859376368794146e-10 -4.6810442200337191e-15
 5
 4.5916052032876678e+03 -3.4508529049285960e-02 -1.6732683146801962e-06 8.1751821075778753e-11 3.7262751446729654e-15
 5
 4.6292407883517326e+03 -3.4752688619726829e-02 -1.7541499397025290e-06 1.2298674403840821e-10 -5.3573727156803539e-15
 5
 4.6675088623575111e+03 -3.5075713016057705e-02 -1.7162958027922346e-06 9.0522679780102497e-11 1.5148485739234778e-15
 5
 4.7064008275575670e+03 -3.5321317770242444e-02 -1.8182176266606050e-06 1.4518758161049536e-10 -1.1316792004194061e-14
 5
 4.7459295458818497e+03 -3.5509155261423175e-02 -2.0369744380763299e-06 3.1368374569989616e-10 -5.4462408726621261e-14
 5
 4.7861866062011104e+03 -3.6047074852667609e-02 -1.5852434197069220e-06 -7.3400371101273714e-11 4.9109423000842473e-14
 5
 4.8270891146245413e+03 -3.6304160438668631e-02 -1.7314977274835114e-06 5.2436174868657313e-11 1.1260569434392457e-14

Excluding comments marked with # the first file is the number of echelle rows in your spectra. Than goes the number of parameters and in the next line the parameters themselves. These are dispersion functions fitted to all rows of a given comparison spectrum. This file may be used as input if you want to use the same dispersion model into several nights. In order to do that you must set 'reidentify' parameter to 'no', set 'wav_system' to '3' and set 'wav_thar' to a file name that was used to create your *_disp.txt file. For example if your dispersion file name is thar_01.fits_1D.fits_disp.txt than 'wav_thar' should be set to thar_01.fits.

11.  Converting to IRAF

After full reduction of echelle spectra with the SRP you will get a set of text files named: *_iraf.txt which contains reduced object spectra and full fits headers. Additionally two files with a list of file names inside them are generated: iraf_in.txt and iraf_out.txt. There should be also login.cl file and uparm directory included with the SRP package. All this enables easy conversion of reduced spectra to IRAF fits format. To do this you should have IRAF installed in your computer. After the reduction made by SRP you should type: xgterm inside your working directory. New terminal should appear. Inside it type: cl and automatic conversion will start. Several output *.fits files should be created. Names of new files are starting with 'iraf_name' parameter defined in start.ini file and followed by the date and time of creation (observation) of a given spectra.

If you are aware of IRAF you can use splot function to visualize and verify the results and/or perform any further analysis of the spectra you want. In other case you can quit IRAF by typing logout and close the new terminal by typing quit afterwards.

12.  Download

All versions of SRP are distributed as C source code with configuration files (working for PST) and bash script necessary to start the SRP. Additionally they have login.cl file and uparm directory which are useful when you want to convert spectra to IRAF fits format right after reduction with SRP. User should compile it and copy: "red", "start", "login.cl" files as well as "ini" and "uparm" directories into a directory with spectra to reduce. In case of PST vestions user should also copy "flat_64.fits_trace" or "flat_56.fits_trace" file.

Version File Comments
PST reduction in config. with 64 rows (before 2009-08) Attach:SRP_PST64_2010-07-16.tar.gz Prepared for reduction of PST spectra with 64 rows. Contains additional files: flat_64.fits_trace, ./ini/id_64.txt and is configured to use them.
PST reduction in config. with 56 rows (after 2009-08) Attach:SRP_PST56_2010-07-16.tar.gz Prepared for reduction of PST spectra with 56 rows. Contains additional files: flat_56.fits_trace, ./ini/id_56.txt and is configured to use them.

For convenience I also put here some "contrem*.ini" files that may be used instead of default ones. If your object spectral type is close to one of listed below than you should download "contrem*.ini" file rename it to "contrem.ini" and replace default "contrem.ini" file in "ini" directory.

PST File Spectral type Description
64 Attach:Contrem_PST64_F7I.ini F7I numerous narrow lines
56 Attach:Contrem_PST56_B5IV.ini B5IV a few wide lines

13.  Example of a reduction with SRT

To learn using the SRP I suggest you to first reduce the following set of spectra. They are taken with Poznań Spectroscopic Telescope and all necessary configuration files are also included to start reduction right away. Just extract the spectra and configuration files into a directory, than compile the SRP package and copy the compiled 'red' file into that directory. After that you can start reduction by running start script (by typing './start') into a terminal inside your directory with spectra and 'red' file.

Version File
PST reduction in config. with 64 rows (before 2009-08) Attach:Example_spectra_PST64.tar.gz
PST reduction in config. with 56 rows (after 2009-08) Attach:Example_spectra_PST56.tar.gz

After reduction you can compare your results with the following files. These are fully reduced example spectra including conversion to IRAF fits format.

Version File
PST reduction in config. with 64 rows (before 2009-08) Attach:Example_reduction_PST64.tar.gz
PST reduction in config. with 56 rows (after 2009-08) Attach:Example_reduction_PST56.tar.gz

You can optionally restart reduction of the last example to see the effects. Most procedures should be repeated and results overwritten.

14.  Copyrights

SRP is provided as is without any warranty.

SRP is free for personal or educational use and modifications without permission of its author but references should be always attached with the package itself or any of SRP derivatives.

SRP or its derivatives cannot be used for commercial purposes or redistributed without permission of its author.

Page last modified on November 08, 2010, at 06:12 PM