top of page

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

  1. Click “Open”.

  2. 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.

  3. 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

  4. Right click on the display and select "edge removal"

Opening Data For Multi-Energy Maps

  1. Open one energy map as explained above.

  2. Select “File” and then “Rapid Import From”.

  3. 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”.

  4. 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.

Zooming and Contrast

  • 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.

  1. 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.

  1. Place the cursor where you want a corner of the map to be.

  2. Control, left click (and hold) and drag the mouse. You will see a box trace as you drag.

  3. Release the mouse button.

    • The SMAK window will resize to the box you just defined.

 

Clear the zoom/Redefine zoom/Start again

  1. 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

  1. Go to the “Legend” menu and select “Plot Marker Options”.

    • This opens a new window.

  2. Click “Add Marker” button for as many points as you like.

  3. 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.

  4. Repeat for as many points as you like.

  5. 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.

  6. 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.

  7. 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

  8. 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.

  9. 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.

  10. ​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

  1. Edit file names, regions and repeats as appropriate. Remember to click “Accept” when you are done.

  2. 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).

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.

  1. 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)

  2. Go to the Process menu

  3. Select ‘Stack Alignment’

  4. A window will pop up where you can click which channels to align (select all channels using control + left click)

  5. SMAK will now align the selected channels and make a new channel with ‘-stack1’ appended to the end of the name

  6. 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.

  1. Go to the Analyze menu

  2. Select Make histogram

  3. A new window will appear. Select the element (channel) you are interested in to view its histogram

  4. 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

  5. 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).

zooming
Open data
queue
TIME
preparing images
Correlations
PCA
Image alignment
histogram
Top
set intensity
deadtime
bottom of page