4.2. core.py

Module for the ‘Project’ class that handles a project instance.

class core.Project(filename_full, debug_obj=None, species_dict=None)

The main API through which to build and access the data extracted from HAADF-STEM images.

Parameters
  • filename_full (str) – The full path and/or relative path and filename of the .dm3 image to import. A project can be instantiated with filename_full=’empty’, but this is only meant to be used as a placeholder. Use Project.import(filename, file_type) to instantiate projects from other files than dm3.

  • debug_obj (GUI.MainUI()) – (Optional, default=None) An reference to an AutomAl 6000 GUI.MainUI() instance.

  • species_dict (dict) – (Optional, default=None) A species dictionary for the project. If none is provided, core.Project.default_species_dict is used.

calc_area_gamma()

Calculate the area averaged pixel intensity

calc_avg_gamma()

Calculate average intensity for every vertex based on image information.

calc_avg_pixel_value()

Calculate the average pixel intensity of the image.

column_characterization(starting_index, search_type=0, ui_obj=None)

Column characterization algorithm.

Assumes a starting_index, that is taken to be an Al column in the matrix. The search_type enables access to the different sub-proccesses of the algorithm. These are:

search_type

Process

0

The full column characterization

1

The most important parts of the algorithm

2

Finalize the parameter state

3

Spatial mapping

4

Identify edge columns

5

Not in use

6

Zeta analysis

7

Active model predictions from alpha angles

8

Particle detection

9

Calculate normalized gamma attributes

10

Evaluate advanced species

11

Active model predictions from all attributes

12

Reset all probability vectors

13

Reset user-set columns

14

Look for intersections

15

Not in use

16

Build the vertex maps of the graph (including out-neighbourhoods)

17

Build the vertex maps of the graph (excluding out-neighbourhoods)

18

Run untangling (including strong)

19

Run untangling (excluding strong)

20

Experimental zeta analysis

21

Calculate area gamma

22

Not in use

23

Not in use

Columns that have been set by the user will not be have their species changed by the algorithm. Apply search_type=13 to reset columns if needed.

Parameters
  • starting_index (int) – Index of a vertex that is a part of the matrix.

  • search_type (int) – (optional, default=0) Which sub-process to access.

column_detection(search_type='s', plot=False)

Column detection algorithm.

The search type indicates the termination condition of the column detection (see table).

———————————– —————————————————— search_type explanation ———————————– —————————————————— s Search until self.search_size columns are found. t Search until self.search_mat.max() < self.threshold. ———————————– ——————————————————

This algorithm will check the column state and continue appropriately if there are already columns present. It will also “roll back” columns if the threshold value is higher than the peak gamma of the already existing columns. This means that if the initial threshold is guessed too low, then it will remove columns.

Parameters
  • search_type (str) – (Optional, default=’s’) The algorithm termination condition.

  • plot (bool) – (Optional, default=False) Plotting on/off.

find_edge_columns()

Locate vertices that are close to the edge of the image.

These vertices get special treatment throughout the program because information about their surroundings will be incomplete. This method will find all vertices that are within a distance 6 * self.r from the edge, and set the field self.graph.vertices[i].is_edge_column = True.

get_alloy_string()

Generate a string representation of the alloy based on the alloys present in the species dictionary.

:returns A species string on the form Al-Mg-Si. :rtype str:

get_im_length_from_spatial(spatial_length)

Returns the a spatial length in image pixel length.

Parameters

spatial_length (float) – A spatial length in pm

Returns An image length in px

Rtype float

get_spatial_length_from_im(im_length)

Returns the an image length in spatial length.

Parameters

spatial_length (float) – An image length in px

Returns A spatial length in pm

Rtype float

static load(filename_full)

Load an instance from a pickle-file.

Parameters

filename_full (str) – Path-name of the file to be loaded.

Returns

project instance.

Return type

core.Project

make_heat_map(attribute, kernel_size=1, kernel_step_size=1, measure_type='variance', kernel_type='square', title='heat map')
Parameters
  • attribute (str) –

  • kernel_size

  • kernel_step_size

  • kernel_shape

Returns A heat map of the image

Rtype numpy.array

normalize_gamma()

Find the mean of the intensity of the Al-matrix, and scale all intensities.

Scale all intensities such that the mean of the Al-matrix is a fixed point. Store the result in each vertex i self.graph.vertices[i].normalized_peak_gamma and self.graph.vertices[i].normalized_avg_gamma fields.

redraw_search_mat()

Redraw the search matrix.

report(supress_log=True)

Build a string representation of the current instance.

Returns A project summary

Rtype str

reset_graph()

Reset the graph (delete all vertices)

save(filename_full)

Save the current project as a pickle file.

Parameters

filename_full (str) – Path and name of save-file. The project will be pickled as filename_full without any file-extension identifier.

vertex_report(i, supress_log=False)

Build a string representation of vertex i.

Returns A vertex summary

Rtype str