pygmi.bholes package

Submodules

pygmi.bholes.coremask module

Core Mask Routines.

class pygmi.bholes.coremask.CoreMask(parent=None)

Bases: PyQt5.QtWidgets.QDialog

Core masking class.

change_defs()

Change definitions.

Returns

Return type

None.

classify()

Test classification.

Returns

Return type

None.

pic_overview()

Change the current viewed data, cased on the combo_overview value.

Returns

Return type

None.

pic_overview2()

Horizontal slider to change picture opacity.

Returns

Return type

None.

savemask()

Save mask to a file.

Returns

Return type

None.

settings(nodialog=False)

Entry point into item.

Returns

True if successful, False otherwise.

Return type

bool

setupui()

Set up UI.

Returns

Return type

None.

setwidth(width)

Set the width of the edits on the profile view.

Parameters

width (int) – Edit width.

Returns

Return type

None.

slayer()

Change model layer.

Returns

Return type

None.

class pygmi.bholes.coremask.MyMplCanvas(parent=None)

Bases: matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg

Matplotlib Canvas.

button_press(event)

Button press event.

Parameters

event (TYPE) – DESCRIPTION.

Returns

Return type

None.

button_release(event)

Button release event.

Parameters

event (TYPE) – DESCRIPTION.

Returns

Return type

None.

init_grid_top(dat2=None, opac=100.0)

Initialise top grid.

Parameters
  • dat2 (str, optional) – Combobox text. The default is None.

  • opac (float, optional) – Opacity between 0 and 100. The default is 100.0.

Returns

Return type

None.

luttodat(dat)

LUT to dat grid.

Parameters

dat (numpy array) – Input array.

Returns

tmp – Output array.

Return type

numpy array

move(event)

Mouse move event.

Parameters

event (TYPE) – DESCRIPTION.

Returns

Return type

None.

on_resize(event)

Resize event.

Used to make sure tight_layout happens on startup.

Parameters

event (TYPE) – DESCRIPTION.

Returns

Return type

None.

set_mdata(xdata, ydata, mdata)

Routine to ‘draw’ the line on mdata.

xdata and ydata are the cursor centre coordinates.

Parameters
  • xdata (float) – X data.

  • ydata (float) – Y data.

  • mdata (numpy array) – Model array.

Returns

Return type

None.

slide_grid_top(opac=None)

Slide top grid.

Parameters

opac (float, optional) – Opacity between 0 and 100. The default is None.

Returns

Return type

None.

class pygmi.bholes.coremask.MySlider(parent=None)

Bases: PyQt5.QtWidgets.QSlider

My Slider.

Custom class which allows clicking on a horizontal slider bar with slider moving to click in a single step.

mouseMoveEvent(event)

Mouse move event.

Jump to pointer position while moving.

Parameters

event (TYPE) – DESCRIPTION.

Returns

Return type

None.

mousePressEvent(event)

Mouse press event.

Parameters

event (TYPE) – DESCRIPTION.

Returns

Return type

None.

pygmi.bholes.coremask.update_lith_lw(lith_list, mlut, lwidget)

Update the lithology list widget.

Parameters
  • lith_list (list) – Lithology list.

  • mlut (list) – Lithology color.

  • lwidget (QListWidget) – List widget.

Returns

Return type

None.

pygmi.bholes.coremeta module

Core metadata and depth Assignment routine.

class pygmi.bholes.coremeta.CoreMeta(parent=None)

Bases: PyQt5.QtWidgets.QDialog

Core metadata and depth assignment routine.

parent

reference to the parent routine

Type

parent

indata

dictionary of input datasets

Type

dictionary

outdata

dictionary of output datasets

Type

dictionary

button_press_callback(event)

Button press callback.

Parameters

event (TYPE) – DESCRIPTION.

Returns

Return type

None.

dmark_change()

Change depth marker combo.

Returns

Return type

None.

dmark_del()

Delete depth marker.

Returns

Return type

None.

dmarkval_change()

Change depth marker value in spinbox.

Returns

Return type

None.

format_coord(x, y)

Format coordinate.

Parameters
  • x (float) – x-coordinate.

  • y (float) – y-coordinate.

Returns

Formatted string.

Return type

str

loadproj(projdata)

Load project data into class.

Parameters

projdata (dictionary) – Project data loaded from JSON project file.

Returns

chk – A check to see if settings was successfully run.

Return type

bool

ncore_change()

Routine is called when number of cores has changed.

Returns

Return type

None.

on_combo()

On combo.

Returns

Return type

None.

savedmark()

Save depth marks to a json file, with same name as the raster image.

Returns

Return type

None.

saveproj()

Save project data from class.

Returns

projdata – Project data to be saved to JSON project file.

Return type

dictionary

settings(nodialog=False)

Entrypoint into class.

Returns

True if successful, False otherwise.

Return type

bool

setupui()

Set up UI.

Returns

Return type

None.

traylen_change()

Routine is called whenever the tray length parameter is changed.

Returns

Return type

None.

update_depthfunc()

