materialsautomated / materialsautomated.github.io

Home of Materials Automated Sessions
MIT License
6 stars 8 forks source link

LEED Analysis Software #20

Open jessicadong31 opened 4 years ago

jessicadong31 commented 4 years ago

Inputs: A set of around ~300 LEED patterns of the same sample taken at different energies. These patterns are .jpg files. There should be an option to load in a full set of images or allow for a full set of images can be generated during the analysis process. A text file containing the image names and corresponding energy values is also necessary.

image Sample image used for input.

image Sample text file used for input.

Output: Returns the lattice constants averaged over all the calculated values for each energy. Also displays histograms that depict the frequency of lattice constants used to calculate this average. This software is designed for samples with rectangular geometries, so the lattice constants that are generated will correspond with this structure. image Lattice constant histograms generated by the software.

Workflow Outline:

Initialization (these steps are only done for the first image)

  1. Take the first image (this step is optional if images have already been taken)
  2. Select energy file. This is a text file that associates the correct energy value with each image.
  3. Load this image into the main panel display
  4. Draw a circle estimate over the image 4a. drag a cursor to the user-estimated center. Doing this will automatically store the coordinates of the center. 4b. User estimates a value for the radius. User can adjust as necessary.
  5. User sets a value for the line cut (line cut is a pixel distance along the circle edge where the true circle edge location is located)

image At this stage, the user has completed steps 1-5 and displayed the circle estimate and line cut value.

  1. User generates a fitted circle that lies exactly at the edge of the circle 6a. Detect the true edge locations of the circle in pixel coordinates. This can be accomplished by iterating over all points in the circle estimate. For each point, use the line cut value to calculate a lower/upper bound for the edge location, and search for the edge within these bounds. Once found, fit these edge locations to a circle.
  2. Blur image and subtract background to improve spot visibility.
  3. Fit first 4 symmetric spots 8a. Select calibration. These are a set of coefficients that are necessary for the lattice constant calculations. 8b. Drag cursor to an hk spot location, in the form (±h,0) or (0,±k). 8c. Input the correct corresponding (hk) location on the panel. 8d. Click “G” (for guess) to store the pixel coordinates at the current cursor location. This displays the cursor location in the panel. 8e. Click “F” (for fit) to conduct a 2D Gaussian fit around the cursor location pixel coordinates, which will determine a more accurate location for the center of the spot location. This will update the coordinates that are associated with the (hk) location and display in the panel. 8f. Repeat steps 8b-8e for each symmetric spot. For example, if the user started off with the (0,-2) spot, then they would have to also guess and fit the (0,2), (2,0), and (-2,0) spots. 8g. After these 4 symmetric spots are fit, click “initialize” to set the variables on the display. An initial value of omega, lattice constants, and the specular position are calculated and displayed.

image At this stage, the user has generated the fitted circle that corresponds with the true edge location, processed the image, and fitted the first 4 symmetric spots.

  1. Guess locations for all other (hk) spots by clicking “show guesses.” 9a. This will use the initial value of omega, lattice constants, and specular position calculated from the first 4 spots to generate guesses for where the rest of the spots are located.
  2. Clicking “Fit all” will automatically fit all guesses (using the same 2D gaussian fitting function) for the other (hk) spots on the pattern, and recalculate the specular spot and omega.

image This is what the display looks like after the spots locations are guessed and fitted. The guesses are indicated by the red markers, and the fitted locations are indicated by the blue circles.

  1. Clicking “Calc” will recalculate the lattice constants, and average with the previously calculated values.
  2. At this point, the user can generate a histogram (although it won’t contain many data points) that displays the lattice constants.

The initialization is is now complete.

Clicking the “AutoFit” button will automatically do the following steps for all images: image

  1. Increment energy, and take the next image OR load the next image that corresponds with this energy
  2. Guess all spot locations using the most recently calculated values of omega, lattice constants, and specular position
  3. Fit spot locations with 2D gaussian
  4. Recalculate omega, lattice constants, and specular position with the fitted locations
  5. Update histograms with recalculated lattice constants

image This is a sample of what the histograms look like after a few images have been processed. The histograms are updated in real time as more images are processed.

jessicadong31 commented 4 years ago

Link to software files: https://github.com/jessicadong31/p-leed