4DAO Cookbook Version 1.0 (Nov 2013)

4DAO Cookbook

1 Introduction

4DAO is a FORTRAN code designed to launch automatically DAOSPEC (Stetson & Pancino, 2008) for a large sample of spectra. The main aims of 4DAO are: (1) to allow an analysis cascade of a list of spectra provided in input, by automatically writing the input DAOSPEC files and managing its output files; (2) to optimize automatically some spectral parameters used by DAOSPEC in the process of equivalent width (EW) measurement, above all the Full Width Half Maximum (FWHM); (3) to mask some spectral regions (telluric lines, interstellar features, photospheric lines with prominent Lorenztian wings) that can bias the correct EWs measurement; (4) to provide suitable graphical tools in order to evaluate the quality of the solution, especially of the Gaussian fit to each individual spectral line; (5) to provide the final normalized, zero radial velocity spectra.

2 About Daospec

Here the basic use of DAOSPEC is drawn but we refer the user to the official documentation of this code (Stetson & Pancino, 2008, and the DAOSPEC Cookbook1). DAOSPEC is a code that automatically identifies absorption spectral lines, estimates the continuum with a Legendre polynomial, measures the EWs and the radial velocities (RVs) for all the detected lines, and identifies among them the lines provided in an input line list. The measurement of the EWs is performed adopting a saturated Gaussian function and using the same FWHM for all the lines. One of the most interesting features of DAOSPEC is the computation of a global continuum that takes into account the effects of weak lines.

Among the different input parameters, the most important are the value of the FWHM (FW), the order of Legendre polynomial used to fit the continuum (ORD), the residual core flux (RE, useful to refine the EW measurement for strong lines) and the possible scaling of the FWHM with the wavelength (SC). DAOSPEC can run by using a fixed value of the FWHM, chosen by the user, or alternatively the FWHM is refined according to the residuals of the spectrum.

3 Basic layout of 4dao

At the first run, the analysis starts by adopting as FWHM the input value specified by the user and investigating a range of RVs specified in input. DAOSPEC runs, finding new values of FWHM and RV. If the difference between the input and output FWHM is larger than a threshold value (chosen by the user, see Section 5), a new run of DAOSPEC is called, starting with the output FWHM of the previous run as new input value, and moving in a range between RV-5 and RV+5, where is the dispersion of the mean RV as computed by DAOSPEC by using the matched lines. During the process of RV determination, the DAOSPEC parameter VE (that is the number of standard deviations from the mean radial velocity used to discard the discrepant lines) is set to 3 by default.

During the first iteration, the RE parameter can be tuned according to different recipes, chosen by the user (see Section 5). Basically, RE can be:

(i) chosen by the user as fixed parameter,

(ii) determined by using the central depth of the strongest line available along the spectrum. In this case 4DAO will read the .daospec file, looking for the line with the highest EW, among all the measured spectral lines (and not only the matched ones). Also, in the identification of the strongest line available among those measured by DAOSPEC, 4DAO does exclude automatically lines lying in spectral regions affected by non-photospheric transitions (like telluric and interstellar features). These regions are stored in the code and listed in Table 1;

(iii) determined by using the central depth of a precise spectral line provided by the user.

The optimization of the FWHM can be affected by the presence in the observed spectrum of non-photospheric lines (like telluric or interstellar features, whose FWHM will be different with respect to that of the photospheric lines), ruined spectral regions or zones dominated by wide damped wings (as the Balmer lines or the Calcium II triplet lines). 4DAO allows to mask spectral regions that the user wish to exclude by the analysis. When this option is enabled, 4DAO performs a first run of DAOSPEC on the entire spectrum; then the regions to be masked are substituted with the continuum spectrum estimated by DAOSPEC. Because the presence of flat spectral regions can create problems with DAOSPEC, Gaussian noise (estimated according to the estimated average residuals) is added in these regions, following the prescriptions by Press et al. (1992). Fig. 1 shows an example of this process, where the regions corresponding to the Na D interstellar lines have been masked in a UVES-FLAMES spectrum of a giant star in the globular cluster NGC 5694 (Mucciarelli et al., 2013a). This temporary file (called masked.fits) is used in the following runs of 4DAO and when the FWHM converges, the last run is performed on the original spectrum.

