ASTROPHYSICS

ASTROPHYSICS

ASTROPHYSICS

ASTROPHYSICS

On this page we list a number of common questions regarding SPEX. For detailed questions about the use of SPEX, please consult the cookbook or the reference manual found on the manuals page.

Questions and answers are available for the following topics:

Installation

How do I install a Debian (.deb) package on Linux?

If you download the spex .deb file from the web site, usually a pop-up will appear asking you to open the file with a package manager. Do this and follow the instructions on the screen. If the pop-up does not appear, then you can install it also from the command line:

linux:~> sudo dpkg -i SPEX-<filename>.deb

Replace the filename with the file you downloaded from this web site. After a return, you provide your password and the install will begin. If other debian packages are needed for the install, you will be prompted. Please re-login after installation and SPEX should directly work from the command line.

How do I install an RPM (.rpm) package on Linux?

If you download the spex .rpm file from the web site, usually a pop-up will appear asking you to open the file with a package manager. Do this and follow the instructions on the screen. If the pop-up does not appear, then you can install it also from the command line:

linux:~> sudo rpm -i SPEX-<filename>.rpm

Replace the filename with the file you downloaded from this web site. After a return, you provide your password and the install will begin. If other rpm packages are needed for the install, you will be prompted. Please re-login after installation and SPEX should directly work from the command line.

Why do I get an error saying "Error: cannot open file named /NEWS"?

Please check if the environment variable $SPEX90 is pointing to the directory where you installed SPEX:

linux:~> echo $SPEX90

If you just installed SPEX using an installation package and $SPEX90 is empty, then log out and in again. If the problem persists after a re-login, then check whether the spexdist.sh or spexdist.csh files are loaded. These files can be found either in /etc/profile.d or in the SPEX installation directory. If you installed a .deb, .rpm, or .dmg package, then source:

source /etc/profile.d/spexdist.sh (bash shell) 
source /etc/profile.d/spexdist.csh (C-type shell) If you installed SPEX from a tar.gz file, then follow these steps: Set the SPEX90 environment variable to the path where you installed SPEX:
  export SPEX90=/spex/install/path/spex-2.03 (bash shell) 
  setenv SPEX90 /spex/install/path/spex-2.03 (C-type shell) Source the corresponding file:
  source $SPEX90/spexdist.sh
  source $SPEX90/spexdist.csh  

How do I uninstall SPEX on Mac OSX?

Most of the files associated to SPEX are installed in /usr/local/spex. The executable binaries are in /usr/local/bin. Two files are installed in a completely different directory: /private/etc/profile.d/spexdist.sh and /private/etc/profile.d/spexdist.csh. SPEX can therefore be completely uninstalled by giving the following commands on the command line (take care to copy the lines exactly!)

macosx> sudo rm -rf /usr/local/spex

macosx> cd /usr/local/bin; sudo rm epicfluxer rgsfluxcombine rgsfluxplot rgsfmat spex trafo uvtospex xabsinput

macosx> sudo rm /private/etc/profile.d/spexdist.*

(Back to top)

Trafo

How should I create those .spo and .res files needed to use 'data' command?

SPEX uses its own format for spectral files, which is more memory efficient. You can transform your OGIP spectra to SPEX format using the program called trafo, which is discussed in both the SPEX manual and the SPEX Cookbook.

I am trying to fit OGIP spectra with SPEX but I cannot load the response and the spectrum. I have renamed the extensions of my specrum and response files to .spo and .res and used the command "data" to load them, but it does not work.

SPEX uses its own format for spectral files, which is more memory efficient. You can transform your OGIP spectra to SPEX format using the program called trafo, which is discussed in both the SPEX manual and the SPEX Cookbook.

The trafo program needs the "Maximum number of response groups per energy per spectrum". What does this mean?

This is needed in order to allocate scratch memory. For almost any ”sane” spectrum, a large number like 10000 is always sufficent. Anyway, trafo will warn you and quit whenever you reach this limit.

