defdap.inspector module

class defdap.inspector.GrainInspector(currMap, vmax, corrAngle)[source]

Bases: object

Class containing the interactive grain inspector tool for slip trace analysis and relative displacement ratio analysis.

draw()[source]

Draw the main window, buttons, text boxes and axes.

gotoGrain(event, plot)[source]

Go to a specified grain ID.

Parameters:

event (int) – Grain ID to go to.

saveLine(event, plot)[source]

Save the start point, end point and angle of drawn line into the grain.

Parameters:

event (ndarray) – Start x, start y, end x, end y point of line passed from drawn line.

groupLines(grain=None)[source]

Group the lines drawn in the current grain item using a mean shift algorithm, save the average angle and then detect the active slip planes.

groupsList is a list of line groups: [id, angle, [slip plane id], [angular deviation]

Parameters:

grain (defdap.hrdic.Grain) – Grain for which to group the slip lines.

clearAllLines(event, plot)[source]

Clear all lines in a given grain.

removeLine(event, plot)[source]

Remove single line [runs after submitting a text box].

Parameters:

event (int) – Line ID to remove.

redraw()[source]

Draw items which need to be redrawn when changing grain ID.

redrawLine()[source]

Draw items which need to be redrawn when adding a line.

runRDRGroup(event, plot)[source]

Run RDR on a specified group, upon submitting a text box.

Parameters:

event (int) – Group ID specified from text box.

batchRunSTA(event, plot)[source]

Run slip trace analysis on all grains which hve slip trace lines drawn.

calcRDR(grain, group, showPlot=True, length=2.5)[source]

Calculates the relative displacement ratio for a given grain and group.

Parameters:
  • grain (int) – DIC grain ID to run RDR on.

  • group (int) – group ID to run RDR on.

  • showPlot (bool) – if True, show plot window.

  • length (float) – length of perpendicular lines used for RDR.

plotRDR(grain, group, ulist, vlist, allxlist, allylist, linRegResults)[source]

Plot RDR figure, including location of perpendicular lines and scatter plot of ucentered vs vcentered.

Parameters:
  • grain (int) – DIC grain to plot.

  • group (int) – Group ID to plot.

  • ulist (List[float]) – List of ucentered values.

  • vlist (List[float]) – List of vcentered values.

  • allxlist (List[float]) – List of all x values.

  • allylist (List[float]) – List of all y values.

  • linRegResults (LinregressResult) – Results from linear regression of ucentered vs vcentered {slope, intercept, rvalue, pvalue, stderr}.

updateFilename(event, plot)[source]

Update class variable filename, based on text input from textbox handler.

event:

Text in textbox.

saveFile(event, plot)[source]

Save a file which contains definitions of slip lines drawn in grains [(x0, y0, x1, y1), angle, groupID] and groups of lines, defined by an average angle and identified sip plane [groupID, angle, [slip plane id(s)], [angular deviation(s)]]

loadFile(event, plot)[source]

Load a file which contains definitions of slip lines drawn in grains [(x0, y0, x1, y1), angle, groupID] and groups of lines, defined by an average angle and identified sip plane [groupID, angle, [slip plane id(s)], [angular deviation(s)]]