When the difference between the input and output FWHM reaches the threshold value, a final run of DAOSPEC is performed, but keeping the FWHM fixed at the value optimized in the previous iteration. The output on the terminal summarises for each iteration the input FWHM (expressed in pixels), the RE value, the used range of radial velocities (RV1 and RV2) with the average RV derived in the previous iteration. Additionally, if the spectral mask is enabled, a label advises of the use of this option.

During the execution, the basic input files of DAOSPEC, namely laboratory.dat and daospec.opt, are written and managed by 4DAO, while the output messages that usually DAOSPEC writes on the terminal, are written in a temporary file named log.daospec. Also, the graphical output on the monitor usually provided by DAOSPEC is automatically disabled.

4 Installation

Once you have downloaded the archive file 4DAO_v*.*.tar.gz from the website

www.cosmic-lab.eu/Cosmic-Lab/Products.html,

type the commands

gunzip 4DAO_v*.*.tar.gz
tar -xvf 4dao.tar

These commands unpack the archive file creating a directory named 4DAO/, including the source files and the Makefile needed to compile the code. Additionally, a sub-directory named tutorial includes some examples of the configuration files to check quickly if the code is well installed. To compile the code you need to have installed in your machine the same libraries that you have used to install DAOSPEC : (1) the SuperMongo2 (SM) libraries (namely libplotsub.a, libdevices.a and libutils.a, compiled in single precision), (2) the X11 libraries, and (3) the libcfitsio.a library 3. 4DAO can be compiled with the Intel Fortran Compiler, that you can download from the Intel website4, after the registration. The Makefile can be easily updated, by properly setting the paths of the requested libraries. Before to start the 4DAO installation, check that the installation of all the requested libraries is correct (basically, if you have already installed DAOSPEC you should be already solved all the problems about the installation of these libraries). However, we refer the reader to Section 4 of the DAOSPEC Cookbook and to Section 3 of the GALA Cookbook5 for the description of some common installation problems and their possible solution. Also, 4DAO makes use of the GPL Ghostscript software (executable gs), freely available at http://www.ghostscript.com; please, check if gs is installed on your machine.
The installation procedure assumes that you have already installed DAOSPEC on your machine (if you have not yet done, do it!) and that the executable file is named daospec (in lower-case letters) and its path already stored in your login file. If your executable is named with a different name, before to install 4DAO you need to properly set the variable nexe in the 4dao.f source file.

Now you can install 4DAO, typing the command

make all

and the executable 4dao will be saved in the current directory. Finally, put the path of this directory in your login file according to the shell environment of your machine (for instance in the configuration file .bashrc or .tcshrc)

In order to check the installation, go to the tutorial subdirectory, hold your breath, cross the fingers and type 4dao.

5 Input files

Only two specific input files (besides the input spectra and the line lists) are necessary to run 4DAO, a configuration file named 4dao.param and a file with the list of the spectra to be analysed, named 4dao.list.

