-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.jbs
More file actions
executable file
·53 lines (42 loc) · 2.05 KB
/
example.jbs
File metadata and controls
executable file
·53 lines (42 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env jabs
#This is a comment
set ion 4He #4He is also known as "a"
set energy 2027keV
set alpha 0 #this and the following two lines are equivalent
set alpha 0deg
set alpha "0 deg"
#Default cross sections can be changed easily between the built-in models, see other examples on how to define reactions using e.g. R33 files
#set cs_rbs Rutherford
#RBS (and ERD) reactions are added automatically when running a simulation or a fit, if no reactions are specified
#load reactions RBS
#add reaction RBS 197Au
set fluence 2.0e13 #Fluence is actually total number of ions, not ions/cm2... this should *not* be multiplied by detector solid angle (JaBS will do that)
load exp "experimental.dat"
#sample can be set with one command
#This will add gamma roughness in the Au layer using 20 subspectra in simulation (default, so it could be omitted)
set sample Au 30tfu rough 20tfu n_rough 20 SiO2 6500tfu Si 20000tfu
#or loaded from a file (tabular data)
#load sample "sample.txt"
load script "detector.jbs" #Scripts can be loaded (run). It is convenient to store detector in a separate script.
#The following line can be uncommented after this script is run. We save the detector calibration at the end of the script.
#load script "calibration_out.jbs"
set emin 150keV #Speed up by setting the minimum energy in the simulation (optional)
#show sim
simulate #Run a simulation
save spectra "simulated_out.csv" #Save spectra
#fit ranges (channels) must be specified before fitting. We can define multiple ranges with one command.
add fit range [200:449] [450:700]
add fit range [1050:1110]
#Number of iterations can be limited if there is reason to suspect the fit won't converge...
#set maxiter 100
#Run a fit
fit *calib*,fluence,thick1,thick2,rough1,conc2_O
save spectra "example_out.csv"
save calibration "calibration_out.jbs" #detector calibration can be saved to a script file. This can be loaded back in.
save sample "sample_out.txt" #fitted sample can be saved (and loaded back in later!)
#show detector
#show fit
#show fit correlation
#show sample profile
show fit ranges
#roi [1060:1092]