TIC UTOMA A FRIEDRICH - it.physik.uni-muenchen.de · \1. e teractiv In eak P Fitting" The user...
Transcript of TIC UTOMA A FRIEDRICH - it.physik.uni-muenchen.de · \1. e teractiv In eak P Fitting" The user...
G A S P A N
INTERACTIVE AND AUTOMATIC ANALYSIS OF
GAMMA-RAY AND PARTILE SPECTRA
FRIEDRICH RIESS
Sektion Physik der Universit�at M�un hen, 80799 M�un hen, W. Germany
July 15, 2006
A Tutorial
Warning: this tutorial is not omplete
i
Introdu tion
The automati analysis of gamma-ray spe tra from Ge-dete tors is a hallenging task. Reli-
able programs are needed to handle the large amount of data produ ed in todays experiment.
The program gaspan has been designed to be used either intera tively to analyze single lines
in a spe trum or to analyze ompli ated spe tra for example spe tra with a mix of lines
with di�erent line widths, or in an automati mode to analyze large amounts of spe tra with
many lines. It an be used to analyze all line stru tures with Gaussian or nearly Gaussian line
shapes su h as spe tra from NaI- or Ge-dete tors, solid state parti le dete tors and spe tra
from magneti spe trograph-s.
The following introdu tion should help the user to be ome familiar with the di�erent pos-
sibilities of using the program. A des ription of the �t fun tion and other programming
onsideration are put in the appendi es of this manual.
The program gaspan is designed to run at UNIX systems. The sour e ode an be downloaded
from the URL
http://www. ip.physik.uni-muen hen.de/�riess
in the �le \gaspan-yy-mm-dd.tgz". The spe tra used as examples in this tutorial are lo ated
in the �les \testsuite-yy-mm-dd.tgz" respe tively \examples.tgz". A binary �le for Linux
systems an be also found in this URL.
This tutorial splits into four hapters:
� \1. Intera tive Peak Fitting"
The user learns in this hapter about the ommand stru ture and the philosophies of
gaspan . Examples of simple intera tive �tting pro edures will be demonstrated.
This hapter is thought for a student who likes to analyze a few lines in a simple
spe trum in relation to his a ademi al training.
� \2. Advan ed Peak Fitting"
This hapter deals with more ompli ated ases as lines with large asymmetries as well
as with spe tra of high line density. Automati analysis of spe tra will be explained.
This hapter is thought for students who have to do spe tra analysis in the frame work
of a more elaborate work (Master, Diploma or PhD.).
� \3. Spe ial Cases"
Spe ial ases as for example spe tra ontaining groups of lines with di�erent line widths
as well as the generation of ba kground orre ted gate spe tra from oin iden e ma-
tri es are dis ussed.
� \Appendix"
brings a summary of ommands, a lesson how to write and in orporate an own spe trum
read routine, a presentation of the �t fun tion as well as other information about the
program.
CONTENTS iii
Contents
1 Intera tive Peak Fitting 1
1.1 First Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.2 Reading a Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.3 Displaying the spe trum . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.4 Fitting Gaussian peaks . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1.5 Fitting asymmetri lines (I) . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.6 The ommand stru ture . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.7 The History Me hanism . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.1.8 Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.1.9 Showing the Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.1.10 Quit the program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2 Output Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2.1 The Gaspan Data Summery File . . . . . . . . . . . . . . . . . . . . 8
1.2.2 Handling the display . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2.3 Spe tra �les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2 Advan ed Peak Fitting (not implemented yet) 9
3 Spe ial Cases (not implemented yet) 9
4 Appendix 10
4.1 Summary of ommands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.1.1 De�ning Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.1.2 Controlling the display . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.1.3 Manipulating the Diplay . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.1.4 Controlling the Fit Pro edure . . . . . . . . . . . . . . . . . . . . . . 12
4.1.5 Tailering the �t Fun tion . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.1.6 De�ning Starting Parameters . . . . . . . . . . . . . . . . . . . . . . 14
4.1.7 Fit Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.2 Data Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.2.1 Printable data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.2.2 Binary data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.2.3 Writing a spe trum read routine (to be written) . . . . . . . . . . . . 17
iv CONTENTS
4.3 The Fit Fun tion And Its Parameters . . . . . . . . . . . . . . . . . . . . . . 18
1
1 Intera tive Peak Fitting
1.1 First Steps
1.1.1 Getting Started
The program gaspan if installed properly, an be exe uted by just typing \gaspan< r>".
It will respond by
GASPAN, Version dd.mm.yy
A program to fit gamma and parti le spe tra
Author: Friedri h Riess, email: friedri h.riess�physik.uni-muen hen.de
URL: http://www.physik.uni-muen hen.de/~riess/
URL: http://www. ip.physik.uni-muen hen.de/~riess/
GSP>
dd.mm.yy is the version number spe i�ed by the date of the release and the present tutorial
is valid for versions newer than August 2005.
1.1.2 Reading a Data Set
Data sets i.e. spe tra an be ASCII or binary �les. gaspan has en orporated several data
formats whi h are des ribed in detail in appendix 4.2 and you are asked to have a look
at this appendix when you want to read your own data sets. For the moment we will
work with spe tra found in the ar hive �le \testsuite.tgz" whi h an be found in the URL
http://www.physik.uni-muen hen.de/�riess/.
To be able to read the spe trum stored in the �le \ta182.dat" we need the ommand
set files -file=ta182.dat
Note: the data set is not a essed yet i.e. there will be only a warning and no error message
if the �le is not present.
1.1.3 Displaying the spe trum
It is now possible to look at the spe trum:
show spe trum
will display this 8k spe trum in units of 4096 hannels (see �g. 1,2)
1
.
At the top of the �gure you �nd on the left side the name of the data set with an arrow
pointing to the sub spe trum number, in the middle the date and time the graphi has been
generated and on the right the version of gaspan The string \Tutorial" has been inserted
via the ommand
set display - omment="Tutorial"
The ommand show spe trum has the �rst and the last hannel to be displayed as optional
1
The display will be partially or totally empty if the graphi s window was hidden by other windows. Just
type < r> in the ommand mode in order to restore it (this possibility to re over the display does not work
for versions before the year 2005).
2 1 INTERACTIVE PEAK FITTING
ta182.dat->1 Tue Mar 15 07:40:24 2005 GASPAN, Version 11.03.2005Tutorial
500 1000 1500 2000 2500 3000 3500 4000channel
0
1000
2000
3000
4000
Figure 1: The �rst 4096 hannels
ta182.dat->1 Tue Mar 15 07:40:37 2005 GASPAN, Version 11.03.2005Tutorial
4500 5000 5500 6000 6500 7000 7500 8000channel
0
1
2
3
4
5
6
Figure 2: hannels 4097 to 8192
argument:
show spe trum 420,500
will display just this region.
1.1.4 Fitting Gaussian peaks
A �t to the lines in this region an be obtained with the ommand
fit 420,500,2
gaspan will do a line sear h in this region, do a �t with a Gaussian plus a quadrati ba k-
ground (polynomial with degree 2), print the result and show the �t.
Working on ta182.dat-->1
Sear hing for peaks in region 420 500
entroid area width
447.497 +/- 0.036 2223. +/- 48. 3.41 +/- 0.06
461.873 +/- 0.053 1051. +/- 33. 3.41 +/- 0.06
No error in this fit
next: < r>, next spe : ESC, p(rint), s(ave)>
ta182.dat->1 Tue Jun 6 20:35:40 2006 GASPAN, Version 12.04.2005Tutorialback. deg. 2, 2 peaks, chisqr/f 0.8225
420 430 440 450 460 470 480 490 500channel
100
200
300
400
500
600
447.5
461.9
Figure 3: Fit with data points as histogram
1.1 First Steps 3
ta182.dat->1 Tue Jun 6 20:37:35 2006 GASPAN, Version 12.04.2005Tutorialback. deg. 2, 2 peaks, chisqr/f 0.8225
420 430 440 450 460 470 480 490 500channel
100
200
300
400
500
600
447.5
461.9
Figure 4: The data are shown as points with error bars
The display (see �g.3) shows the spe trum extended below and above the �t region as a
histogram, the �t to the ba kground as a blue line and the �t to the spe trum in red. The
bottom part shows the residue spe trum of this �t
2
whi h is analyzed to dete t small lines
or doublets. The 99% on�den e limit is shown too. In the additional text line you see
the degree of the ba kground polynomial used, the number of lines found and hi-square
normalized by the degree of freedom. If you do not like histogramming a spe trum you an
plot the data with error bars (�g.4) with the ommands
set display -errorbar
show fit
From now on all spe tra will be shown with error bars. You an return to the histogramming
mode with the ommand
set display -histogram
The program will analyse the residual spe trum for more lines and add them to the �tting
pro edure if some are found. Look at the region 210,340:
fit 210,340,2
You get seven lines in this �t (�g.5):
Working on ta182.dat-->1
Sear hing for peaks in region 210 340
entroid area width
220.957 +/- 0.624 33. +/- 12. 3.27 +/- 0.05
228.670 +/- 0.071 644. +/- 27. 3.27 +/- 0.05
234.073 +/- 0.196 156. +/- 17. 3.27 +/- 0.05
282.807 +/- 0.239 102. +/- 14. 3.27 +/- 0.05
306.762 +/- 0.034 2303. +/- 49. 3.27 +/- 0.05
314.919 +/- 0.067 833. +/- 31. 3.27 +/- 0.05
319.226 +/- 0.199 190. +/- 20. 3.27 +/- 0.05
No error in this fit
next: < r>, next spe : ESC, p(rint), s(ave)>
2
See appendix 4.3 for an explanation
4 1 INTERACTIVE PEAK FITTING
ta182.dat->1 Tue Jun 6 20:47:30 2006 GASPAN, Version 12.04.2005Tutorialback. deg. 2, 7 peaks, chisqr/f 1.038
220 240 260 280 300 320 340channel
100
200
300
400
500
600
700
221.0
228.7
234.1 282.8
306.8
314.9319.2
Figure 5: Another region
The �t looks reasonable. An analysis of this ase shows that not all lines are found by the
peak sear h routine. This will be dis ussed later in more detail.
1.1.5 Fitting asymmetri lines (I)
One problem in gamma ray spe tra are asymmetri peaks or an asymmetri ba kground.
Try the following ommands:
set file -file=eu152.dat
fit 235,345
and you get as result a bun h of weak lines
3
Working on eu152.dat-->1
Sear hing for peaks in region 235 345
entroid area width
259.180 +/- 0.327 153. +/- 42. 3.05 +/- 0.01
266.293 +/- 0.251 233. +/- 45. 3.05 +/- 0.01
270.440 +/- 0.176 402. +/- 50. 3.05 +/- 0.01
274.443 +/- 0.169 478. +/- 54. 3.05 +/- 0.01
278.210 +/- 0.165 539. +/- 57. 3.05 +/- 0.01
282.016 +/- 0.146 709. +/- 64. 3.05 +/- 0.01
285.468 +/- 0.152 743. +/- 66. 3.05 +/- 0.01
289.133 +/- 0.118 1007. +/- 73. 3.05 +/- 0.01
295.282 +/- 0.005 12425.e+01 +/- 55.e+01 3.05 +/- 0.01
298.896 +/- 0.287 80.e+01 +/- 26.e+01 3.05 +/- 0.01
No error in this fit
next: < r>, next spe : ESC, p(rint), s(ave)>
and the �t shown in �g.6. Quit learly there is the problem of weak lines in the presen e of
a strong line.
3
Note: the format in the output of the value of the area is hosen su h that the error is given with a two
digit pre ision.
1.1 First Steps 5
eu152.dat->1 Tue Jun 6 21:00:22 2006 GASPAN, Version 12.04.2005Tutorialback. deg. 2, 10 peaks, chisqr/f 2.002
240 260 280 300 320 340channel
10000
20000
30000
40000
259.2 266.3270.4
274.4278.2
282.0285.5
289.1
295.3298.9
Figure 6: Are these peaks real?
Are these lines real or are they fake? You an blow up the ba kground by using a logarithmi
s ale (�g.7):
set display -logarithmi
show fit
and you will re ognize that all lines but the one at hannel 295.3 are fakes. the lower lines
are obviously added in order to �ll up an asymmetri ba kground.
eu152.dat->1 Tue Jun 6 21:05:35 2006 GASPAN, Version 12.04.2005Tutorialback. deg. 2, 10 peaks, chisqr/f 2.002
240 260 280 300 320 340channel
10^01
10^02
10^03
10^04
10^05
259.2266.3
270.4274.4
278.2282.0
285.5289.1
295.3298.9
Figure 7: ...de�nitely not!
You might try an odd degree of the ba kground polynomial
fit 235,345,3
but you will see that this does not help. There is an asymmetri ba kground ontribution
from the line itself: an exponentially de aying tail with a large de ay onstant. This is alled
in the program a \ba kground tail". We an in lude su h a tail in the �t but there might
be other asymmetri ontributions. The easiest way to handle this problem is to in lude all
asymmetries:
set tail -all
Now you get a perfe t �t to the ba kground and the lower peaks have disappeared (�g.8):
Working on eu152.dat-->1
6 1 INTERACTIVE PEAK FITTING
eu152.dat->1 Tue Jun 6 21:08:53 2006 GASPAN, Version 12.04.2005Tutorialback. deg. 2, tails (var.): left, back., right, step, 1 peaks, chisqr/f 0.8950
240 260 280 300 320 340channel
10^01
10^02
10^03
10^04
10^05 295.3
Figure 8: A �t with all asymmetries
Sear hing for peaks in region 235 345
entroid area width
295.328 +/- 0.005 12381.e+01 +/- 36.e+01 2.98 +/- 0.01
Input value for left tail de ay onstant too large.
Note the hange in the areas! Obviously we get an error message: it turns out that there is
no left peak tail in this ase (see ??) but this should not bother us at the moment
Give the ommand
save options
in order to save the urrent setup and leave gaspan with the ommand
quit
1.1.6 The ommand stru ture
Control of the program is done by keyboard input. There are several basi ommands:
set set an option or de�ne a variable or a �le name.
show show data or options or other things
fit �t a region intera tively
go �t a region automati ally
help get help about a ommand
save save options into a �le
get get options from a �le
do exe ute a shell ommand
quit quit the program
exit quit the program
Commands an be abbreviated but the abbreviation must be unique. The ommand \show"
an be abbreviated to \sho" or \sh" but not to \s" be ause \s" is no longer unique. The
following error message will be printed if an abbreviated ommand is not unique:
-->CMD: ommand ambiguous: s
1.1 First Steps 7
and the ommand will be printed up to the letter were the ambiguity starts. The ommands
are on a mnemoni basis and will therefore be written in the examples in full length
4
.
Most of the basi ommands are followed by an identi�er and - in most ases - the identi�er
is followed by an option.
1.1.7 The History Me hanism
You an re all previous ommands with the up arrow key and edit them with the left and
right arrow keys and the ba kspa e key. The history will be saved into the �le \.gaspan" in
the urrent dire tory when leaving gaspan and will be a essible in the next gaspan session
5
.
1.1.8 Getting Help
The help ommand gives you online information about the ommands in gaspan . It has the
general stru ture:
help [ ommand [sub ommand [option℄℄℄
You will get the message
--> Help file not found, notify operator
if the help �le \gaspan.hlp" is not installed orre tly but you will get an overview over
the ommands in any ase. You an get information about the listed ommands by typing
help ommand and even without a help �le you will see the sub ommand or the options of
a ommand. If you have a ess to the �le \gaspan.hlp" you might opy it either into the
urrent dire tory or into /tmp/ in order to a ess it.
You an also get a ess to the help �le with the ommand
set file -helpfile=PATH/gaspan.hlp
where PATH is the path to the gaspan.hlp �le.
Commands are shown in inverse video. An option whi h is followed by an equal sign requests
further input:
(%s) expe ts a string
(%s,%d) expe ts a string followed by an integer number
(%f,%f) expe ts two oating point numbers.
1.1.9 Showing the Status
There a several ommands showing the status of gaspan . The ommand
show version
outputs the urrent version. The ommand
show news
prints a list of hanges with respe t to the last published version.
Ea h program has restri tions due to dimensions of arrays et . The ommand
show limitations
prints a list of these restri tions and last not least you get a list of the urrently a tive
options, identi�ers and quali�ers with the ommand
4
In the summary of ommands, appendix 4.1, a star in the ommand shows the position where the
ommand is no longer ambiguous.
5
The history algorithm was written by Bertram Stanzel y.
8 1 INTERACTIVE PEAK FITTING
show options
1.1.10 Quit the program
The program an be quit only with the ommands \quit" or \exit". You an not quit the
program with \CTRL C" respe tively the \intr" ommand (use the ommand \stty
-a" on your system to see whi h hara ter interrupts a program). This is be ause \CTRL C"
is used to stop a running �t and to return to the ommand interpreter of gaspan .
1.2 Output Files
Note: You must have write permission in the dire tory you are running gaspan .
1.2.1 The Gaspan Data Summery File
Look at the inventory of your urrent dire tory and you will �nd the �les \gsp1ta182.dat"
and \gsp1eu152.dat". These are ASCII �les whi h ontain all information about the last �t:
the options as well as the results of the �t. These �les are alled \gaspan data summary �le".
The �lename of these �les start always with the string \gsp", followed by a number whi h
denotes the sub-spe trum
6
, followed by the �lename of the data set analyzed (without any
path spe i� ations).
A gaspan data summary �le will be generated in any ase. It starts with a header showing
the options and parameters of the last �t, followed by the �t result. The line starting with R
ontains the �t region, the degree of the ba kground polynomial a variable whi h indi ates
an error ode if an error during the �t o urred and the normalized hi-square. The positions
of the peaks are given with a 3 digits pre ision. Its error is set to a minimum value of 0.001
and a maximum value of 99.999. It follows the area under the peak. The pre ision of these
numbers depend on the error of the area. They are given in su h a representation that the
error shows 2 digits. Finally the width is printed with a two digit pre ision.
Note: with ea h fit (and go) ommand the \gaspan data summery �le" is gen-
erated new, hen e old data are lost unless you give the ommand
set peak -append
but you should be aware that the options are saved only during the generation of the \gaspan
data summary �le".
1.2.2 Handling the display
There are many display ommands allowing manupulation of the displayed spe trum. Please
inspe t the summary of ommands 4.1.3 and 4.1.2. Only three of the ommands will be
dis ussed here in more detail:
set display -saveall=�lename
Ea h display you will see on the s reen is saved as Posts ript �le in the �le �lename. You
an vue the pi tures for example with the program \gv" (gv filename) and extra t single
pi tures by sele ting the ommand \Save Marked" in order to in lude them in a text �le.
6
gaspan a epts more than one spe trum in a data �le. see hapter 4.2.
9
As an example, L
A
T
E
X allows you to in lude posts ript �les with the pa kage \epsf" and the
ommand sequen e:
\begin{figure}[h℄
\epsfxsize15 m
\leavevmode
\epsffile{filename}
\ aption{\label{xxx} text}}
\end{figure}
The ommand is an eled with the ommand
set display -nosaveall (default)
There are two ommands whi h ontrol the window size and its ontents:
set display -windowsize=x,y
de�nes the size of the generated window in fra tions of the s reen size i.e. x,y=1.,1. will
generate a window overing the total s reen. It should be evident that there is also a mini-
mum window size (at present: x,y=0.575,0.35 whi h is adapted for a s reen resolution of
1280x1024).
set display -residuum
set display -noresiduum
de�nes if the residue spe trum is to be shown or not. The size of the spe trum will be
extended into the spa e reserved for the residue spe trum if this is not shown (see �g. 9 and
10)
ta182.dat->1 Tue Jun 6 20:47:30 2006 GASPAN, Version 12.04.2005Tutorialback. deg. 2, 7 peaks, chisqr/f 1.038
220 240 260 280 300 320 340channel
100
200
300
400
500
600
700
221.0
228.7
234.1 282.8
306.8
314.9319.2
Figure 9: same as �g. 5
ta182.dat->1 Thu Jun 8 15:28:21 2006 GASPAN, Version 12.04.2005back. deg. 2, 7 peaks, chisqr/f 1.038
220 240 260 280 300 320 340channel
100
200
300
400
500
600
700
221.0
228.7
234.1282.8
306.8
314.9319.2
Figure 10: same as �g. 5 but without residue
spe trum
1.2.3 Spe tra �les
The ommand set fit -out will generate 2 data �les \�tN�le.dat" and \b kN�le.dat"
whi h ontain the �t-and ba kground- spe tra. N is the sub-spe trum number of the data
�le \�le".
2 Advan ed Peak Fitting (not implemented yet)
3 Spe ial Cases (not implemented yet)
10 4 APPENDIX
4 Appendix
4.1 Summary of ommands
All ommands an be abbreviated as long as they are unique. A star in the following list of
ommands denotes this position.
4.1.1 De�ning Data Sets
ommand argument quali�ers omment
se*t �l*es -�*le=name de�ne name of data�le name
-�*le=name,s1 analyse subspe trum s1 of data�le
name
-�*le=name,s1,s2 analyse all subspe trum between s1
and s2 of the data�le name
-�*le=name,s1,s2,ds analyse all subspe trum between s1
and s2 with in rement ds of the data�le
name
-�*le=�name the �le name ontains a list of data�les
to be analysed
-fo*rmat=form sele t the format of the data�le form
form = as ii, dat, daterr et .
see ommand \show limitations"
-fo*rmat=sear h
1)
derive format from �le extension
-matrix two dimensional spe trum
-single spe trum
1)
one dimensional spe trum
1) default
4.1.2 Controlling the display
ommand argument quali�ers omment
se*t d*isplay -on
1)
show spe trum and �t on terminal
while �tting
-of*f no display of spe tra while �tting
-ho*ld hold the display after ea h �t step, on-
tinue with < r>.
-noh*old
1)
do not stop after a �t step
-sa*veall=�lename save all displays in the posts ript �le
�lename
-nosa*veall
1)
do not save the displays automati ally
-i*ntermediate display intermediate steps in the �t
pro edure
-noi*ntermediate
1)
display only the �nal �t
-print=" ommand" de�ne a print ommand for printing the
posts ript �le of the display. Default:
lpr
1) default
4.1 Summary of ommands 11
4.1.3 Manipulating the Diplay
ommand argument quali�ers omment
se*t d*isplay -er*rorbar show data points with error bars
-noe*rrorbar show data points as histogram
-hi*stogram
1)
show data points as histogram
-li*near
1)
linear display of �t and spe trum
-lo*garithmi logarithmi display of �t and spe trum
- h*annel
1)
mark peaks with hannel numbers
-en*ergy mark peaks and axis with energies
-s*ingle peak draw ea h single peak of the �t
-nos*ingle peak
1)
do not draw ea h single peak of the �t
- o*mment="text" allows to spe ify a text line whi h will
be shown on the display
- o*mment=""
1)
delete the text line
-g*auss-position put peak markers at the position of the
gaussian peak
- e*ntroid put peak markers at the position of the
entroid of a peak
-t*ailin lude
1)
set marker positions a ording to the
ommand \set tail -in lude"
-r*esiduum
1)
reserve spa e in the graphi window to
show the residue spe trum
-nor*esiduum don't display residue spe trum, use
spa e for display of the spe trum
-w*indowsize=x,y de�ne the size of the graphi window,
x and y are fra tions of the s reen size
-y*s ale=ymin,ymax restri t display to the range
ymin � y � ymax
-y*s ale=,ymax get ymin from the spe trum
-y*s ale=ymin, get ymax from the spe trum
-y*s ale=,
1)
get ymin,ymax from the spe trum
1) default
12 4 APPENDIX
4.1.4 Controlling the Fit Pro edure
ommand argument quali�ers (argument) omments
se*t �t -res*idue sear h
1)
make a residue sear h to �nd doublets
and weak peaks
-nor*esidue sear h do not are about the residue spe trum
-reg*ion=min, max set analyzing window from hannel
min to max
se*t r*egion -s*ear h
1)
invoke region sear h routine
-l*ist=name get regions from data �le name
-f*it=min,max set analyzing window from hannel
min to max
se*t pa*rameter -no *he k
1)
do not he k if parameters minimize �
2
- *he k he k if parameters minimize �
2
, return
immediately to the �t routine if not
-a*ll he k he k all parameters if they minimize
�
2
, sele t the best improvement if not
and return to the �t routine
-f*ull he k make a sampling of �
2
around the ur-
rent parameters, return immediately to
the �t routine if an improvement is
found
-ex*tended he k make a sampling of �
2
around all ur-
rent parameters, return to the �t rou-
tine with the best improvement if found
se*t pe*ak -s*ear h
1)
enter peak sear h routine
-l*ist=name get list of peaks from data �le name
-nol*ist identi al to -sear h
se*t s*tatisti s -a*llpeaks in lude all peaks from a peak list
-noa*llpeaks
1)
in lude only good peaks
-se*nsitivity= ode de�ne sensitivity in peak- and residue
sear h ( ode=normal
1)
or high)
-st*andard
1)
assume normal distributed data
-nos*tandard assume none normal distributed data
se*t w*idth -l*ist take the value for FWHM from the
peak list
-nol*ist
1)
take the value for FWHM from the
width alibration
-r*ange=value set the variation range for FWHM to
value
1) default
4.1 Summary of ommands 13
4.1.5 Tailering the �t Fun tion
ommand argument quali�ers omment
se*t b*a kground -p*olynomial set degree of ba kground polynomial
degree=value to value (value = [0; 4℄)
-m*ax polynomial the program tries to set the degree
degree=value of ba kground polynomial but not
larger than value
1)
value = f0,1,2,3 or 4g
-�x*ed=value �x the ba kground to value if the degree
of the polynomial is 0
-�t
1;2)
in lude a onstant ba kground in the
�t
se*t pe*ak -ind*ividual
1)
vary all peak entroids independently
- *ommon shift peak entroids by the same
amount
-f*it
1)
in lude peak entroids in the �t
-nof*it keep peak entroids �xed
se*t w*idth - o*mmon
1)
�t all widths in a �t region with one
ommon parameter, standard for ver-
sions before 2005
-i*ndividual ea h peak has its own width parameter
(only in versions newer than 2005)
-r*ange=value set the variation range for the width to
value (value = [0:; 99:℄)
se*t t*ail -kind=value in lude spe i�ed tail into the �t fun -
tion and set variation range of de ay
onstant to value (value = [0:; 0:95℄)
kind might be one of the following:
l*eft peak tail
r*ight peak tail
b*a kground tail
-s*tep in lude a step fun tion into the �t
-f*it=kind in lude amplitude into the �t
-nof*it=kind �x amplitude
-f*it=step in lude amplitude of the step into the
�t
-nof*it=step �x amplitude of the step
-gamma add left- and ba kground tail
-all add all tails but step
-non*e
1)
�t only with Gaussians
-nokind ex lude spe i�ed tail from �t fun tion
1) default
2) polynomials with degree greater 0 are allways �tted
14 4 APPENDIX
4.1.6 De�ning Starting Parameters
ommand argument quali�ers omment
se*t b*a kground -�x*ed=value �x the ba kground to value if the degree
of the polynomial is 0
se*t pe*ak -l*ist=list list is a the name of a �le ontaining a
list of peak positions
se*t r*egion -l*ist=list list is a the name of a �le ontaining a
list of regions
se*t w*idth -v*alue=(value) spe ify a hannel independent peak
width (value = [1:; 400:℄)
- a*librate=�le �t an up to fourth degree polynomial
to the data set of widths in �le
-l*ist=name take the widths from the peak list name
se*t pa*rameter -w*idth=(values) spe ify the oeÆ ients of a polynomial
for the width
values=[a0[,a1[,a2[,a3[,a4℄℄℄℄℄
-kind=(values) de�ne tail parameters
kind might be one of the following:
l*eft peak tail
r*ight peak tail
b*a kground tail
values migh be a list of polynomial o-
eÆ ients up to 2nd degree for the am-
plitude a and de ay oeÆ ients w:
(a0,w0)
(a0,a1,w0,w1)
(a0,a1,a2,w0,w1,w2)
-s*tep=(values) values: a list of up to 3 polynomial o-
eÆ ients for the amplitude of the step
1) default
4.1 Summary of ommands 15
4.1.7 Fit Commands
om. argument omments
�t xmin,xmax,degree �t the region from xmin to xmax using a ba kground polynomial
of degree degree
�t xmin,xmax �t the region from xmin to xmax using a ba kground polynomial
of a degree as spe i�ed in the ommand \set ba kground ..."
�t �t the region from xmin to xmax as de�ned in the ommand
\set region -�t=xmin,xmax" using a ba kground polynomial of
a degree as spe i�ed in the ommand \set ba kground ..."
the �t ommand gets the peak positions either from the peak
sear h routine or from a peak list. Regions are ignored.
xmin,xmax are interpreted as energies if there is an energy ali-
bration and the ommand \set display -energy" has been given.
go �t the region from xmin to xmax as de�ned in the ommand
\set region -�t=xmin,xmax"
Get the peak positions either from the peak sear h routine or
from a peak list.
Get the �t regions either from a region sear h routine or from
a list of regions.
Get the degree of the ba kground polynomial either from the
ommand \set ba kground ..." or from a list of regions.
16 4 APPENDIX
4.2 Data Formats
The available data formats for data sets an be asked for with the ommand \show limita-
tions" or \help set �les -format". Data sets an be in hara ter or in binary mode.
4.2.1 Printable data sets
A printable data set is always in hara ter mode. Numbers are re ognized in the following
representations:
123 123. 123.4 1.234e+2 1.234E+02 1234.d-01 1234.D-1
Negative numbers are a epted as well.
A line is alled a header line if it ontains other hara ters than the one above. Fra tional
or negative hannel numbers are not allowed.
The following �le formats are standard:
as ii, �le extension: .as ii
the hannel ontents is listed without hannel number. There an be one hannel ontents
per line or several separated by spa es but a line should not be longer than 130 hara ters.
The hannel ontents are assumed to be listed with in reasing hannel numbers starting with
hannel 0, however this hannel is ignored. Any number of header lines may pre ede the data
set but at least one header line is required. Several spe tra ("sub spe tra") might be in one
�le, separated by headers. Sub spe tra are addressed by the sub spe trum number.
dat, �le extension: .dat
The �le is assumed to be an ASCII �le with a header followed by lines ontaining
[ hannel [sub spe trum℄℄ ontents
values in [℄ are optional. Spe tra are assumed to start with hannel 0 if hannel numbers are
not given however hannel 0 is always ignored. Channel and sub spe tra numbers must be
integer numbers with either integer or oat representation. The ontents might be integer
or oating point numbers also with exponential representation. Any number of header lines
may pre ede the data set but at least one header line is required. Several spe tra in one
�le are permitted. They must be separated by headers if the sub spe trum number is not
present. They are addressed with the sub spe trum number.
daterr, �le extension: .daterr
The �le is assumed to be a printable �le with a header followed by lines ontaining
[ hannel [sub spe trum℄℄ ontents error
values in [℄ are optional. Spe tra are assumed to start with hannel 0 if hannel numbers
are not given however hannel 0 is always ignored. Channel and sub spe tra numbers must
be integer numbers with integer or oat representation. The ontents and its error might
be integer or oating point numbers also with exponential representation. Any number of
header lines may pre ede the data set but at least one header line is required. Several spe tra
in one �le are permitted. They must be separated by headers if the sub spe trum number is
not present. They are addressed with the sub spe trum number.
4.2 Data Formats 17
4.2.2 Binary data sets
At present there are two binary formats integrated into gaspan : The Muni h online data
format (extension .osp) and a binary data format used in Strasbourg (extension .s).
4.2.3 Writing a spe trum read routine (to be written)
18 4 APPENDIX
4.3 The Fit Fun tion And Its Parameters
An ideal peak at hannel x
i
is de omposed into three ontributions:
f
i
= A
G
Æ(x� x
i
) full energy loss peak (1)
+A
G
A
L
e
(x�x
i
)
�
L
�(x
i
� x) left peak tail (2)
+A
G
A
R
e
�
(x�x
i
)
�
R
�(x� x
i
) right peak tail (3)
(see Philips and Marlow, NIM 137 (1976) 535 for a dis ussion)
The ba kground of the peak is de omposed into a left tail of the peak with a large de ay
onstant, a step fun tion
7
and a polynomial up to fourth order in hannel number
+A
G
A
B
e
(x�x
i
)
�
B
�(x
i
� x) ba kground tail (4)
+A
G
A
S
�(x
i
� x) step fun tion (5)
+
P
4
j=0
a
j
x
j
ba kground polynomial (6)
Note: all tail amplitudes are de�ned relative
to the peak amplitude, allowing peaks with
di�erent amplitudes in a �t region.
This ideal response fun tion is folded with
the real response fun tion
1
p
�
e
(�x
2
=
2
)
to yield (with a re-normalization of the tail
amplitudes) the most general peak shape
fun tion in gaspan whi h an be utilized:
0 200 400 600 800 1000channel
0
1
2
3
4
inte
nsity
peak lineleft peak tailright peak tailbackground tailstep
f(x) =
P
npeaks
i=1
A
G
(i) �
(
e
�
(x�x
i
)
2
2
i
+A
L
� e
(x�x
i
)
�
L
� erf
"
(x� x
i
)
i
+
i
2�
L
#
+A
B
� e
(x�x
i
)
�
B
� erf
"
(x� x
i
)
i
+
i
2�
B
#
+A
R
� e
�
(x�x
i
)
�
R
� erf
"
�
(x� x
i
)
i
+
i
2�
R
#
(7)
+A
S
� erf
"
(x� x
i
)
(i)
#)
+
P
degree
l=1
A
l
� (x� hxi)
l�1
with
hxi = 0:5 (x
max
+ x
min
)
7
the step fun tion is only in versions newer than Mar h 2003.
4.3 The Fit Fun tion And Its Parameters 19
The full width half maximum (FWHM) of a Gaussian is related to by
FWHM = 2
p
ln 2 � = 1:6651092223 �
All parameters but the oeÆ ients A
j
of the ba kground polynomial are subje t to on-
straints: The amplitudes A
G
(i), A
L
, A
R
, A
B
, and A
S
are de�ned as squares of the orre-
sponding �t parameters
A
G
(i) = a
2
G
(i) A
K
= a
2
K
� A
Ko
(i); K = L; R; B; S
limiting them to positive values and enhan ing the speed of the �tting pro edure. The
splitting in the tail amplitudes allows the de�nition of energy dependent amplitudes.
The variation of the position of the Gaussian peak x
i
as well as the width and de ay onstants
are restri ted to a ertain variation range. The sin (x)-fun tion for su h a restri tion is
re ommended in the literature but are has to be taken be ause of its periodi ity hen e the
fun tion psin(x) = sin (
�
2
x) is used restri ting jxj � 0:95 allowing still for a none zero slope
8
.
The peak positions are restri ted by:
x
i
= x
io
+�x � psin(px
i
)
�x is either set to the average FWHM of the peaks or set to zero, �xing the positions of
the peaks. The values of x
io
are obtained either by a peak sear h routine or by input and
by an analysis of the residuum of a �t. They are rede�ned after ea h �t y le, starting ea h
new y le with px
i
= 0.
The width of the peaks are restri ted to the range
i
=
io
� (1 + b
i
�� � psin(p
))
io
i.e. FWHM
io
and � are input parameters in the range [1:; 400:℄ respe tively [0: : 99:℄
9
.
� is ommon to all peaks as well as the parameter p
. The fa tor b
i
an be set to 0 or 1 for
ea h peak
10
. FWHM
io
an either be de�ned individually for ea h peak or is obtained from
a width alibration input into the program.
The tail de ay onstants are restri ted by
�
K
= �
Ko
� (1 + ��
K
� psin(p
K
)) K = L;R;B
Again �
Ko
and ��
K
are input parameters, the latter is restri ted to [0:; 1:0℄.
The value for the parameters adapting the experimental data y(x) are obtained by minimiz-
ing
�
2
=
X
x
(y(x)� f(x))
�y(x)
!
2
8
The fun tion psin(x) = x � (2 � jxj) with jxj � 0:95 and with the derivative p os(x) = 2 (1: � jxj) for
jxj � 1 and p os(x) = 0 for jxj > 1 has been used in earlier versions. The present de�nition is used to omply
with the previous de�nition.
9
[0: : 9:℄ in versions before Mar h 2005
10
Starting with versions Mar h 2005: Ea h peak has its own width parameter p
i
, b
i
is obsolete
20 4 APPENDIX
where �y(x) are the errors of the data points. The value of �
2
=degree freedom should be
in the order of 1.
The elements of the sum
r(x) =
(
(y(x)� f(x))
�y(x)
)
form a spe trum, the residue spe trum, whi h an be used to dete t small peaks or deviations
from a the Gaussian line shape.