(1) 4dao.param
The input file 4dao.param includes the main configuration parameters, adopted in the analysis of all the star listed in 4dao.list. The layout of the file is as follows:

  • tol is the minimum difference (expressed in pixels) between the values of the FWHM derived by DAOSPEC in two consecutive iterations. When this difference is smaller than this parameter, 4DAO assumes that the convergence is reached and the FWHM obtained in the last iteration is taken as the final value. If the FWHM is fixed to the input value (see below for the 4dao.list file), this parameter is ignored.

  • nimax is the maximum number of allowed iterations. Typically, 4DAO needs of less than 5 iterations to converge to a stable FWHM value, but this parameter is useful to avoid infinite loops due to unforeseen problems with your spectra.

  • fmax is the maximum value allowed for the FWHM (expressed in pixels). If the FWHM exceeds the value of this parameter, the convergence process is stopped to the last iteration and the star flagged to easily identify the occurrence of this problem.

  • plot specifies the kind of output plot created for each spectrum. The allowed values are 0 (the line plots will be sorted according to their wavelengths) and 1 (the line plots will be sorted according to corresponding element). If different values are provided, 4DAO sets automatically this parameter to 0.

  • verbose specifies the verbosity level on the terminal. Accepted values are 0 (no message at all), 1 (only the sequence of the analysed spectra is shown), 2 (all the information about the procedure is shown).

  • restart is the initial value of the residual core flux RE parameter. 4DAO includes different ways to estimate this parameter, but if the code fails to derive a reliable parameter (we assumed that RE ranges from 0 to 30), RE will be set to the value specified by restart.

  • output specifies the format for the output (normalized and radial velocity-corrected) spectra: with F (or f) the output spectra will be created in standard FITS format, since with A (or a) will be written in ASCII format (the wavelength in the first column and the normalized flux in the second column). If different values are provided, the output will be created in ASCII format.

  • clean deletes some files used by DAOSPEC, like laboratory.dat, daospec.opt, log.daospec and all the files related to the mask of some spectral regions. The allowed options are Y (or y) and N (or n). Because in the execution of a sequence of spectra these files are over-written, 4DAO will save only the files related to the last spectrum. The option clean=n can be useful to check individually all the temporary files for some problematic spectra.

  • gala specifies if the output format is that needed for the input files of GALA (Mucciarelli et al., 2013b) or not. If the parameter is Y/y (the default value) the output file will be written for GALA, for all the other character values, the output file will include all the information included in the input line list, reading it as a string.

  • conter enables the measurement of the EWs by varying the continuum level. This is a crude way to provide a conservative estimate of the impact of the continuum location on the measured EWs. During this procedure, the normalized spectrum is lowered and raised by the relative flux dispersion in the residual spectrum (as listed in the .daospec output file). Then, 4DAO repeats the same procedure used for the original spectrum, but assuming ORD=--1, thus fixing the continuum level at 1. The allowed values are -1 (to disable this option), 0 (to re-calculate the EWs after a new optimization of the FWHM starting from the best value obtained in the main procedure) and 1 (to re-calculate the EWs by fixing the FWHM at the best value finding in the main procedure).

(2) 4dao.list
This file lists the sequence of spectra that you plan to analysis with DAOSPEC. The layout of this file will be as follows:

  • The first column indicates the name of the spectrum in FITS format (you can also not specify the extension .fits).

  • The second and third columns are the initial FWHM (in pixels) and the order of the Legendre polynomial, respectively.

  • The forth and fifth columns are the initial range of RV used by DAOSPEC .

  • The sixth value is the DAOSPEC parameter SC, allowing to enable the line fitting procedure assuming that the FWHM is proportional to wavelength (see Section 2.3.12 in the DAOSPEC Cookbook). Thus, the allowed values are 0 (for the use of a single FWHM for all the lines) and 1 (for scaling the FWHM according to the wavelength of the lines).

  • The seventh value enables the optimization of the FWHM (0) or launch DAOSPEC keeping the FWHM fixed to the value specifies in the second column of the file (1).

  • The eighth column specifies the line list used for that spectrum. No specific format is requested, but only that the first column is the wavelength in and the second the code of the element. For the latter, 4DAO accepts both the GALA format (i.e. 26.00 for Fe I and 26.01 for Fe II) and the MOOG format (i.e. 26.0 for Fe I and for 26.1 for Fe II). Note that if the keyword gala in 4dao.param is Y, the input file needs to include all the information requested by GALA (wavelength, element code, log gf, excitation potential, damping constants and velocity parameter, see Mucciarelli et al., 2013b):

  • The ninth and tenth values are the wavelengths that identify the spectral range where DAOSPEC performs the spectral line measurements. You can specify the spectral range that you prefer; if one (or both) of the value is set to 0, 4DAO tries to readjust the corresponding spectral edge in order to avoid regions with negative flux, too noisy or with dramatic variations of the flux with respect to the spectrum.

  • The eleventh column specifies the way to set the RE parameter. If a value between 0 and 30 is provided, RE will be fixed at this value. For negative values, RE is fixed to the value specified in 4dao.param by the keyword restart for the first iteration, then it is refined by using the central depth of the strongest line measured by DAOSPEC . Alternatively, you can provide the wavelength of a given strong line (for instance a Balmer line, if available) and 4DAO will try to match its position with the closest transition measured by DAOSPEC . In both cases, if the derived RE values is negative or larger than 30, the value specified by restart will be assumed.

  • The last column is the name of the ASCII file including the wavelengths of spectral regions that you want to mask during the analysis. The file does not need any specific format, but it includes only two columns (each raw corresponding to a given spectral region to be masked, considering the observed spectrum, thus the wavelengths do not include the RV shift.). If you do not need to use this option, you can only specify a name or a symbol (like * in the some raws of the shown example) not corresponding to an existing file.

