defdap.inspector module

class defdap.inspector.GrainInspector(selected_dic_map, vmax, correction_angle=0, rdr_line_length=3)[source]

Bases: object

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

goto_grain(event, plot)[source]

Go to a specified grain ID.

Parameters:

event (int) – Grain ID to go to.

save_line(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.

group_lines(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.

groups_list 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.

clear_all_lines(event, plot)[source]

Clear all lines in a given grain.

remove_line(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.

redraw_line()[source]

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

run_rdr_group(event, plot)[source]

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

Parameters:

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

batch_run_sta(event, plot)[source]

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

calc_rdr(grain, group, show_plot=True)[source]

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

Parameters:
  • grain – DIC grain to run RDR on.

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

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

plot_rdr(grain, group, u_list, v_list, x_list, y_list, lin_reg_result)[source]

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

Parameters:
  • grain – DIC grain to plot.

  • group (int) – Group ID to plot.

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

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

  • x_list (List[List[int]]) – List of all x values.

  • y_list (List[List[int]]) – List of all y values.

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

update_filename(event, plot)[source]

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

event:

Text in textbox.

save_file(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)]]

load_file(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)]]