Comments (9)
from defdap.
The current function has not been written a particularly generic way (for execution speed it calculates along entire rows and columns at a time) but it could be adapted easily to calculate KAM on any size square kernel. Currently it just takes the 4 nearest neighbours, so no diagonal points.
You could write a separate function that takes in a 2d array of the kernel shape (which could also include weights) and calculates KAM based on this at each point. This would have to be done at each point individually however so might be quite slow for large maps.
from defdap.
from defdap.
I have uploaded a new notebook to my repository called calculateKamNxN.ipynb. There is a function in there to calculate KAM, ignoring large local misorientations and with a flexible NxN sized kernel.
I haven't included weights (other than a weight of zero for large misorientations) and I haven't looked at Kamaya's local gradient, but I will look into including both of these.
The function works by finding the local misorientations, ignoring the large misorientations and then finding the average orientation of the small misorientations. Then the misorioentation between the pixel and the local average is obtained and stored in a KAM map array.
@mikesmic would you check that I've done the misorientation calculation properly (i.e. the Einstein summations)? I've not worked with quaternions in this way before. Maybe we could have a chat about quaternion maths at some point?
Example images of a 3x3 and a 9x9 kernel with overlaid GBs attached here...
from defdap.
I've had a look at the notebook and I'm at little confused. I can understand what you're trying to do with the first function (KAM not ignoring large values) but you can't convolve the quaternion components like you have. Addition of 2 quaternion gives the average of the 2 orientations.
I'm lost with your second function though, you seem to have done this in a different way and the maps it has produced seem reasonable. Are you in to have to talk about this today? I can run you through some quaternion maths as well, I have a crib sheet with the important stuff on.
from defdap.
Thanks for taking a look, I'll come to see you this afternoon about quat maths.
In the first part of the notebook I wanted to average the quat coefficients within a kernel. I did this by separating the quat data into four maps of the separate quat coefficients and then convolving that quat data with a kernel that determines the local mean for each quat coefficient. Note that I find the local mean for the individual quat coefficients and not the full orientation. I then recombine the coefficient data to get local mean orientation map for a given kernel size. The kamMap is then generated by finding the misorientation between the original data and the local mean kernel data. It's all in arrays so it's vectorised and this makes the calculation pretty quick.
In the second part of the notebook I had to do things differently to exclude large misorientations - I couldn't vectorise it. I can see how it might be a little confusing and will chat to you this afternoon about how to make it clearer. I will then update the notebook and highlight any significant changes in this thread.
Allan
from defdap.
After speaking with @mikesmic yesterday I realised that I was calculating the KAM in a strange way - finding local average orientations in a kernel and then the misorientation of a pixel with respect to that average. I have now changed the function so that it calculates the misorientation of a pixel with respect to its neighbours in a kernel and then it simply takes the average of those misorientations. Large misorientations are given a value of NaN, as is the central pixel's misorientation with respect to itself. The mean misorientation is therefore calculated with np.nanmean(). The result is the very similar to before but it's quicker.
When we find the KAM in this way we can easily get influences from neighbouring grains for large sized kernels. To eliminate this effect, I will try this on grain objects as opposed to the full maps
from defdap.
from defdap.
Ah yes, good point - as long as the maximum misOrientation value for the KAM is less than the boundary definition when loading the ebsd data then this won't be a problem, i.e. for data with maps[i].findBoundaries(boundDef = 10) then the maximum misorientation value for the KAM has to be < 10
from defdap.
Related Issues (20)
- Rotated slip traces HOT 2
- API proposal/discussion: make hrdic.Map.__getitem__ work like a dictionary instead of a list HOT 1
- An error when setting tk or qt agg when setting the window titles.
- plotting the Schmid factor map for a dual phase EBSD data using `EbsdMap.plotAverageGrainSchmidFactorsMap()`
- DefDap logo invisible with dark theme
- IPF triangle labels HOT 1
- Filtering of data HOT 3
- Add type hinting
- Green lagrange strain definition HOT 2
- Error when using grain inspector for cubic materials HOT 2
- Errors when using the advanced_notebook HOT 1
- Clean up EBSD data? HOT 2
- Questions about EBSD analyses in Defdap HOT 10
- HRDIC data loader not working for davis 10 files HOT 1
- How to set two slip systems for each phase HOT 2
- Loading EDAX EBSD data HOT 11
- AZtecCrystal data export and Grain boundary fitting issues HOT 5
- Error in plotRDR HOT 2
- Can't type in Grain Inspector HOT 2
- Recent error with RDR HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from defdap.