I want to convert a Chandra HETG spectrum, but trafo gives me an error message. What is going wrong?

Some Chandra spectra are not delivered in OGIP format, which trafo is able to read. First convert your spectrum in OGIP format and try trafo again. CIAO has a program to convert spectra to standard OGIP format called dmtype2split. Once your spectra are converted, they are ready for trafo.

When loading EPIC MOS spectra in trafo, I get the following message Lower model bin boundary for bin 1 must be positive; current values: 0.000000E+00   5.000000E-03
Enter new bin boundary values manually:

Trafo cannot handle lower bin values of 0., so it asks you to update the lower bin value to a positive one. For example, 3.E-5 5.E-3.

(Back to top) 

SPEX Syntax

If I try to load a spectrum at the SPEX prompt like this, I get an error message. Why? SPEX> data 1 myfile.spo myfile.res

In SPEX, you do not have to type extensions. The data command first expects the .res file followed by the spectrum. The correct syntax would be: SPEX> data myfile myfile

When I plot the model using 'plot type model', then the graph gets filled up below the curve. How do I turn it off?

plot fill disp false

How do I save the parameters of my best-fit model to a file that I can reload again in SPEX?

The command 'par write filename' writes the parameters to a com file that can be loaded later with the command 'log exe filename'. 

(Back to top) 

Models

Are the default abundances Anders & Grevesse (1989)? Can they internally be changed?

In version 3.00.00 the default abundances are the proto-solar abundance values of Lodders 2009. The solar abundances used in SPEX can be changed through the command 'abun'. See the SPEX reference manual for details.

Does the NEI model in SPEX also use the same atomic code as that used in 'mekal' ?

Yes. All the model components containing line emission are based on the same atomic database.

Is there an edge multiplicative model in SPEX90?

Yes. It is called 'etau'. See the SPEX manual for details.

How to fit a spectrum with the H abundance set to a very small value (close to 0), such that the continuum gets most out of the He abundance?

In the model, you can change the reference atom to another value. It is set to Hydrogen by default. See the SPEX manual for details.

In the xabs model, how can I use another ionising continuum than the default?

Using the auxilliary program xabsinput you can create your own input file for xabs. 

If I thaw the parameter fcov of a xabs component, which is related to the covering fraction, does it have the same effect as introducing the pcfabs model of xspec?

The fcov factor works with any absorption model in spex (not just only the xabs, but also absm, hot, slab, warm, etc), and indeed does something similar as is done in the pcfabs model in xspec.

Are the spectral lines in the Mekal/Cie code completely caused by collisional ionisation?

In collisional ionisation equilibrium, the most dominant excitation process is collisional excitation, but in particular radiative recombination cannot be ignored completely. For instance, at T=5 keV, about 5-10 % of the main Fe XXV and Fe XXVI lines are produced by radiative recombination, the remainder by collisional excitation.

Can I use the output from SPEX directly in my own Fortran code?

Yes. An example of calling SPEX from a Fortran program is provided in the SPEX Cookbook.

(Back to top) 

Plotting

I need to plot the spectral components of my model ABS*(CIE+NEIJ). The final plot should show the spectra, the global bestfit model and the two spectral components. Is there a SPEX function to do this?

Unfortunately, there is no function in SPEX yet to plot the individual components of a model in one plot directly. However, creating such a plot from SPEX is not that difficult. It just needs a bit of work. The trick is to dump the spectra in SPEX to an ASCII file. If you dump the spectrum for ABS*(CIE+NEIJ) first and subsequently ABS*CIE and ABS*NEIJ (by putting the normalization of the other component to 0), you have three QDP files that contain the individual components. With a text editor like nedit or with a small script, you can add the columns containing the model components to the first QDP file. Using QDP, it is then very straightforward to produce the plot that you would like to have.   In commands:
 
