Allen J. Hall

Materials Science & Engineering, Productivity, and Life

Part III: Matlab Function for Xpert XRD Reciprocal Space Mapping

A series of MATLAB functions will follow. Some of these “.m” files call each other, so ensure you have all of them before you start.

The purpose of this file is to load in all the .x00 files in a directory of Omega-Omega-2-Theta slices for reciprocal space mapping of a sample. “OmegAxis” determines the scale for the Omega axis (y) for reciprocal space mapping. [again, this is not yet in Q-space, that will come at a later date]

The first function loads data into your workspace for a directory of .x00 files that have a common base filename. The user needs to supply the first index number and last index number for loading the files. The program then attempts to load “filenameIndex.x00″ in a linear fashion for all .x00 files of that filename indexed in the cd’d directory. [Change directory to the working directory needed before starting this function.]


You can download this file as a text file here: OmegAxis.m, revision 8

function [Omeg, OmegaStep] = OmegAxis(filename,startnum,stopnum)

% Program will read representative files in a directory of scans to determine
% the appropriate vector for the Omega axis

% Let's read the first file's Omega  [FirstOmega]
fid = fopen(sprintf('%s%i.x00',filename,startnum),'r');     

for i = 1:40
 C = textscan(fid,'%s',1,'delimiter',',');
 if strcmp(C{1}, 'Omega')
    testme = 0;
    break
 end
end

C = textscan(fid,'%f',1,'delimiter',',');
FirstOmega = C{1};
fclose(fid);

% Let's read the second file's Omega to get the stepsize [SecondOmega]
fid = fopen(sprintf('%s%i.x00',filename,(startnum+1)),'r');     

for i = 1:40
 C = textscan(fid,'%s',1,'delimiter',',');
 if strcmp(C{1}, 'Omega')
    testme = 0;
    break
 end
end

C = textscan(fid,'%f',1,'delimiter',',');
SecondOmega = C{1};
fclose(fid);

% So the stepsize will be [OmegaStep]
OmegaStep = SecondOmega - FirstOmega;

% Finally, let's read the last file and determine the breadth of the scan [LastOmega]
fid = fopen(sprintf('%s%i.x00',filename,stopnum),'r');     

for i = 1:40
 C = textscan(fid,'%s',1,'delimiter',',');
 if strcmp(C{1}, 'Omega')
    testme = 0;
    break
 end
end

C = textscan(fid,'%f',1,'delimiter',',');
LastOmega = C{1};
fclose(fid);

% record the vector to send back
Omeg = [FirstOmega;LastOmega];
return

Post a Comment

Your email is never shared. Required fields are marked *

*
*

A Quick Introduction...

I'm a graduate student (PhD Candidate) at the University of Illinois at Urbana-Champaign.

I've studied and researched in two fields of Materials Science and Engineering (Polymers and Semiconductors). My interests are as diverse as my musical tastes and I usually have my hand in some crazy project during my free time.

I'm available for consulting and have access to a world-renown materials research user-facility supported by the D.O.E. If you would like to know more, please contact me.

Popular Tags

Amazon Associate Link Apple Support AppStore Bug CIGS CIS CLI Conferences Cross Platform Data Mining data visualization dual-driver headphones failure Friend Geek Tool Great Scientists HAM Radio Hardware Tips How To Humanitarian IEM IM In-Ear Monitors iPod Touch LaTeX Linux Mac OsX Materials Science and Engineering Matlab Obituary Open Source problem Productivity reciprocal space return Silent Key Software Software Review Support This Blog Thesis Writing Tip UIUC VOIP Windows xrd

Support This Blog

You can support this blog by shopping on Amazon through my Affiliate Store.