Update the depth function.

Returns

Return type

None.

class pygmi.bholes.coremeta.GraphMap(parent=None)

Bases: matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg

Graph Map.

parent

reference to the parent routine

Type

parent

init_graph()

Initialise the graph.

Returns

Return type

None.

pygmi.bholes.graphs module

Plot Borehole Data.

This module provides a variety of methods to plot borehole data via the context menu.

class pygmi.bholes.graphs.GraphWindow(parent=None)

Bases: PyQt5.QtWidgets.QDialog

Graph Window.

parent

reference to the parent routine

Type

parent

change_band()

Combo box to change band.

Returns

Return type

None.

class pygmi.bholes.graphs.MyMplCanvas(parent=None)

Bases: matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg

Canvas for the actual plot.

parent

reference to the parent routine

Type

parent

update_legend(data1)

Update legend.

Parameters

data1 (dictionary) – Dictionary containing data.

Returns

Return type

None.

update_log(data1)

Update the raster plot.

Parameters

data1 (dictionary.) – PyGMI log dataset to be used.

Returns

Return type

None.

class pygmi.bholes.graphs.PlotLog(parent=None)

Bases: pygmi.bholes.graphs.GraphWindow

Plot Log Class.

parent

reference to the parent routine

Type

parent

change_band()

Combo box to choose band.

run()

Run.

Returns

Return type

None.

pygmi.bholes.graphs.chkname(iname)

Check filename for illegal characters.

Parameters

iname (str) – Input filename.

Returns

iname – Corrected filename.

Return type

str

pygmi.bholes.graphs.commentprep(mystring, slen=50)

Create the correct case for a string and inserts carriage returns.

Parameters
  • mystring (str) – String to correct.

  • slen (int, optional) – String length. The default is 50.

Returns

finstring – Output string.

Return type

str

pygmi.bholes.graphs.gethatch(svgfile)

Get Hatching from SVG file.

Parameters

svgfile (str) – SVG filename.

Returns

Return type

None.

pygmi.bholes.hypercore module

Hyperspectral Core Routines.

class pygmi.bholes.hypercore.CorePrep(parent=None)

Bases: PyQt5.QtWidgets.QDialog

Tray clipping and band selection.

parent

reference to the parent routine

Type

parent

indata

dictionary of input datasets

Type

dictionary

outdata

dictionary of output datasets

Type

dictionary

acceptall()

Accept option.

Updates self.outdata, which is used as input to other modules.

Returns

Return type

None.

default_fenix()

Choose default settings for FENIX.

Returns

Return type

None.

default_owl()

Choose default settings for OWL.

Returns

Return type

None.

loadproj(projdata)

Load project data into class.

Parameters

projdata (dictionary) – Project data loaded from JSON project file.

Returns

chk – A check to see if settings was successfully run.

Return type

bool

on_combo()

On combo.

Returns

Return type

None.

saveproj()

Save project data from class.

Returns

projdata – Project data to be saved to JSON project file.

Return type

dictionary

settings(nodialog=False)

Entrypoint into class.

Returns

True if successful, False otherwise.

Return type

bool

setupui()

Set up UI.

Returns

Return type

None.

class pygmi.bholes.hypercore.GraphMap(parent=None)

Bases: matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg

Graph Map.

parent

reference to the parent routine

Type

parent

init_graph()

Initialise the graph.

Returns

Return type

None.

update_graph()

Update graph.

Returns

Return type

None.

class pygmi.bholes.hypercore.ImageCor(parent=None)

Bases: PyQt5.QtWidgets.QDialog

Raw Imagery Corrections.

parent

reference to the parent routine

Type

parent

indata

dictionary of input datasets

Type

dictionary

outdata

dictionary of output datasets

Type

dictionary

acceptall()

Accept option.

Updates self.outdata, which is used as input to other modules.

Returns

Return type

None.

get_idir(dirname='')

Get input directory.

Parameters

filename (str, optional) – Directory name submitted for testing. The default is ‘’.

Returns

Return type

None.

get_odir(dirname='')

Get output directory.

Parameters

filename (str, optional) – Directory name submitted for testing. The default is ‘’.

Returns

Return type

None.

loadproj(projdata)

Load project data into class.

Parameters

projdata (dictionary) – Project data loaded from JSON project file.

Returns

chk – A check to see if settings was successfully run.

Return type

bool

saveproj()

Save project data from class.

Returns

projdata – Project data to be saved to JSON project file.

Return type

dictionary

settings(nodialog=False)

Entry point into item.

Returns

True if successful, False otherwise.

Return type

bool

setupui()

Set up UI.

Returns

Return type

None.

class pygmi.bholes.hypercore.PolygonInteractor(axtmp)

Bases: PyQt5.QtCore.QObject

Polygon Interactor.

button_press_callback(event)

Button press callback.

Parameters

event (TYPE) – DESCRIPTION.

Returns

Return type

None.

button_release_callback(event)

Button release callback.

Parameters

event (TYPE) – DESCRIPTION.