Suppose you have the following model: 1 abs
2 cie
3 neij Choose linear x and y axes to get the right numbers on the axes in QDP: SPEX> plot x lin
SPEX> plot y lin As soon as you have your best fit: SPEX> plot adum bestfit
(saves a file bestfit.qdp) SPEX> par 1 2 norm v 0.
SPEX> calc
SPEX> plot adum neij_comp
(saves a file neij_comp.qdp) Put the normalisation of the CIE back to the original value:
SPEX> par 1 2 norm v 1000.
SPEX> par 1 3 norm v 0.
SPEX> calc
SPEX> plot adum cie_comp
(saves a file cie_comp.qdp) SPEX> quit Now copy the column containing the model component from cie_comp.qdp and neij_comp.qdp to the file bestfit.qdp. linux:~> qdp bestfit.qdp You can now format the plot in any way you like using QDP.

The plot window does not show tick marks or labels on the axes

This error is usually caused by an incompatible grfont.dat file from the pgplot library. Check whether the PGPLOT_DIR environment variable is pointing to the pgplot directory in the SPEX path (for example: /usr/local/spex/pgplot). If the labels are still not shown, check the PGPLOT_FONT variable, which should point to grfont.dat in the $SPEX90/pgplot/ directory.

(Back to top) 

Common errors

When I type "spex", the following errors appear: Error: cannot open file named spexdat.dum
E
rror: cannot open file named spexmod.dum
Error: cannot open file named spexpar.dum
Error: cannot open file named spexsys.dum

I cannot find these files in my directory.

The files with extension .dum are temporary scratch files that SPEX creates during execution and deletes afterwards (containing for example the current set of spectral model parameters). Probably you do have not write permission in the directory in which you start spex, so start the program in a directory where you have write access.

I get a segmentation fault in spex or trafo

Please make sure that the spexdist.sh or spexdist.csh is sourced properly. The source files set the stacksize memory limit to the highest possible value. If the stacksize is not enlarged, the program may encounter a segmentation fault. The solution is to execute the following command in the terminal:

(bash): ulimit -s unlimited

(csh): limit stacksize unlimited

Give this command in your bash or csh terminal and run trafo or spex again. The segmentation fault should not occur anymore. If the solutions on this page for a segmentation fault do not fix the issue, please contact us!

I get a segmentation fault when I use a high-resolution energy grid

SPEX versions 2.02 and higher use parallel code in a few key routines. However, the amount of memory per thread is usually limited to 4 MB (or 8 MB on 64-bit systems). For very large energy grids, this may lead to a segmentation fault. A temporary solution is to increase the memory size per thread. If you installed SPEX using one of the installation packages on this website, then you can increase the memory stacksize by setting the environment variable to a higer value before you start SPEX:

export GOMP_STACKSIZE=16384 (bash)

setenv  GOMP_STACKSIZE 16384 (csh)

If you installed the tar.gz version, the environment is set like this:

export OMP_STACKSIZE=16384 (bash)

setenv OMP_STACKSIZE 16384 (csh)

My spexdist.csh login script is giving an error while loading

Unfortunately, there is a bug in some installation packages of SPEX in which the spexdist.csh file was incorrectly created. The correct spexdist.csh file (located in /etc/profile.d/) would look like this (notice the ${HOME} variable):

#!/bin/tcsh

setenv SPEX90 /usr/local/spex 

setenv PGPLOT_DIR /usr/local/spex/pgplot

# Readline functionality 

if ( ! -d ${HOME}/.spex_d ) then 

    mkdir ${HOME}/.spex_d 

    echo -readline > ${HOME}/.spex_d/spexrc 

endif

You can copy the script above into the /etc/profile.d/spexdist.csh file and then it should work properly.
The plot window does not show tick marks or labels on the axes
This error is usually caused by an incompatible grfont.dat file from the pgplot library. Check whether the PGPLOT_DIR environment variable is pointing to the pgplot directory in the SPEX path (for example: /usr/local/spex/pgplot). If the labels are still not shown, check the PGPLOT_FONT variable, which should point to grfont.dat in the $SPEX90/pgplot/ directory.

(Back to top) 



SCROLL TO TOP