next up previous contents index
Next: 6.4 Files related to Up: 6.3 Commands and Parameter Previous: user defined absorption model

User Defined Models

 

EXSAS is designed to allow a user to include his own spectral models. Up to 20 dditive (ua01, tex2html_wrap_inline18599 , ua20) and ultiplicative (um01, tex2html_wrap_inline18601 , um20) user defined models can be added to the spectral analysis package at run time. The code of a user defined model can be written in any language (i.e. FORTRAN, C, etc.) as long as the user takes care of appropriate variable and function call handling and referencing to the EXSAS FORTRAN 77 code. An example of an additive user defined spectral model can be found in

$XEXSAS/spectral/spectrum/model/std/ua01.for.
An example of a user defined multiplicative model is given in

$XEXSAS/spectral/spectrum/model/abs/um01.for.
In general, a user defined model has to have the same parameter list as given in the following FORTRAN examples:

SUBROUTINE UAXY(E,P,NP,F,IERR)
SUBROUTINE UMXY(E,P,NP,F,IERR), (XY = 01, ...,20)
Here, E is the energy variable and P the parameter list of NP model parameters. The output parameters are the photon flux F and an error flag, which can be set to 0, if no important decision has to be made. The variables E, P and F have to be declared as double precision, the remaining two parameters NP and IERR as integer. The unit of the independent variable E is keV and of the dependent variable F is keV tex2html_wrap_inline18603 s tex2html_wrap_inline18605 cm tex2html_wrap_inline18607 .
Before adding one or more user defined spectral models to EXSAS one has to define an environment variable $user_def (for example in your login file) which defines the path to a directory where the source code of your model is stored. Assume you run EXSAS on a UNIX like operating system and you want to include an additive spectral model, something like a modified power-law or so. The model is your first and only user defined spectral model you want to add to EXSAS. Let's call the file with the FORTRAN code of your model ua01.for. Make a subdirectory, for example named my_models using mkdir /home/..../my_models and define the path to it in your .login file by adding the line setenv user_def /home/....../my_models to your login script. Then copy the shell script prisma.sh to the $user_def directory and make sure that it is executable (chmod u+x prisma.sh). This script file comes with EXSAS and was designed to help you with the inclusion of your model (compilation, linking, copying of library files to $user_def etc). It can be found in $XEXSAS/spectral/spectrum/model. Assuming now that you are in $user_def and have copied prisma.sh to this directory, executing

prisma.sh ua01
from the UNIX command line will then first copy the EXSAS spectral model library model.a and the FORTRAN source code prisma.fom of the EXSAS executable prisma.exe to your directory $user_def. Subsequently ua01.for will be compiled to ua01.o and added to the library model.a. Finally the EXSAS executable prisma.exe is created by compiling prisma.fom and linking it with model.a. If there is no error in your model file ua01.for and the script file prisma.sh finished successful the file prisma.exe is created in the directory $user_def.
If you want to include more as one user defined model just give all model names separated by a ``,'' as parameter to prisma.sh, for example like:

prisma.sh ua01, ua02, um01, um02
Note that you have to add all your user defined models in one step since the default EXSAS spectral model library model.a is copied from $XEXSAS/lib to $user_def every time you execute prisma.sh so that your old model.a file will be over written. This makes sure that you always add your user defined models to the newest and most up-to-date EXSAS library. Access to your user defined model is archived by checking the existence of the file prisma.exe in the directory $user_def. If the file prisma.exe exists in $user_def it will be executed, for example, by model/spectrum. Otherwise EXSAS executes its private copy of prisma.exe which it finds in $XEXSAS/exe.


next up previous contents index
Next: 6.4 Files related to Up: 6.3 Commands and Parameter Previous: user defined absorption model

If you have problems/suggestions please send mail to rosat_svc@mpe-garching.mpg.de