Skip to content

Instantly share code, notes, and snippets.

@kilir
kilir / gKAM.m
Last active June 22, 2019 19:09
calculate the grain averaged KAM (gKAM) for each grain #mtexScript
function [gkam, gid, kam] = gKAM(ebsd,varargin)
% calculate grain average misorientation angle from KAM
% input:
% ebsd (with grainID)
%
% options:
% threshold: angles to ignore (upper limit) in radian
% lowlim: angles to ignore: (lower limit) in radian
% order: 1st,2nd etc. neighbourhood around each point
%
@kilir
kilir / broad_profile.m
Last active March 3, 2020 03:45
make a EBSD spatialProfile that averages over n pixels from both sides of the profile #mtexScript #EBSD
%% select profile
lineX = ginput(2) % select a line
[ebsd_lineX, dist ]= spatialProfile(ebsd,lineX); %extract orientations
%% average orientations perpendicular to profile and plot things along line
clear meanO
% average along line (put 0 if you want no averaging)
%//////////////////////////////////////////////////////
av_width = 8 %number of pixels to average perp to line (towards both sides
% use 0 to use only ebsd_lineX
@kilir
kilir / saveFigureMP.m
Last active May 25, 2018 15:46
modfied saveFigure in such a way that ebsd map plots won't be antialiased - no new colors to be created #mtexScript
function saveFigure(fname,varargin)
% save figure as graphics file
%
% Description
% This function is supposed to produce cropped, publication ready image
% files from your plots. The format of the file is determined by the
% extension of the filename.
%
% Syntax
% saveFigure(fname)