Skip to content

Commit

Permalink
Broken manual in chapters; still need to work out equations
Browse files Browse the repository at this point in the history
  • Loading branch information
decarlof committed Jun 24, 2016
1 parent bdf90b7 commit 0600639
Show file tree
Hide file tree
Showing 39 changed files with 33 additions and 1 deletion.
9 changes: 8 additions & 1 deletion doc/source/manual.rst

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions doc/source/manual/analyze.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
IV. Analyze experiment data===========================4.1 Find the direct beam position---------------------------------In experiments, the detector may not be mounted on a diffractometerrotation arm and move in a circular track. In such case, the “Finddirect beam” function based on the “detector location” will not work. Ifthe detector position is accurately surveyed, the direct beam positioncan be manually calculated from geometry of the beam-sample-detectortriangle; otherwise, the “Find direct beam” function based on“Diffraction pattern” will help to estimate direct beam X and Y.Basically, users will be asked to mark out a diffraction ring andprovide information about the d-spacing of the atomic plane and theharmonic energy that this ring is generated with. In practice, a simpleand high-quality diffraction pattern from a reference sample should beused to facilitate the locating of direct beam position. Below is thedetailed procedure:1) Input experiment parameters and the sample structure. In this example, a transmission-mode diffraction pattern from Al foil was used.2) Load the diffraction pattern. If the raw data is multi-frame tiff file, the program will calculate the mean intensity of each frame and plots them in a figure. A dialog window will pop up simultaneously, asking which frame to load.|image10|Figure 4.1: Load diffraction data3) Load the energy spectrum.4) In the space to the right of the “Find direct beam” button, input the number of times that this process will be repeated. Users may choose to calculate direct beam X and Y for multiple times based on one specific diffraction ring to increase statistical accuracy, or based on different rings as long as the d-spacings and harmonic energies are known for these rings.5) Click “Find direct beam” button and choose “Diffraction pattern”. A message window will show up with the instruction for this process. Read it carefully, and click “OK” to proceed. The diffraction pattern that was loaded will then appear.6) On the diffraction pattern, use three points to define the diffraction ring. Single-click the first two points, and double-click the last one to complete the marking. Once confirmed, a dialog window will pop up asking the energy and d-spacing associated with this diffraction ring. Click “OK” to proceed.7) If users choose to do multiple times, repeat step (6) until it all finishes.8) The program will do the calculation and the direct beam X and Y values will show up in the GUI control panel.|image11|Figure 4.2: Procedure to estimate direct beam position based on adiffraction pattern9) Click “Calculate q map” to verify the direct beam position. Note that “q res (A)” has to have a number for this function. A figure with three panels will pop up. The left image is the q map corresponding to the selected 1\ :sup:`st` harmonic energy. The middle panel shows the map of azimuthal phi angles. The right image is the diffraction pattern overlaid with reference diffraction peaks (again corresponding to selected 1\ :sup:`st` harmonic energy). If the reference peak positions deviate much from the diffraction rings. Repeat the whole process and make sure the input of the diffraction ring information is correct. Note that those peaks which are generated by the n\ :sup:`th` harmonic energies (n>1) are not labeled here.|image12|Figure 4.3: Calculate q and phi maps to verify the direct beam position10) To more accurately locate the direct beam position, click “Label (hkl) in I(tth)” button, and choose “Experiment”. The I(tth) plot will show up with diffraction peaks labeled. Slightly adjust the direct beam position and repeat this process until the peak positions in the data match the reference. Note that each time the direct beam X and Y are changed, q map has to be calculated before using the labeling I(tth) function.|image13|Figure 4.4: Fine optimize the direct beam position11) Verify the direct beam position and the other experiment parameters by analyzing data from different reference samples, different detector angles, or different undulator gaps. The results should be consistently reasonable.4.2 Procedure for analyzing diffraction patterns------------------------------------------------Once the accurate direct beam X and Y are obtained, the program is readyto analyze user experiment data. Actually, most of the functions to beused have been mentioned above. A typical procedure is described below.4.2.1 Calculate I(tth) of individual diffraction pattern~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~1) Input or load sample structure.2) Load diffraction data.3) Load energy spectrum.4) Load and apply the absorption file if the transmission geometry is used. (Optional)5) Click “Define ROI” to mark out the region of interest. A message window will show up providing two options for ROI defining. Click “Full frame” is no region in intended to be masked out; click “Click to define” for selecting a certain region. Then, another message window will show up with detailed instructions. Click “OK” to proceed.6) In the diffraction pattern popping up, single-click the mouse left button at multiple spots (unlimited number) to define the region to be analyzed. Overlap the last the spot with the first one to complete the marking. Double-click the selected area to confirm. Once defined, the program will remember the ROI and automatically apply to the new data loaded. To analyze data with different ROI, simply re-define it.|image14|Figure 4.5: Define the region of interest7) Click “Calculate q map”. The diffraction rings should overlap with the reference peak positions perfectly.8) Click “I(tth) of data” button. A dialog window will pop up, asking “Do you want to perform the radial averaging over all angles or a certain range of angles?” This is useful when dealing with diffraction anisotropy, such as the cases of tensile or compressive loading. If choose “All”, the program will integrate all pixels within ROI. If choose “Segment”, another window will pop up, asking whether you need to input the starting and ending azimuthal angles or click in the diffraction pattern to define the angle range. Choose “Input” to type in the angles in the following pop-up window; or choose “click” and then single click the starting angle, and double click to select the ending angle. |image15| |image16| |image17| Figure 4.6: Calculate 1D intensity profile9) Click “Label (hkl) in I(tth)” button and choose “Experiment” to index the diffraction plot. Click “+” and “-” buttons to adjust the relative heights of the reference bars.10) Click “Get I(q) of data” button to get 1D intensity as a function of the reciprocal wavevector. (Optional) Here the q is calculated with the 1\ :sup:`st` harmonic energy.4.2.2 Calculate I(tth) of a series of diffraction patterns~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~1) Input or load experiment parameters, sample structure, energy spectrum, and absorption data as routine.2) Load data series by clicking “Load diffraction data series” button. A directory window will pop up asking for data selection. Choose files to be analyzed, and click “Open” to load them. The first pattern in the series will be displayed. |image18| Figure 4.7: Load data series3) Calculate q map and define ROI as routine.4) Click “I(tth) of series” button to obtain 1D intensity profiles from the loaded data files. The space to the right of the button takes input of a number, which will help spacing individual intensity profile off in the final plot, as shown in Fig. 4.8. Once clicked, a message window will show up with the instruction for the following step. Click “OK”, then a 2D intensity pattern will show up. The vertical axis is the frame number, and the horizontal axis is 2theta scattering angle. This is a pattern that piles all individual 1D intensity profiles together, which helps the user to observe the change in the scattering intensity due to a certain sample event. Click two points laterally (i.e. within same frame) in a flat part of the intensity map to define an angle range that contains flat background. Then all 1D intensity profiles will subtract their own background intensity (calculated within the same angle range), and re-pack together to generate a new 2D intensity pattern. Along with background subtraction, the new 2D intensity pattern will be populated in pixels via data interpolation, in order to display a smoother visualization effect.5) Similar to the analysis of individual diffraction pattern, one can choose to perform radial integration over all available azimuthal angles or a certain angle range.|image19|Figure 4.8 Calculate 1D intensity profiles for a batch of diffractionpatterns4.2.3 Calculate I(phi)~~~~~~~~~~~~~~~~~~~~~~

