/* * This script provides an instantaneous conversion from reciprocal space to real * space for selected area diffraction (SAD) pattern measurements. * * It assumes that your diffraction pattern was collected using Gatan's * Digital Micrograph software, and that your image is properly calibrated in * reciprocal space, i.e. scale bar units display as 1/nm in DM. * * It also assumes that you have used imageJ's circle tool to measure the spot/ring * patterns concentric to the (000) direct beam. From the area measurement, the radius * (G) is found. From G = 1/d in reciprocal space, the d-spacing is calculated for * each measurement made. * * Written by: Mak Koten, Ph.D. (2018) */ // Make sure the right measurements are set (for next time plugin is run). setMeasurements(); // Read the area from the results window into an area array. area=getArray("Area"); // Calculate G and d from Area measurements. G=calcG(area); d=calcD(area); e=dError(d); // Print the values of d as a list in a text window. [[Un-comment next line to enable]]. //printToText("d-Spacing List","d (A)", d); // Update the results table. updateResults(); /* ************************* * * * * FUNCTIONS * * * * ************************* */ // This ensures that Area and centroid will be measured the next time, if they weren't already... function setMeasurements() { run("Set Measurements...", "area centroid redirect=None decimal=3"); } // This will return an array created from a column in the Results window. function getArray(resultsHeader) { array = newArray(); for (i=0; i