#!/usr/bin/env python # coding: utf-8 # In[3]: import numpy as np import matplotlib.pyplot as plt from defdap.quat import Quat import defdap.ebsd as ebsd from defdap.plotting import PolePlot get_ipython().run_line_magic('matplotlib', 'qt') # In[8]: EbsdFilePath = "/Users/mbcx9ma4/Dropbox (The University of Manchester)/Beta Reconstruction/data/triple_point/ZrNb_triplepoint_alpha" EbsdMap = ebsd.Map(EbsdFilePath, "hexagonal") EbsdMap.buildQuatArray() boundaryMisOri = 3. EbsdMap.findBoundaries(boundDef=boundaryMisOri) EbsdMap.findGrains(minGrainSize=2) # In[9]: get_ipython().run_line_magic('timeit', 'EbsdMap.findGrains(minGrainSize=2)') # In[5]: EbsdMap.plotEulerMap(plotGBs=False) # In[6]: plt.figure() plt.imshow(-EbsdMap.boundaries) # In[7]: plt.figure() plt.imshow(EbsdMap.misOriY > 8.) # In[4]: boundaryPoints = np.where(EbsdMap.misOriX > boundaryMisOri) boundarySegmentsX = [] for i, j in zip(*boundaryPoints): boundarySegmentsX.append( ((j+0.5, i-0.5), (j+0.5, i+0.5)) ) # In[5]: boundaryPoints = np.where(EbsdMap.misOriY > boundaryMisOri) boundarySegmentsY = [] for i, j in zip(*boundaryPoints): boundarySegmentsY.append( ((j-0.5, i+0.5), (j+0.5, i+0.5)) ) # In[11]: boundaryPoints = np.where(EbsdMap.boundaries == -1) boundarySegments = [] for i, j in zip(*boundaryPoints): boundarySegments.append( ((j-0.5, i+0.5), (j+0.5, i+0.5)) ) boundarySegments.append( ((j+0.5, i-0.5), (j+0.5, i+0.5)) ) # In[ ]: # In[7]: import pylab as pl from matplotlib import collections as mc # plt.figure() # plt.imshow(-EbsdMap.boundaries) # EbsdMap.plotEulerMap() EbsdMap.locateGrainID() ax = plt.gca() boundarySegments = boundarySegmentsX + boundarySegmentsY lc = mc.LineCollection(boundarySegments, colors=(0,0,0,1), linewidths=2) ax.add_collection(lc) ax.autoscale() # In[7]: EbsdMap.plotGrainMap(plotColourBar=True) # In[ ]: # In[12]: boundariesX = EbsdMap.misOrix > 3. plt.imshow(boundariesX) # In[15]: -boundariesX.astype(int) # In[ ]: # In[16]: edge = [(1, 2), (3, 4)] x, y = edge.pop(0) print(x) print(y) print(edge) # In[ ]: