nscl_logo_small.gif (2463 bytes)

Scripts and SpecTcl

HH00706_.jpg (6530 bytes)

SpecTcl is built around the Tcl/Tk scripting language.  Scripting languages allow you to automate and extend the functionality of an interactive program without modifying the program itself.  They provide a command language interface to the program which itself is a programming language.  This facility makes it easy to do things with SpecTcl which are hard or in any event tedious with other analysis software.  The Tk component of SpecTcl allows a user tailorable graphical user interface to be layered on top of SpecTcl.

For example:

As a simple inline example.  Suppose you have to specify a segmented detector and its spectra.  With an unscripted system you might have had to do something like:

parameter seg1e 1 10
parameter seg2e 2 10
...
parameter seg100e 100 10
spectrum  seg1e 1 seg1e 10
...
spectrum  seg100e 1 seg100e 10

With SpecTcl scripting you can concisely write this as follows:

for {set segno 1} {$segno <= 100} {incr segno} {
   set    name seg
   append name $segno e
   parameter $name $segno 10
   spectrum  $name 1 $name 10
}

And let the execution of this script define the 100 parameters and spectra for you.

In other data analysis software you might have to recompile the analysis software to add an ad hoc computed parameter.  With SpecTcl, you can actually script a pseudo parameter using the pseudo command, dynamically adding an event by event computation to the running program.

Future planned enhancements to SpecTcl will allow you to specify scripts which run:

These scriptable actions will allow you to build scripts to completely automate production mode histogramming.

 


Last Modified: October 28, 2003 by: fox@nscl.msu.edu
© Copyright NSCL 1999, All rights reserved