6 Output files

Together with the standard output files produced by DAOSPEC (the FITS files including the fitted continuum and the residual spectrum, and the .daospec file with all the measured lines), 4DAO produces some output files to check the quality of the solution and manage the derived information. For the spectrum named rootname (as specified in the first column of 4dao.list), the following files are created:

  • rootname_4DAO.pdf includes some plots concerning the continuum derived by DAOSPEC , the fit of each individual line and information about RVs and EWs uncertainties.

    The first panel shows the entire spectrum with superimposed (as a red line) the continuum level computed by DAOSPEC . If you have masked some spectral zones, these regions will be shown in this plot as yellow-shaded regions (see Fig. 2). The RV shift of the star is not applied in this plot.

    The following panels display all the lines listed in the input file, sorted in the wavelength or in the element code (according to the keyword plot in 4dao.param), with superimposed the best-fit (red line) calculated by DAOSPEC . Lines in the input file that are rejected or not recognized by DAOSPEC are plotted in blue color, in order to allow an easy identification of the lost features. In each panel the main information are labelled, as wavelength, ion code, EW, radial velocity, uncertainty in EW (expressed in percentage) and Q parameter. An example of these plots is shown in Fig. 3.

    The panel shown in Fig. 4 is created only if the keyword conter is 0 or 1. It shows the variation of the measured EWs with respect to the original values when an increase or a decrease of the continuum level is assumed (black and red points, respectively). The variation of EWs is shown as a function of the wavelength (upper panel) and of the EW (lower panel).

    The second to last panel (see Fig. 5) shows the RV of all the lines as a function of the wavelength (upper panel) and the EW (lower panel), and with the 1, 2 and 3 levels marked as dotted lines.

    The last panel (Fig. 6) shows the behavior of the EW error (upper panels) and of the Q parameter (lower panels) as a function of EW and wavelength.

  • the file named rootname.in includes the main information about the EW measurements. If the GALA output is enabled, this file will have the same format described in the GALA Cookbook, with the addition of the Q-parameter (not requested by GALA) in the eleventh column. Alternatively, it will contain wavelength, EW, error in EW, Q-parameter and then all the other information provided in the input line list. Note that if conter is 0 or 1, two additional columns will be added (at the end of the file), including the EWs measured by raising and lowering the normalized spectrum, respectively.

  • rootname_ZVN (.fits or .dat according to your choice in the keyword output in 4dao.param) is the original input spectrum, normalized using the continuum calculated by DAOSPEC and corrected for radial velocity using the average RV derived by DAOSPEC . This file is especially useful to create scientific plots or to use to perform additional chemical analysis based on the spectral synthesis.

Additionally, the file daospec.log summarises the main parameters derived by 4DAO for all the spectra listed in 4dao.list. For each spectrum the final FWHM (in pixels), the average radial velocities (in km/s) with its dispersion, the number of matched lines, the flux residuals (in percentage), a convergence flag related to the FWHM, the used starting and ending wavelengths, the RE value and the wavelength of the line used to derived RE (only in case this parameter is tuned by using the strongest available line) are provided. The file header explains the meaning of the convergence flag. Briefly:
CONV=1 the FWHM does converge (or the FWHM has been fixed to the initial value without optimization);
CONV=0 the number of iterations exceeds the maximum number of allowed iterations (specified by nimax in 4dao.param). In this case the results are referred to the last iteration;
CONV=--1 if the code calculates the same value of FWHM in two different iterations, to avoid the risk of an infinite loop, the code exits, writing the results of the last iteration, and passing to the next spectrum;
CONV=--2 the FWHM exceeds its maximum allowed value specified by fmax in 4dao.param Also in this case, the written values in the output are referred to the last iteration. This flag identifies also the cases where a negative FWHM is provided or found;
CONV=--3 the median value of the entire spectrum is negative, pointing out some problems in the spectral reduction (or the spectrum is missing). DAOSPEC would crash with similar spectra, thus the analysis is stopped, all the output values are 0.0 and 4DAO moves to the next spectrum of the list
CONV=--4 format problems in the daospec.opt or .daospec files are found;
CONV=--5 no line is found in the wavelength range of the observed spectrum.

