Tcl console

Tcl is an easy to learn scripting language in which you will eventually be able to automate your data fitting. You can access the Tcl console from the options menu.

I will not attempt to describe tcl here. See http://www.msen.com/~clif/TclTutor.html for an interactive tutorial.

At present the analysis is set up to be driven by the GUI, so although you could automate it, it would be awkward to do so. For now Tcl console is useful for debugging.

One thing you could do now in the tcl console is program a movie showing how the reflectivity changes as you move a parameter through parameter space. Here we are using gmlayer to set the parameter in the underlying program directly. You can see the available parameters in a table under the fit tab.

The following procedure is available from the Tcl console:

  proc movie {field min max frames} {
   set step [expr ($max - $min)/($frames-1)]
   for {set i 0} { $i < $frames } { incr i } {
	gmlayer $field $min
	read_profile
	read_reflectivity
	set min [expr $min + $step]
   }
  }

You can watch a movie using, for example:

  movie mqc2 0.0003 0.0004 10

or if you are using reflpol,

  movie qc2 0.0003 0.0004 10

Using this technique you can make the path through parameter space as complex as you want.

For a more complicated example, enter the command "dump chisqplot". This command is similar to movie, except it displays a plot of chisq each step of the way. Be warned that both of these examples leave the GUI in an inconsistent state, so subsequent manipulation of the profile or layer table may have surprising results.

With some effort you could cache the profiles and lineshapes for each step of the movie in separate blt vectors, then play them back quickly by setting the -ydata on each element of the graph to the name of the vector containing that frame of the element. You will need a timer between each frame otherwise the frames will flash by too quickly. Be sure to restore the original -ydata afterward.

You can create movie programs in your own text editor and load them into the Tcl console using:

	source filename

2003-06-12


Browse Index