|
Print View
NERS/BIOE 580
Lab02 - Introduction Module B Purpose:
This module is intended to introduce the
XSPECT utility programs, the database of xray
interaction coefficients, and the collection of files
defining the composition of various materials.
Discussion:
XSPECT
utility programs are written in fortran and have been
compiled for Microsoft Windows computers.
The programs are distributed along with files for x-ray interaction
data, material properties, detector tables, object dose tables,
script procedures for building applications, and laboratory
module instructions.
For Microsoft Windows systems,
a binary Windows distribution of XSPECT should have been
copied to the computer to be used as a part of
01-Intro-A
and the tcl/tk script interpreter
and the gnuplot plotting utility installed.
Task Intr-B1: Introduction to the lab documentation
The XSPECT files and programs are in $XSPECT_DIR/_xspect3.5.
One of the subdirectories, _doc, contains files documenting
each the programs and other important concepts.
Change directories to _xspect3.5/_doc and review
the documentation files named
Material.txt and
atten_coeff.txt.
Task Intr-B2: Introduction to material property files
The material definitions referred to in Material.txt are located
in the directory $XSPECT_DIR/_materials.
Look in this directory and examine a few of the materials.
The files contain ascii text, but do not have a file extension.
You will need to use the right button, select open,
and use a text application such as notepad or wordpad.
Task Intr-B3: Script for XSPECT initialization, link.tcl
In the _xspect3.5/_tcl directory is a script
used to initialize the XSPECT environment (link.tcl).
Read the contents of this file and note the first few lines
that contain the instructions to start the tcl/tk interpreter
that were described in
Tcl4xspect.pdf.
The commands in link.tcl needs to be configured for the computer you
are using and will then be used for later laboratory modules.
Task Intr-B4: Setting the XSPECT_DIR environmental variable
To obtain the directory where the executable programs are
located, the link.tcl script obtains a base directory name
that must be set as an environmental variable.
The executable programs also use this base directory to locate
various data files. For this reason, the directory structure of
the files in the XSPECT distribution should not be changed.
For Microsoft Windows systems, environmental variables are set using the
system properties available to the user.
For Windows 7 systems, open the control panel using the start button.
For Windows 10, open the control panel by typing 'control panel'
in the search box on the taskbar.
In the control panel, select 'View by: small icons',
and select the 'system' option.
In the left column, select 'Advanced system settings'.
In the 'System Properties' window you will
see a button for 'Environmental Variables'.
Create a 'NEW' system variable with a name of XSPECT_DIR
and a value with the path to the _xspect3.5 directory.
For example;
XSPECT_DIR    C:\XIRL\SRC\_Rad-Img
Note: the Windows operating system uses a back-slash to separate
the sequences of folders in a path.
If you do not have account privileges to set environmental variables
on the system you are using, there is an alternative method.
In the _xspect3.5/_tcl/link.tcl file, add the 'set env(XSPECT_DIR) ..' command
shown below just before the 'set BIN' command;
set env(XSPECT_DIR) "C:/XIRL/mikef/SRC/_Rad-Img"
set BIN [file join $env(XSPECT_DIR) _xspect3.5 _bin]
The path in quotes should be the path to the course distribution
that you have installed on the system you are using.
Note: Unlike Windows, Tcl/Tk uses a forward-slash to separate
the sequence of folders in a path as does Unix/Linux and MacOS.
Remember to use the forward-slash as Tcl/Tk treats the back-slash
as an escape indicator to skip the next character except for
certain special characters like \n for newline.
Task Intr-B5: Starting a tcl/tk command window using link.tcl
On a Microsoft Windows system, the tcl/tk interpreter is run interactively
by starting the 'wish' program from the programs menu.
This creates a command window that will interpret either tcl
or tk commands along with a window to place graphic widgets.
An alternative interpreter, tclsh, will only recognize tcl commands.
To interpret commands that have been saved in a file, Windows
executes files with extensions of .tcl using the wish interpreter.
This property is set when tcl/tk is installed.
Simply executing the file (double click) will run the wish
program and sequentially interpret each command in the file.
The _xspect3.5/_tcl/link.tcl script will be used at the beginning of
scripts assembled in subsequent laboratory modules.
In the _xspect3.5/_tcl/link.tcl script, the platform is determined as Windows
or Unix and the configuration adjusted accordingly.
For windows, the command 'console show' is used to
allow the interactive tcl/tk command interpreter window to be used
to report messages or execute additional commands.
For Windows systems, the appropriate gnuplot application is defined
in _xspect3.5/_tcl/link.tcl as wgnuplot.exe using a path typical of that
for gnuplot installation. Check this to see if it is correct for your installation.
If not, the full path needs to be set by editing the 'set gnuplot ..'
command located located just after the 'console show' command.
For example,
set gnuplot [file join C:/ {Program Files} gnuplot bin wgnuplot.exe]
Note: The 'file join ..' command within the [..] brackets combines
the arguements into a path appropriate for the OS being used.
If a path element has spaces, it needs to be enclosed in {..} brackets.
In this example {Program Files} denotes the folder in a 32 bit system.
For a 64 bit system it will be {Program Files (x86)}.
At the end of the _xspect3.5/_tcl/link.tcl program are simple commands to pack
a button in the graphic window that quits the wish interpreter.
Later applications will expand these graphic commands.
Make a directory in your home folder or desktop with a name such as NERS580.
This can be used for completing the lab module assignments.
Then place a copy of the _xspect3.5/_tcl/link.tcl file
that has been modified to initialize your XSPECT environment
and place it in the NERS580 home directory.
Running this script will open a command window that can be used
to execute XSPECT commands.
Intr-B6: Generate a table of attenuation coefficients.
The program
atten_coeff
produces a table of linear attenuation coefficients and a table of
material transmission values. Using the above link,
review the atten_coeff documentation.
Then start the interactive interpreter using the link.tcl script
in the NERS580 home directory
and define input arguments for 1 cm of Aluminum and 1 mm of Lead;
- set erange "10 50 2 \n"
- set matsN "2
-           al_1100 1.0
-           lead 0.1 \n"
- set in "$erange $matsN"
The arguments have been defined as two variables, erange and matsN,
only for clarity. Note that a newline character has been included
at the end of the text strings defined for both variables.
The program can now be executed by entering the following command
at the interpreter prompt;
- exec $BIN/atten_coeff << $in
Files labeled al_1100.atn, lead.atn, and trans.dat
will be created in the same directory as link.tcl.
Similar commands are in the file _templates/atten_coeff.txt
where the atten_coeff program is executed using the Tcl catch
command to report any execution errors.
Copy this file to the NERS580 home directory.
The arguments can be modified to match the material and thicknesses
of interest. The template commands can then be executed using the Tcl source command.
In an interactive tcl/tk interpreter window started with link.tcl,
enter the following command;
For this laboratory, select a material and generate attenuation
results for an appropriate thickness. I would suggest using an energy
range from about 10 to 100 keV. I would further suggest selecting
a material with a high Z element in it so as to see the K absorption
edges. Use a dKev of about 1 so the the edges appear distinctly.
Be sure the thickness you chose gives reasonable transmission values.
Using a gnuplot command file, plot the mass attenuation coefficient for the
material from the *.atn file and save it as a png graphic file.
You will need to use the "using 1:3" option for the plot;
- gnuplot> plot datafile using 1:3 ...
Next, modify the gnuplot command file to plot the total transmission
from the trans.dat file and save it as a png graphic file.
The gnuplot help file and the gnuplot overview document,
'Gnuplot4xspect.pdf', will
explain how to set the line type to a solid line
and put labels and titles on the graph.
For the plot of attenuation coefficients you will want to use
a semi-log plot by setting the y scale before the plot command;
Save copies of these two plots for submission to the instructor.
Observe from these plots the features associated with K edge
absorption and the strong energy dependence associated with
the photoelectric cross section. Note in the transmission plot
how the transmitted flux increased for energies just below the K edge.
Lab02 results:
For this module, simply turn in the plots of attenuation and
transmission generated for the material that you selected.
- L02-B6-atn.png : Plot of material x-ray attenuation.
- L02-B6-trans.png : Plot of material x-ray transmission.
L02 Reference script: Lab02_Intr-B.tcl
Next:
The next module is
03-Source-A.
|