Returns

Return type

None.

draw_callback(event=None)

Draw callback.

Parameters

event (TYPE, optional) – DESCRIPTION. The default is None.

Returns

Return type

None.

epsilon = 5
motion_notify_callback(event)

Motion notify on mouse movement.

Parameters

event (TYPE) – DESCRIPTION.

Returns

Return type

None.

new_poly(npoly)

Routine for new polygon.

Parameters

npoly (list or None, optional) – New polygon coordinates.

Returns

Return type

None.

polyi_changed
set_line(xdata, ydata)

Routine to set line.

Parameters
  • xdata (float) – x coordinate.

  • ydata (float) – y coordinate data.

Returns

Return type

None.

showverts = True
update_plots()

Update plots.

Returns

Return type

None.

pygmi.bholes.hypercore.data_to_dict(dat)

Convert Data list to dictionary.

Parameters

dat (list of Data) – Input PyGMI dataset.

Returns

Output dictionary of data.

Return type

dictionary

pygmi.bholes.hypercore.dc_correct(idir, hfile, datah, piter=<built-in function iter>, showprocesslog=<built-in function print>)

DC Correct.

Parameters
  • idir (str) – Input directory.

  • hfile (str) – core filename.

  • datah (list of Data) – Input core data to be corrected.

  • piter (iter, optional) – Progress bar iterator. The default is iter.

  • showprocesslog (print, optional) – Default routine to show messages. The default is print.

Returns

Output Data.

Return type

list of Data

pygmi.bholes.hypercore.dict_to_data(arr, data)

Convert dictionary of Data to Data list.

Parameters
  • arr (dictionary) – Dictionary of raster datasets.

  • data (list of Data) – PyGMI Data to use as a template.

Returns

Output list of Data.

Return type

list of Data

pygmi.bholes.hypercore.dist_point_to_segment(p, s0, s1)

Dist point to segment.

Reimplementation of Matplotlib’s dist_point_to_segment, after it was depreciated. Follows http://geomalgorithms.com/a02-_lines.html

Parameters
  • p (numpy array) – Point.

  • s0 (numpy array) – Start of segment.

  • s1 (numpy array) – End of segment.

Returns

Distance of point to segment.

Return type

numpy array

pygmi.bholes.hypercore.filter_data(datah, ftype, piter=<built-in function iter>)

Filter data.

Parameters
  • datah (list of PyGMI Data) – Input data.

  • ftype (str) – Filter type. Can be hampel or savgol.

Returns

Output data.

Return type

list of PyGMI Data

pygmi.bholes.hypercore.hampel_filter(input_series, window_size, n_sigmas=3)

Hampel filter.

From https://towardsdatascience.com/outlier-detection-with-hampel-filter-85ddf523c73d

Parameters
  • input_series (numpy array) – Input series.

  • window_size (int) – Filter window size.

  • n_sigmas (int, optional) – Number of sigmas. The default is 3.

Returns

  • new_series (numpy array) – Output filtered series.

  • indices (numpy array) – Indices of values filtered.

pygmi.bholes.hypercore.smile(dat, piter=<built-in function iter>)

Geometric smile correction.

Parameters
  • dat (list of Data) – Input data to be corrected.

  • piter (iter, optional) – Progress bar iterator. The default is iter.

Returns

Output Data.

Return type

list of Data

pygmi.bholes.iodefs module

Import Borehole Data.

class pygmi.bholes.iodefs.ImportData(parent=None)

Bases: object

Import Data.

name

item name

Type

str

pbar

reference to a progress bar.

Type

progressbar

parent

reference to the parent routine

Type

parent

outdata

dictionary of output datasets

Type

dictionary

ifile

input file name. Used in main.py

Type

str

ext

filename extension

Type

str

loadproj(projdata)

Load project data into class.

Parameters

projdata (dictionary) – Project data loaded from JSON project file.

Returns

chk – A check to see if settings was successfully run.

Return type

bool

saveproj()

Save project data from class.

Returns

projdata – Project data to be saved to JSON project file.

Return type

dictionary

settings(nodialog=False)

Entry point into item.

Returns

True if successful, False otherwise.

Return type

bool

pygmi.bholes.iodefs.get_CGS(lithfile, headerfile)

Borehole Import.

Parameters
  • lithfile (str) – filename to import

  • headerfile (str) – filename to import

Returns

dat – dictionary of Pandas dataframes

Return type

dictionary

pygmi.bholes.menu module

Borehole Menu Routines.

class pygmi.bholes.menu.MenuWidget(parent=None)

Bases: object

Widget class to call the main interface.

This widget class creates the menus to be found on the main interface. Normal as well as context menus are defined here.

parent

Reference to MainWidget class found in main.py

Type

pygmi.main.MainWidget

coremask()

Core Masking.

coremeta()

Core Metadata and depth assignment.

coreprep()

Tray Clipping and Band Selection.

imagecor()

Raw core imagery corrections.

import_data()

Import data.

show_log()

Show log data.

Module contents

Borehole routines.