straditize.widgets.plots module

Plot control widgets for straditize

Copyright (C) 2018-2019 Philipp S. Sommer

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Classes

PlotControl(straditizer_widgets, item, …)

A widget for controlling the plot

PlotControlTable(straditizer_widgets, *args, …)

A widget to control the plots

ResultsPlot(straditizer_widgets)

A widget for plotting the final results

class straditize.widgets.plots.PlotControl(straditizer_widgets, item, *args, **kwargs)[source]

Bases: straditize.widgets.StraditizerControlBase, PyQt5.QtWidgets.QWidget

A widget for controlling the plot

This widgets holds a PlotControlTable to display visual diagnostics in the plot. Additionally it contains zoom buttons (btn_view_global and btn_view_data) and a widget to plot the results (results_plot)

Attributes

btn_view_data

A button to zoom to the data

btn_view_global

A button to zoom out to the entire stratigraphic diagram

results_plot

A ResultsPlot to plot the digitized data in a new diagram

table

A PlotControlTable to display visual diagnostics

Methods

refresh()

Refresh from the straditizer

setup_children(item)

Setup the children for this control

zoom_data()

Zoom to the data part

zoom_global()

Zoom out to the full straditgraphic diagram

btn_view_data = None

A button to zoom to the data (see zoom_data())

btn_view_global = None

A button to zoom out to the entire stratigraphic diagram (see zoom_global())

refresh()[source]

Refresh from the straditizer

results_plot = None

A ResultsPlot to plot the digitized data in a new diagram

setup_children(item)[source]

Setup the children for this control

This method is called to setup the children in the StraditizerWidgets.tree. By default, it just creates a child QTreeWidgetItem and sets this control as it’s widget

Parameters

item (QTreeWidgetItem) – The top level item in the StraditizerWidgets.tree

table = None

A PlotControlTable to display visual diagnostics

zoom_data()[source]

Zoom to the data part

zoom_global()[source]

Zoom out to the full straditgraphic diagram

class straditize.widgets.plots.PlotControlTable(straditizer_widgets, *args, **kwargs)[source]

Bases: straditize.widgets.StraditizerControlBase, PyQt5.QtWidgets.QTableWidget

A widget to control the plots

This control widget is a table to plot, remove and toggle the visiblity of visual diagnostics for the straditizer. It has two columns: the first to toggle the visibility of the plot, the second to plot and remove the matplotlib artists. The vertical header are the items in the corresponding plot_funcs, can_be_plotted_funcs and/or hide_funcs.

Rows are added to this table using the add_item() method which stores the plotting functions in the plot_funcs and the functions to hide the plot in the hide_funcs. Whether an item can be plotted or not depends on the results of the corresponding callable in the can_be_plotted_funcs.

Methods

add_item(what, get_artists[, plot_func, …])

Add a plot object to the table

adjust_height()

can_plot_column_starts()

Test whether the column starts can be visualized

can_plot_data_box()

Test whether the box around the diagram part can be plotted

can_plot_data_reader_color_image()

Test if the reader color image can be plotted

can_plot_full_df()

Test whether the full_df can be plotted

can_plot_potential_samples()

Test whether potential sample regions can be plotted

can_plot_sample_hlines()

Test whether the sample lines can be plotted

can_plot_samples()

Test whether the samples can be plotted

draw_figs(artists)

Draw the figures of the given artists

enable_or_disable_widgets(b)

b is ignored and is always set to True

get_column_start_lines()

Get the artists of the column starts

get_data_box()

Get the plotted straditize.straditizer.Straditizer.data_box

get_data_reader_background()

Get the straditize.binary.DataReader.background

get_data_reader_color_image()

Get the straditize.binary.DataReader.color_plot_im

get_data_reader_image()

Get the straditize.binary.DataReader.plot_im

get_full_df_lines()

Get the artists of the full_df plot

get_potential_samples_lines()

Get the artists of the plot of potential samples

get_sample_hlines()

Get the plotted the sample lines

get_samples_lines()

Get the artists of the plotted samples

get_straditizer_image()

Get the straditize.straditizer.Straditizer.plot_im

plot_column_starts()

Plot horizontal lines for the column starts

plot_data_box()

Plot the data box around the diagram part

plot_data_reader_color_image()

Plot the data reader color image

plot_full_df()

Plot the full_df of the reader

plot_potential_samples()

Highlight the regions with potential samples in the plot

plot_sample_hlines()

Plot the horizontal sample lines of the reader

plot_samples()

Plot the samples of the reader

refresh()

Refresh from the straditizer

remove_column_starts()

Remove the plotted lines of the column starts

remove_data_box()

Remove the box around the diagram part

remove_data_reader_color_image()

Remove the straditize.binary.DataReader.color_plot_im

remove_full_df_plot()

Remove the plot of the full_df

remove_potential_samples_plot()

Remove the plot of potential samples

remove_sample_hlines_plot()

Remove the sample lines

remove_samples_plot()

Remove the plotted samples

should_be_enabled(w)

Check if a widget should be enabled

sizeHint(self)

Attributes

can_be_plotted_funcs

A mapping from plot identifier to a callable that returns True if

col_lines

Built-in mutable sequence.

hide_funcs

A mapping from plot identifier to a callable to hide the corresponding

plot_funcs

A mapping from plot identifier to a callable to plot the corresponding

widgets2disable

Built-in mutable sequence.

add_item(what, get_artists, plot_func=None, remove_func=None, can_be_plotted=None)[source]