Feature
() ()
Na D first component 5889.0 5890.5
Na D second component 5895.0 5896.5
X0-b2 Band 6275.0 6320.0
B Band 6860.0 6930.0
O Band 7160.0 7330.0
A Band 7590.0 7700.0
O Band 8125.0 8340.0
O Band 9100.0 9800.0

Note. -- Spectral regions masked by 4DAO during the determination of the RE parameter.

Figure 1: Spectral region of the UVES spectrum of the star NGC 5694-37 around the Na D interstellar lines before (upper panel) and after (lower panel) the application of the mask.
Figure 2: The UVES Red Arm 580 spectrum of the star NGC 5694-37 (Mucciarelli et al., 2013a) with superimposed the continuum computed by DAOSPEC (red curve). The yellow-shaded areas mark the spectral regions masked by 4DAO, namely the Na D photospheric lines, the region contaminated by telluric lines between 6280 and 6320 and the region around the Balmer line.
Figure 3: Example of the 4DAO plots showing the fit (red lines) of each individual line; blue lines mark the lines not matched by DAOSPEC. In each sub-panel the main information about the line (wavelength, ion code, EW and its error, radial velocity and Q parameter) are listed.
Figure 4: Variations of the measured EWs calculated increasing (black points) or decreasing (red points) the continuum level according to the flux residuals. These variations are shown as a function of the wavelength (upper panel) and of the EW (lower panel).
Figure 5: Behavior of the radial velocity of each individual spectral line as a function of the EW (upper panel) and of the wavelength (lower panel). In both the panels the dashed horizontal lines are 1, 2 and 3 levels.
Figure 6: Upper panels: behavior of the EW error (expressed in percentage) as a function of the EW and of the wavelength. Lower panels: behavior of the Q parameter as a function of the EW and of the wavelength.

Footnotes

  1. http://www.bo.astro.it/pancino/docs/daospec.pdf
  2. http://www.astro.princeton.edu/rhl/sm/
  3. http://heasarc.gsfc.nasa.gov/fitsio/fitsio.html
  4. http://software.intel.com/en-us/non-commercial-software-development
  5. http://www.cosmic-lab.eu/gala/gala.php

References

  1. Mucciarelli, A., Bellazzini, M., Catelan, M., Dalessandro, E., Amigo, P., Correnti, M., Cortes, C., & D'Orazi, V. 2013, MNRAS, 435, 3667
  2. Mucciarelli, A., Pancino, E., Lovisi, L., Ferraro, F. R., & Lapenna, E., 2013, ApJ, 766, 78
  3. Press, W. H., Teukolsky, S. A., Vetterling, W. T., & Flannery, B. P., 1992, 'Numerical recipes in FORTRAN. The art of scientific computing'.
  4. Stetson, P. B., & Pancino, E., 2008, PASP, 120, 1332
Comments 0
Request Comment
You are adding the first comment!
How to quickly get a good reply:
  • Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
  • Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
  • Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
""
The feedback must be of minimum 40 characters and the title a minimum of 5 characters
   
Add comment
Cancel
Loading ...
130590
This is a comment super asjknd jkasnjk adsnkj
Upvote
Downvote
""
The feedback must be of minumum 40 characters
The feedback must be of minumum 40 characters
Submit
Cancel

You are asking your first question!
How to quickly get a good answer:
  • Keep your question short and to the point
  • Check for grammar or spelling errors.
  • Phrase it like a question
Test
Test description