fracture_analysis_2d package

Submodules

fracture_analysis_2d.config module

Configuration file.

fracture_analysis_2d.config.get_color_dict(unified: bool) → dict

Returns the default color dict, which was setup for the correct number of target areas and groups (sns.color_palette(‘dark’, n_colors)). Assertations will fail if setup hasn’t been done.

Parameters

unified (bool) – Whether the cycle for target areas or grouped data is wanted.

Returns

Default dictionary with either target area names or group names as keys and colors as values.

Return type

dict

Raises

AssertationError – Assertations will fail if setup of target area and group counts hasn’t been done.

fracture_analysis_2d.config.styling_plots(style)

Styles matplotlib plots by changing default matplotlib parameters (plt.rc).

Parameters

style (str) – String to determine how to stylize. Options: ‘traces’, ‘branches’, ‘gray’

fracture_analysis_2d.fracture_analysis_2d module

Main interface manipulator, handles all buttons and runs fracture_analysis_kit/main.py module to start analysis and plotting.

class fracture_analysis_2d.fracture_analysis_2d.FractureAnalysis2D(iface)

Bases: object

QGIS Plugin Implementation.

add_action(icon_path, text, callback, enabled_flag=True, add_to_menu=True, add_to_toolbar=True, status_tip=None, whats_this=None, parent=None)

Add a toolbar icon to the toolbar.

Parameters
  • icon_path (str) – Path to the icon for this action. Can be a resource path (e.g. ‘:/plugins/foo/bar.png’) or a normal file system path.

  • text (str) – Text that should be shown in menu items for this action.

  • callback (function) – Function to be called when the action is triggered.

  • enabled_flag (bool) – A flag indicating if the action should be enabled by default. Defaults to True.

  • add_to_menu (bool) – Flag indicating whether the action should also be added to the menu. Defaults to True.

  • add_to_toolbar (bool) – Flag indicating whether the action should also be added to the toolbar. Defaults to True.

  • status_tip (str) – Optional text to show in a popup when mouse pointer hovers over the action.

  • parent (QWidget) – Parent widget for the new action. Defaults None.

  • whats_this – Optional text to show in the status bar when the mouse pointer hovers over the action.

Returns

The action that was created. Note that the action is also added to self.actions list.

Return type

QAction

add_row_group_name_cutoff()

Adds row to Group name Cut Off table with given inputs.

add_row_layer()

Adds row to layer table and switches dummy layers to combo-boxes.

add_row_set()

Adds row to set table with given inputs.

clear_group_name_cut_off_table()

Clear Group name and Cut Off table along with the complementary DataFrame.

clear_layer_table()

Clears layer table and restores all layers to choices.

clear_set_table()

Clears set table.

fetch_correct_vector_layers()

Fetches current layers and checks which ones are suitable for which comboBox selection. E.g. Only VectorLayers are suitable, no raster layers in any comboBox selection and only VectorLayers with LineStrings or MultiLineStrings are suitable for traces and branches.

initGui()

Create the menu entries and toolbar icons inside the QGIS GUI.

open_config()

Show config filepath when Advanced is clicked.

open_help_doc()

Opens help documentation when ? is clicked.

populate_groups()

Populates group names to comboBox for target area layer grouping.

read_multi_target_json()

Not implemented.

Reads a json with specs for running multi target analysis. Needs:(self.layer_table_df, results_folder, analysis_name, self.group_names_cutoffs_df, self.set_df, self.choose_your_analyses)

self.layer_table_df:

in json will represented by a list list items: [t, b, n, a, name, group] all strs layers need to be identified from self.line_layers, etc. (line.name() == layer name)

results_folder:

str

analysis_name:

str

self.group_names_cutoffs_df:

list[str, float, float]

self.set_df:

list[str/int, str]

run()

Run method that performs the dialog event loop.

run_multi_target_analysis()

Starts analysis and doesn’t stop until plots have been all saved to folder. Will push a finish message when done.

select_output_folder(tab: int)

Used to select the output folder where a new folder for plots will be created.

Parameters

tab (int) – Which tab in the interface.

tr(message)

Get the translation for a string using Qt translation API.

We implement this ourselves since we do not inherit QObject.

Parameters

message (str, QString) – String for translation.

Returns

Translated version of message.

Return type

QString

unload()

Removes the plugin menu item and icon from QGIS GUI.

update_layers_tab2()

Updates layers to combo-boxes for tab2.

fracture_analysis_2d.fracture_analysis_2d.load_FORM_CLASS()

fracture_analysis_2d.fracture_analysis_2d_dialog module

fracture_analysis_2d.fracture_analysis_2d_dialog.get_FractureAnalysis2DDialog()

fracture_analysis_2d.install_script module

fracture_analysis_2d.install_script.check_installations()
fracture_analysis_2d.install_script.install()

Main installation method. Prints messages to stdout.

fracture_analysis_2d.install_script.is_gdal_needed()

Checks if gdal is installed and functional for external Python plugins.

TODO: Check except clause.

Returns

True or False

Return type

bool

fracture_analysis_2d.install_script.is_installation_needed()
fracture_analysis_2d.install_script.pip_install_all(is_64, gdal_needed)

Installs all requirements using pip.

Parameters
  • is_64 (bool) – Is platform 64 bit

  • gdal_needed (bool) – Is gdal needed for install

fracture_analysis_2d.install_script.verify_external_downloads(is_64, gdal_needed)

Verify if user has downloaded required unofficial Windows binaries from: https://www.lfd.uci.edu/~gohlke/pythonlibs/

Parameters
  • is_64 (bool) – Is platform 64 or 32 bit

  • gdal_needed (bool) – Is gdal up and running already.

Returns

True if binaries are found.

Return type

bool

Raises

FileNotFoundError – If binaries or install directory are not found relative to the script.

fracture_analysis_2d.resources module

fracture_analysis_2d.resources.qCleanupResources()
fracture_analysis_2d.resources.qInitResources()

Module contents

fracture_analysis_2d.classFactory(iface)

Load FractureAnalysis2D class from file FractureAnalysis2D.

Parameters

iface (QgsInterface) – A QGIS interface instance.