Add a plot object to the table

Parameters
  • what (str) – The description of the plot object

  • get_artists (function) – A function that takes no arguments and returns the artists

  • plot_func (function, optional) – A function that takes no arguments and makes the plot.

  • remove_func (function, optional) – A function that takes no arguments and removes the plot.

  • can_be_plotted (function, optional) – A function that takes no argument and returns True if the plot can be made.

adjust_height()[source]
can_be_plotted_funcs = {}

A mapping from plot identifier to a callable that returns True if the corresponding function in the plot_funcs mapping can be called

can_plot_column_starts()[source]

Test whether the column starts can be visualized

can_plot_data_box()[source]

Test whether the box around the diagram part can be plotted

See also

plot_data_box()

can_plot_data_reader_color_image()[source]

Test if the reader color image can be plotted

can_plot_full_df()[source]

Test whether the full_df can be plotted

See also

plot_full_df()

can_plot_potential_samples()[source]

Test whether potential sample regions can be plotted

can_plot_sample_hlines()[source]

Test whether the sample lines can be plotted

can_plot_samples()[source]

Test whether the samples can be plotted

See also

plot_samples()

col_lines = []
draw_figs(artists)[source]

Draw the figures of the given artists

Parameters

artists (list of matplotlib.artist.Artist) – The artists to draw the canvas from

enable_or_disable_widgets(b)[source]

b is ignored and is always set to True

get_column_start_lines()[source]

Get the artists of the column starts

get_data_box()[source]

Get the plotted straditize.straditizer.Straditizer.data_box

See also

plot_data_box()

get_data_reader_background()[source]

Get the straditize.binary.DataReader.background

get_data_reader_color_image()[source]

Get the straditize.binary.DataReader.color_plot_im

get_data_reader_image()[source]

Get the straditize.binary.DataReader.plot_im

get_full_df_lines()[source]

Get the artists of the full_df plot

See also

plot_full_df()

get_potential_samples_lines()[source]

Get the artists of the plot of potential samples

get_sample_hlines()[source]

Get the plotted the sample lines

get_samples_lines()[source]

Get the artists of the plotted samples

See also

plot_samples()

get_straditizer_image()[source]

Get the straditize.straditizer.Straditizer.plot_im

hide_funcs = {}

A mapping from plot identifier to a callable to hide the corresponding artists

plot_column_starts()[source]

Plot horizontal lines for the column starts

plot_data_box()[source]

Plot the data box around the diagram part

plot_data_reader_color_image()[source]

Plot the data reader color image

plot_full_df()[source]

Plot the full_df of the reader

plot_funcs = {}

A mapping from plot identifier to a callable to plot the corresponding artists

plot_potential_samples()[source]

Highlight the regions with potential samples in the plot

plot_sample_hlines()[source]

Plot the horizontal sample lines of the reader

plot_samples()[source]

Plot the samples of the reader

refresh()[source]

Refresh from the straditizer

remove_column_starts()[source]

Remove the plotted lines of the column starts

remove_data_box()[source]

Remove the box around the diagram part

See also

plot_data_box()

remove_data_reader_color_image()[source]

Remove the straditize.binary.DataReader.color_plot_im

remove_full_df_plot()[source]

Remove the plot of the full_df

See also

plot_full_df()

remove_potential_samples_plot()[source]

Remove the plot of potential samples

remove_sample_hlines_plot()[source]

Remove the sample lines

remove_samples_plot()[source]

Remove the plotted samples

See also

plot_samples()

should_be_enabled(w)[source]

Check if a widget should be enabled

This function checks if a given widget w from the widgets2disable attribute should be enabled or not

Parameters

w (QWidget) – The widget to check

Returns

True, if the widget should be enabled

Return type

bool

sizeHint(self) → QSize[source]
property widgets2disable

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

class straditize.widgets.plots.ResultsPlot(straditizer_widgets)[source]

Bases: straditize.widgets.StraditizerControlBase

A widget for plotting the final results

This widgets contains a QPushButton btn_plot to plot the results using the straditize.binary.DataReader.plot_results() method

Attributes

btn_plot

The QPushButton to call the plot_results() method

cb_final

A QCheckBox whether the samples or the full digitized data shall be

cb_transformed

A QCheckBox whether x- and y-axis should be translated from pixel to

Methods

plot_results()

Plot the results

refresh()

Refresh from the straditizer

setup_children(item)

Setup the children for this control

btn_plot = None

The QPushButton to call the plot_results() method

cb_final = None

A QCheckBox whether the samples or the full digitized data shall be plotted

cb_transformed = None

A QCheckBox whether x- and y-axis should be translated from pixel to data units

plot_results()[source]

Plot the results

What is plotted depends on the cb_transformed and the cb_final

cb_transformed and cb_final are checked

Plot the straditize.straditizer.Straditizer.final_df

cb_transformed is checked but not cb_final

Plot the straditize.straditizer.Straditizer.full_df

cb_transformed is not checked but cb_final

Plot the straditize.binary.DataReader.sample_locs

cb_transformed and cb_final are both not checked

Plot the straditize.binary.DataReader.full_df

refresh()[source]

Refresh from the straditizer

setup_children(item)[source]

Setup the children for this control

This method is called to setup the children in the StraditizerWidgets.tree. By default, it just creates a child QTreeWidgetItem and sets this control as it’s widget

Parameters

item (QTreeWidgetItem) – The top level item in the StraditizerWidgets.tree