SMAK Basics
This page outlines some of the basic functions of SMAK that you will use at the beam lines, including:
Opening a Single Energy File
-
Click “Open”.
-
Navigate to the directory that contains your data.
-
At the beam line this is your T drive which is a network drive in a Windows side bar.
-
The folder is usually named after the beam line and the month/year. E.g. bl23_feb20.
-
Map data is in the "xrf" folder as hdf5 files.
-
-
Select the map data you want to look at.
-
This loads your data into SMAK and you can select elements to view on the left hand side bar
-
-
Right click on the display and select "edge removal"
Opening Data For Multi-Energy Maps
-
Open one energy map as explained above.
-
Select “File” and then “Rapid Import From”.
-
A pop up will appear asking you to choose the element you want to import. Select the one you want.
-
This will add the element you selected for all the energies your selected and automatically give then and appropriate name e.g. “S@2472”.
-
-
You should now save the file in case SMAK crashes. Select “File” then “Save Data”.
-
Note you need to “Save Data” to save any changes you make from now on, just like a Word doc.
-
-
SMAK dynamically scales the contrast of the maps from the minimum to the maximum count values of the selected area of the element map.
-
These count values can be seen by moving the cursor over the map and reading the Z value.
-
You can change the "intensity" or contrast of the images using the vertical sliders to the right of the map display window.
-
NOTE:
-
Due to the nature of the data collection system, there are dead or erroneous pixels at the edge of the maps.
-
On the left side of the map there is usually one pixel for every line that registers as very high. At the right hand side there is usually an irregular sawtooth pattern of dead pixels.
-
This scales the maps including lots of zeros and some very high value pixels, and thus makes your actual sample look like there is very low signal and you can hardly see it (which is not in fact the case).
-
So you obviously want to get rid of that and this is where the Zoom function comes in. As you zoom in and exclude those erroneous pixels, SMAK will rescale automatically.
2 ways to zoom:
Edge removal - will remove 1 pixel from around the entire border of the map. Use this and you will see even with 1 pixel removed the map contrast improves greatly. Edge removal can be applied multiple times.
-
Right click on the map and select "Edge Removal".
Considering you don’t really know how many pixels are erroneous around the map, drawing a zoom box to include almost all of your map is, in my opinion, the way to go.
Box zoom - allows you to define rectangular region. You can zoom in multiple times so you can progressively zoom further and further in.
-
Place the cursor where you want a corner of the map to be.
-
Control, left click (and hold) and drag the mouse. You will see a box trace as you drag.
-
Release the mouse button.
-
The SMAK window will resize to the box you just defined.
-
Clear the zoom/Redefine zoom/Start again
-
Right click the map and select “Clear Zoom” to revert to the full map before any zoom functions were applied.
NOTE: if you right click and select “Clear Zoom” this undoes both the box zoom AND edge removal.
Building a Queue for XAS
This outlines how to use SMAK to pick points from your map data for XAS analysis. It also produces a graphical overlay of markers for your reference so you can correlate the XAS data to XRF data accurately.
Phase 1 - Picking points and creating queue files
-
Go to the “Legend” menu and select “Plot Marker Options”.
-
This opens a new window.
-
-
Click “Add Marker” button for as many points as you like.
-
To select a point on the map, click “Get Pos” then click a point on the map.
-
This populates the X and Y fields with motor positions.
-
-
Repeat for as many points as you like.
-
Add graphical markers so you can see the points. Go to the “Markers” menu and select “Set all Default”.
-
This gives all the points small which circle markers.
-
You can change the color and shape of these markers using the options to the right of each line.
-
-
You now need to save 2 versions of this marker list! Go to the “File” menu and select “Save Parameters”.
-
This saves a SMAK compatible version of this list so you can load this back into SMAK at a later date and see your markers.
-
-
Go to the “File” menu again and select “Save as Queue”.
-
This saves a version of the file which can be loaded into uXAS.
-
The default file save location is the "xrf" folder
-
-
Now go to the control computer. In uXAS and click the “Setup Queue” button.
-
This opens the queue editor. If there are already lines in the queue you should clear these out by clicking the “Clear” button at the bottom of the window.
-
-
Click the “Load Queue” button at the bottom of the window.
-
You will probably need to navigate to you “xrf” folder on your T drive.
-
-
Select the queue file you just made in SMAK.
-
You will now see that the locations have been loaded in as separate lines into the queue editor.
-
Phase 2 - Customizing the queue in uXAS
-
Edit file names, regions and repeats as appropriate. To edit a single line, make sure to click the line then edit the information in the appropriate fields, and click "Apply". To batch change all the lines, double click the header of the field box.
-
If you have rearranged the order of the queue from when you saved it in SMAK you should re-save a SMAK version by clicking “Write Plot Markers” (bottom left of uXAS).
-
When you are done editing, click the "Send" button at the bottom of the window to send this queue to the Master Data queue. The queue window will close automatically.
Normalizing with the TIME channel
Occasionally, there is an artifact in the data which presents as faint vertical stripes but also as an saw tooth artefact on the left edge of the maps which are related to the acceleration of stages at the start of each line (the latter is more of an issue with 6–2 which scans very fast).
This is due to the scanning signal processing electronics and is recorded in the TIME channel.
The artifacts can be removed by normalizing your data to the TIME channel. Click the “Map Math” button. This opens a new window that allows you to perform mathematical functions on the data. You select the channel in the left column, the operation in the middle column and next channel in the right column. You can then click “Do Calculation” which performs the function for you to asses. If you like it, you can enter a new channel name and click “Save Calculation”. This will save the result as a new channel. Here you want to select one of your “SUM” channels you created earlier in the left column, select “Multiply” in the middle column and “Scalar” in the right column. This gives you a box to enter a scalar value. Enter “0.0000125”. Give this a new name like “S Sum Time” and click “Save Calculation”. OK, that’s the more complex bit done. You should now do to the “File” menu and click “Save Data”.
Preparing images for data analysis (correlations and PCA)
The data can contain some noise and artifacts which can reduce the quality of the data analysis. This process helps alleviate those issues
Open your data as above. Select the “Process” menu and click “Advanced Filtering”. This opens a new window with a list of elements and many buttons. Select the element you want to process and click the “Blur” button. Drag the “Filter Size” slider to 5. Drag the “Std. Dev.” slider to 0.8. Click “Save”. This creates a new channel called “Element-blur”, e.g. S-blur. Select each element you want to work with and click “Save” for each. You will end up with a set of -blur channels.
What you just did was apply a sort of smoothing to the map data. The filter size defines how many pixels around a point should be combined into one. A filter size takes a 5×5 pixel area. If you had chosen the “Mean” button, SMAK would have assigned the mean value of the 5×5 pixel area. “Blur” takes a Gaussian distribution of the area.
Correlations
You can now do correlations between elements by clicking the “Correlation Plots” button. This opens a new window where you can choose to plot one channel against another. The data plotted corresponds to whatever area is in the display window. You can “Mask” particular areas of the correlation plots by clicking “Define Mask” button and drawing an area around parts of the plot. You can then click the “Use Mask” button in the main SMAK window. The display will now only display the masked area of the plot.
Principle Component Analysis (PCA)
Click the “PCA Analysis” button. Select the channels you want to do PCA on (usually multiple energy maps). There are many types of PCA you can do but start with clicking the “sPCA” button. SMAK will process the data and produce a number of new channels called e.g. “sPCAComp1”, “sPCAComp2” etc. Very broadly, component 1 is using a proxy for concentration as concentration is the greatest variable in your data. You can create an inverse image of a component map by clicking “Map Math” in the main SMAK window and selecting the channel in the first column, “Multiply” in the second column and “Scalar” in the third column, then entering −1 into the box. You can then use these images to help you select locations for XAS by following the “Building a queue” instructions.
Alignment of misaligned images
If you have images that are slightly misaligned, there is a way to register them. Say, for instance that you measured a map at 12 KeV, then decided you wanted to measure the same map at 7 KeV. The position of the beam will shift slightly between these energies, and the resulting maps will be misaligned by a few microns or so.
-
Load you first data file (e.g. 12 KeV map), then import the channel you want to align from your second data file (e.g. 7 KeV map)
-
Go to the Process menu
-
Select ‘Stack Alignment’
-
A window will pop up where you can click which channels to align (select all channels using control + left click)
-
SMAK will now align the selected channels and make a new channel with ‘-stack1’ appended to the end of the name
-
If you want to apply this alignment to another channel (say you collected a multi-energy map at 7 KeV and actually need to import the same channel at 5 different energies), select ‘Apply Last Alignment’ from the process menu and select the channels to which you would like to apply the alignment
Intensity Histograms
You can view a histogram of the pixel intensities in your image. This provides a very quick and easy way to see the range of intensities present in your images for each element. The histogram will plot the number of pixels that exhibit intensities within a specific range (or "bin"), e.g. from 10-20 cts, 20-40 cts, 40-50 cts, etc. The specific range is set by the overall range in intensities present in your image and the number of bins.
-
Go to the Analyze menu
-
Select Make histogram
-
A new window will appear. Select the element (channel) you are interested in to view its histogram
-
The default number of bins is 25. Under histogram options (at the bottom of the window) you can put in whatever number you want, then hit the blue Update button
-
you can export the data by clicking the green Export button. This will save the data to your clipboard and you can directly paste it into a spreadsheet or text file.
Setting the intensity scale on the display
The displays automatically scale. The most intense pixel appears as red; the lowest intensity pixel as dark blue. Particularly when comparing across images taken on multiple samples, you may want to set the color scale on the display to be the same. To do this, right click on the display. Select "set max scale" then enter the maximum intensity and press ok.
Deadtime Correction
What is "deadtime"?
Deadtime is essentially oversaturation of the detector. It occurs when the number of incoming photons exceeds the ability of the detector to count; that is, the incoming count rate (ICR) is greater than the outgoing count rate (OCR).
When should I perform deadtime correction?
We VERY rarely do deadtime corrections on data collected at the micro-imaging beamlines at SSRL because our detectors are linear to very high count rates (ICR > 3 million counts per second). You can tell if you are in the deadtime regime by looking at OCR vs. ICR in the correlation plotter. You should have a perfect line. If there is curvature to this line, then the detector is being saturated and you should do a deadtime correction.
How do I perform deadtime correction?
(1) Plot OCR (y-axis) vs. ICR (x-axis) in the correlation plotter
(2) Under the "Analysis" drop down manu, select "Do ICR-OCR Deadtime". This fits a function to the data, and you will see a numerical value for "DEADTIME" displayed at the bottom left of the correlation window. This value is "tau".
(3) Under the "Process"menu in the main SMAK window, there is an option for "Deadtime". Select "Apply deadtime correction".
(4) This opens a new window where you can enter a value for tau. SMAK automatically loads the fitted value from the correlation plotter.
(5) Check the box that says "Do DT correction?" and press "ok".
(6) You can also write a deadtime correction file that can be applied to your XANES spectra in Sixpack. However, note that you must have collected the detector channels individually instead of summing them, which is rarely done. Normally, if we collect images using a 7-element detector, we automatically sum all 7 detector channels together, producing a single channel that is viewed in SMAK. We can change the settings during data collection so that these images are not individually summed, in which case, you will have 7 different images for each fluorescent line that you are monitoring (when you load your data file into SMAK, SMAK automatically shows all 7 images for all fluorescent lines in the list of channels). You have to know during data collection that you want to run in this mode- there is no way to get this information afterwards. (Note: for BL 2-3 this is not an issue because 2-3 only have a 1-element detector).
Open Optical Image File
For SMAK v 3.0 or higher, you can open an optical image file collected concurrently with the XRF map data (i.e., through "add ImgCap to queue". These are data files with "...img_raw..." in the name.
(1) Under File, select "Covert SSRL Mosaic"and then select your file
(2) When your mosaic is complete, a window will pop up and ask "Load new mosaic file(s)?"
(3) Select yes
(4) Four new data channels will be added: Blue, Red, Green, and Grey. The optical image is split into three channels- red, green, and blue- which must be combined in order to get the true color displayed. To do this, open TriColor Plots and select the Red channel to be red, etc. The grey scale is a condensed version of the Blue, Red, and Green channels
Export Optical Image into XRF Dataset (or vice versa)
For SMAK v 3.0 or higher, you can import the Red, Green, Blue, and Grey data channels from the optical image into the corresponding XRF dataset. The optical and XRF images are different size- they have different resolutions, or "mesh sizes". You'll need to change the size of the optical image to import it into the XRF image (or vice versa). The optical image is typically larger in size (higher resolution) than the XRF images, so the optical image will be down-sized to match the XRF image. You can also up-scale the XRF image to fit the optical image if you would like. To do this:
(1) Open both data the optical image data and XRF image data in SMAK.
(2) In the tab for the optical image, under File, select "Export with Resize". Select all channels you want to export, and hit ok.
(3) Select the file into which you want to import these channels (i.e., the XRF dataset) and hit ok.
(4) Your color channels will now appear at reduced size in the XRF list of channels.
(5) You can display an overlay of one of the optical channels and one of the XRF channels. To do this, under View, select "Crossfader". In channel 1, select Grey. In channel 2, select the XRF image. Move the fader bar to change the saturation of channel 1 relative to channel 2.