Savuke batch scripts

This is a simple script demonstrating the advantage of doing a global analysis.  The data files associated with this script can be found under 'example' in the Savuka zip file that you can download here.

# A very simple example of the usefulness of global analysis
# This batch script will read in two data files and fit them first with the
# time constants as local parameters and then with the time constants as
# global parameters.  The first fit (time constants local) will give a large
# error and inaccurate time constants.  With the time constants linked, a
# much better estimate of the time constants is obtained.
#
# The true values are:
# first data file:
# amp1=0.5
# tau1=1.
# amp2=0.5
# tau2=2.
#
# second data file:
# amp1=-0.5
# tau1=1.
# amp2=0.5
# tau2=2.
#
# You can put comments in your batch scripts like this.
#
# You can execute this script by typing in the following at the Savuka prompt:
#
# SA> exec example.bat
#
# To run it interactively you would add the '-i' flag:
#
# SA> exec -i global-example.bat
#
# You can also define aliases much like in Unix:
#
set $infile1 decay1.asc
set $infile2 decay2.asc
#
exp 0
#
rea $infile1 1 512 1 0      # read first data file (goes into buffer 1)
rea $infile2 1 512 1 0      # read second data file (goes into buffer2)
#
rp guess.par         # read guess parameters; can be entered interactively, too.
unl 4                  # unlink the time constants for exponential 1
unl 2                  # unlink the time constants for exponential 2
fit 20 stats-local.sta # fit the data: time constants too close - large error
sd 2                   # change stack depth to plot residuals and fit
dr 1 2 1               # plot the data and fit
lnk 4                  # Now link the time constants for exponential 1
lnk 2                  # ditto for exponential 2
fit 20 stats-global.sta # fit the data: time constants and amplitudes nailed.
dr 1 2 1               # true values are 0.5,1.,0.5,2. and -0.5,1.,0.5,2.
#
# When the script is done you are returned to the command line
# unless you specify dialog state 0 (ds 0).


Here is a more detailed script for processing TCSPC anisotropy data:

clear -s 4096
#
set $infile wtdhfr-cor.ve
#
set $outfile  wtdhfr-ani.ve
#
# enter g-factors
#
set $g320  .7028533E+00
set $g325  .6921739E+00
set $g330  .6835036E+00
set $g335  .6777156E+00
set $g340  .6763533E+00
set $g345  .6807551E+00
set $g350  .6779181E+00
set $g355  .6814280E+00
set $g360  .6818691E+00
#
#
set $fb 1         # first buffer
set $lb 18        # last buffer
#
set $fbani 19        # first buffer
set $lbani 36        # last buffer
#
set $vv320 1      # buffer for vv at 320nm
set $vh320 2      # buffer for vh at 320nm
#
set $vv325 3      # buffer for vv at 320nm
set $vh325 4      # buffer for vh at 320nm
#
set $vv330 5      # buffer for vv at 320nm
set $vh330 6      # buffer for vh at 320nm
#
set $vv335 7      # buffer for vv at 320nm
set $vh335 8      # buffer for vh at 320nm
#
set $vv340 9      # buffer for vv at 320nm
set $vh340 10      # buffer for vh at 320nm
#
set $vv345 11      # buffer for vv at 320nm
set $vh345 12      # buffer for vh at 320nm
#
set $vv350 13      # buffer for vv at 320nm
set $vh350 14      # buffer for vh at 320nm
#
set $vv355 15      # buffer for vv at 320nm
set $vh355 16      # buffer for vh at 320nm
#
#
set $vv360 17      # buffer for vv at 320nm
set $vh360 18      # buffer for vh at 320nm
#
#
#
#=========================================================
#
# read in the data for all of the wavelengths:
#
mr $infile ve 1 1 256 1
#
exp 0
#
xr 1 320 0 0
xr 2 320 0 0
xr 3 325 0 0
xr 4 325 0 0
xr 5 330 0 0
xr 6 330 0 0
xr 7 335 0 0
xr 8 335 0 0
xr 9 340 0 0
xr 10 340 0 0
xr 11 345 0 0
xr 12 345 0 0
xr 13 350 0 0
xr 14 350 0 0
xr 15 355 0 0
xr 16 355 0 0
xr 17 360 0 0
xr 18 360 0 0
#
# calculate the anisotropy and total intensity curves
#
ani $vv320 $vh320 $g320
ani $vv325 $vh325 $g325
ani $vv330 $vh330 $g330
ani $vv335 $vh335 $g335
ani $vv340 $vh340 $g340
ani $vv345 $vh345 $g345
ani $vv350 $vh350 $g350
ani $vv355 $vh355 $g355
ani $vv360 $vh360 $g360
#
# write the final anisotropy and total intensity :
#
#
mw $outfile ve $fbani $lbani
#

clear -s 4096
#
set $infile wtdhfr-cor.ve
#
set $outfile  wtdhfr-cor-gcor.ve
#
# enter g-factors
#
set $g320  .7028533E+00
set $g325  .6921739E+00
set $g330  .6835036E+00
set $g335  .6777156E+00
set $g340  .6763533E+00
set $g345  .6807551E+00
set $g350  .6779181E+00
set $g355  .6814280E+00
set $g360  .6818691E+00
#
#
set $fb 1         # first buffer
set $lb 18        # last buffer
#
set $vv320 1      # buffer for vv at 320nm
set $vh320 2      # buffer for vh at 320nm
#
set $vv325 3      # buffer for vv at 320nm
set $vh325 4      # buffer for vh at 320nm
#
set $vv330 5      # buffer for vv at 320nm
set $vh330 6      # buffer for vh at 320nm
#
set $vv335 7      # buffer for vv at 320nm
set $vh335 8      # buffer for vh at 320nm
#
set $vv340 9      # buffer for vv at 320nm
set $vh340 10      # buffer for vh at 320nm
#
set $vv345 11      # buffer for vv at 320nm
set $vh345 12      # buffer for vh at 320nm
#
set $vv350 13      # buffer for vv at 320nm
set $vh350 14      # buffer for vh at 320nm
#
set $vv355 15      # buffer for vv at 320nm
set $vh355 16      # buffer for vh at 320nm
#
set $vv360 17      # buffer for vv at 320nm
set $vh360 18      # buffer for vh at 320nm
#
#
#
#=========================================================
#
# read in the data for all of the wavelengths:
#
mr $infile ve 1 1 256 1
#
exp 0
#
xr 1 320 $g320 0
xr 2 320 $g320 0
xr 3 325 $g325 0
xr 4 325 $g325 0
xr 5 330 $g330 0
xr 6 330 $g330 0
xr 7 335 $g335 0
xr 8 335 $g335 0
xr 9 340 $g340 0
xr 10 340 $g340 0
xr 11 345 $g345 0
xr 12 345 $g345 0
xr 13 350 $g350 0
xr 14 350 $g350 0
xr 15 355 $g355 0
xr 16 355 $g355 0
xr 17 360 $g360 0
xr 18 360 $g360 0
#
# correct horizontal data by multiplying by the g-factor:
#
mul $vh320 $vh320 $g320
mul $vh325 $vh325 $g325
mul $vh330 $vh330 $g330
mul $vh335 $vh335 $g335
mul $vh340 $vh340 $g340
mul $vh345 $vh345 $g345
mul $vh350 $vh350 $g350
mul $vh355 $vh355 $g355
mul $vh360 $vh360 $g360
#
# write the g-corrected data:
#
mw $outfile ve $fb $lb
#

Comments