.. |image10| image:: figures/image11.png.. |image11| image:: figures/image12.png.. |image12| image:: figures/image13.png.. |image13| image:: figures/image14.png.. |image14| image:: figures/image15.png.. |image15| image:: figures/image16.png.. |image16| image:: figures/image17.png.. |image17| image:: figures/image18.png.. |image18| image:: figures/image19.png.. |image19| image:: figures/image20.png
Expand Down
3 changes: 3 additions & 0 deletions doc/source/manual/appendix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VII. Appendix=============7.1 Diffraction simulation--------------------------The simulation of a white-beam diffraction pattern from a known materialstarts from the calculation of monochromatic beam diffraction patternsfor the specific detector location, *I(θ,E)*. Then these mono-beamdiffraction patterns are integrated over the entire energy range withweighting factor being the flux of photons with different energy, F(E).where E\ :sub:`1` and E\ :sub:`2` are typically 1 keV and 60 keV,respectively. To improve the calculation speed, discrete diffractionpeaks are considered, meaning that *I(θ,E)* is normally replaced by aseries of I\ :sub:`hkl`\ (θ,E). Equation above then becomesIn our simulations, the diffraction peak shape is described using thepseudo-Voigt function.Essentially, the white-beam diffraction intensity at a given scatteringangle is the convolution of the input diffraction intensity of differentatomic planes with the energy spectrum of the x-rays.|image24|Figure 7.1: Simulation of white-beam diffraction7.2 How to obtain the sample absorption file-------------------------------------------- **Option 1**: Ask the beamline scientists for it. If users are not confident to calculate the attenuation curve, asking the beamline scientists is always the best choice. Provide sample parameters including chemical formula, mass density, and thickness. For example, sample Al\ :sub:`2`\ O\ :sub:`3`, density of 3.95 g/cm\ :sup:`3`, thickness 500 µm. **Option 2**: Use the web tool of The Center of X-Ray Optics (http://henke.lbl.gov/optical_constants/). Calculate the x-ray transmission for a solid with procedure shown below and in Fig. 7.2.- Fill in sample information- Select energy range- Click “Submit Request” to do the calculation. Another window will then pop up with the plot- Click “data file here” to show the values- Copy the data (without the sample info lines), and save it as a \*.txt file Note that this online tool can only calculate the transmission for energy ranging from 0-30 keV, which often not suffice for white-beam experiments.|image25|Figure 7.2: Calculate x-ray transmission at the website of CXRO **Option 3**: Self calculate based on the x-ray mass attenuation coefficients from NIST. At NIST webpage (http://physics.nist.gov/PhysRefData/XrayMassCoef/tab3.html), the attenuation coefficients (*µ/ρ*) are provided for elements from Hydrogen to Uranium. The x-ray attenuation *T* is calculated as: where *µ/ρ* is value directly from the webpage, *ρ* is the mass density of the sample, and *t* is the sample thickness. For compounds, the attenuation coefficients will simply be the weighted-sum of each element. where *w\ :sub:`i`* is the weight (or mass) fraction of element *i.* For example of Al\ :sub:`2`\ O\ :sub:`3`, density 3.95 g/cm\ :sup:`3`, thickness 500 µm, and for x-ray energy 10 keV. The mass coefficient of the sample will be: cm\ :sup:`2`/g The attenuation will then be:7.3 Some comparisons to guide the usage---------------------------------------1) Scaling factor: 4 vs 2 vs 1 Always, the larger the scaling factor, the faster the processing time, yet the smaller the resolution. For the example shown in Fig. 7.3, the simulation time for scaling factor 4, 2, and 1 are 11 min, 1.5 min, and 14 sec, respectively. (Note the CPU is Intel i7, 3.4 GHz) Clearly, the small peak at 48° can only be visualized in the patterns with scaling factor 2 and 1. The effect of scaling factor on the analysis of experiment data is not as obvious, as the signal-to-noise ratio of single-pulse diffraction patterns is rather low and radially averaging is more related to the parameters “Points” and “Q res”. For image with dimension of about 1k x 1k, the scaling factor of 2 may be a good option.|image26|Figure 7.3: Effect of scaling factor2) Direct beam position: wrong vs rightFigure 7.4 show the overlap of diffraction rings with the referencepeaks in cases of wrong and correct direct beam position input. Thecorrect parameters should satisfy all other data, either same samplewith different undulator gap (i.e. energy spectrum) or other samples.For this specific example in Fig. 7.4, all the diffraction rings aregenerated by the 1\ :sup:`st` harmonic energy, so they are all labeled,but this is not always the case. Figure 7.5 show the data from anotherundulator gap, in which some diffraction rings are generated by2\ :sup:`nd` harmonic energy. Users may simply input the photon energyused for labeling in the “E1 (keV)” space.|image27|Figure 7.4: Effect of direction beam locating on calculation of q map|image28|Figure 7.5: Reference peaks corresponds to 1st and 2nd harmonic energies3) Pointes and Q res: rough vs smooth plotsSmooth plot looks good, but may lose some structure information due tothe over averaging.|image29|Figure 7.6: Rough and smooth (yet low-resolution) 1D plots4) Region of interest: without ROI vs with ROIThis is not necessary if all the pixels on the detector functionproperly.|image30|Figure 7.7: Effect of ROI on the 1D plot

.. |image24| image:: figures/image25.png.. |image25| image:: figures/image26.png.. |image26| image:: figures/image27.png.. |image27| image:: figures/image28.png.. |image28| image:: figures/image29.png.. |image29| image:: figures/image30.png.. |image30| image:: figures/image31.png
Expand Down
3 changes: 3 additions & 0 deletions doc/source/manual/correlate.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
V. Correlate simulation with experiment data============================================*HiSPoD* doesn’t have a function to automatically fit the 1D diffractionintensity profiles. The curve fitting function here is a direct overlayof the experiment data and simulated results. If strain information isdesired, manually adjust the lattice parameter until the simulationmatches the experiment data perfectly. A typical procedure to correlatethe simulation with data is described below:1) Input or load experiment parameters and sample structure information.2) Load diffraction data, energy spectrum, and absorption file.3) Define ROI, and Calculate q map.4) Get I(tth) of data.5) Simulate “Realistic” diffraction pattern.6) Get I(tth) of simulation.7) Click “Overlay I(tth)” button in the “Tools” module. A message window will pop up telling users to get the noise level. Click “OK” to proceed. In the diffraction pattern, circle out a region (typically at the detector corners that are outside the scintillator) to collect the mean detector noise, and double-click to confirm. Another message window will pop up with instructions on how to define the background. Click “OK” to proceed. The 1D intensity profile of the experiment data will show up, in which multiple points need to be selected to define the background. Here the background (i.e. combination of the tail part of the transmission beam, air scattering and others) is assumed to follow the exponential decay function. Double-click the last point to confirm.|image20|Figure 5.1: Define noise and background8) Once the background is defined, two windows with diffraction plots will pop up, as Fig. 5.2. The first plot shows the data and the defined background. The second figure shows the data and simulation in two formats. The left one with noise and background, and the right one without.|image21|Figure 5.2: Overlay diffraction data and simulation9) Repeat step (10) if the fitting needs to be improved.10) For two-phase samples, adjust the content of each phase and re-do the simulation to get the best fitting result.11) For some samples with fine grains, the diffraction peaks will be largely broadened. To achieve a better curve fitting, the “Curve fit” function could be used. The “eta” and “sigma” parameters to the right of the button need user inputs. It’s assumed that the diffraction peak shape profile, if using monochromatic x-ray, can be described using pseudo-Voigt function, in which eta and sigma are two key parameters. “eta” is a parameter tuning the contribution of Gaussian and Lorentzian broadening in the Voigt function; “sigma” describes the peak width. (details in Appendix). After conducting previous steps of “Overlay I(tth)”, click “Curve fit” button. A message window with instruction will show up. Click “OK” to proceed. The figure with I(tth) curve will appear. Click two points on the figure to narrow down angle range for further fitting. The diffraction peak(s) within this range will be fitted. Double click the second point to confirm. Then another window will pop up, providing two options for curve fitting: one option is to match the maximum intensities of the data and simulation; the second option is to calculate standard deviation between the data and the simulation, and tune the scaling factor in order to minimize the deviation. For a good fitting, these two options yield very similar results.|image22|Figure 5.3: Quantitative curve fitting

.. |image20| image:: figures/image21.png.. |image21| image:: figures/image22.png.. |image22| image:: figures/image23.png
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit 0600639

Please sign in to comment.