invert4geom.plotting
#
Module Contents#
Functions#
|
plot a scatter plot graph with x axis equal to parameter 1, y axis equal to |
|
plot a graph of cross-validation scores vs hyperparameter values |
|
plot a graph of misfit and time vs iteration number. |
|
plot a graph of misfit and time vs iteration number. |
|
create grids from the various data variables of the supplied gravity dataframe and |
|
plot the initial and final topography grids from the inversion and their difference |
|
plot the initial and final misfit grids from the inversion and their difference |
|
plot the starting misfit, updated topography, and correction grids for a specified |
|
plot various results from the inversion |
|
add a light to a pyvista plotter object |
|
show prism layers using PyVista |
Attributes#
- plot_2_parameter_cv_scores(scores, parameter_pairs, logx=False, logy=False, param_names=('Hyperparameter 1', 'Hyperparameter 2'), figsize=(5, 3.5), cmap='viridis')[source]#
plot a scatter plot graph with x axis equal to parameter 1, y axis equal to parameter 2, and points colored by cross-validation scores.
- Parameters:
logx (bool, optional) – make the x or y axes log scale, by default False
logy (bool, optional) – make the x or y axes log scale, by default False
param_names (tuple[str, str], optional) – name to give for the parameters, by default “Hyperparameter”
figsize (tuple[float, float], optional) – size of the figure, by default (5, 3.5)
cmap (str, optional) – matplotlib colormap for scores, by default “viridis”
- Return type:
None
- plot_cv_scores(scores, parameters, logx=False, logy=False, param_name='Hyperparameter', figsize=(5, 3.5), plot_title=None)[source]#
plot a graph of cross-validation scores vs hyperparameter values
- Parameters:
logx (bool, optional) – make the x or y axes log scale, by default False
logy (bool, optional) – make the x or y axes log scale, by default False
param_name (str, optional) – name to give for the parameters, by default “Hyperparameter”
figsize (tuple[float, float], optional) – size of the figure, by default (5, 3.5)
plot_title (str | None, optional) – title of figure, by default None
- Return type:
None
- plot_convergence(results, iter_times=None, logy=False, inversion_region=None, figsize=(5, 3.5))[source]#
plot a graph of misfit and time vs iteration number.
- Parameters:
results (pd.DataFrame) – gravity result dataframe
iter_times (list[float] | None, optional) – list of iteration execution times, by default None
logy (bool, optional) – choose whether to plot y axis in log scale, by default False
inversion_region (tuple[float, float, float, float] | None, optional) – inside region of inversion, by default None
figsize (tuple[float, float], optional) – width and height of figure, by default (5, 3.5)
- Return type:
None
- plot_dynamic_convergence(results, l2_norm_tolerance, starting_misfit, inversion_region=None, figsize=(5, 3.5))[source]#
plot a graph of misfit and time vs iteration number.
- Parameters:
results (pd.DataFrame) – gravity result dataframe
l2_norm_tolerance (float) – l2 norm tolerance
starting_misfit (float) – starting misfit rmse
inversion_region (tuple[float, float, float, float] | None, optional) – inside region of inversion, by default None
figsize (tuple[float, float], optional) – width and height of figure, by default (5, 3.5)
- Return type:
None
- grid_inversion_results(misfits, topos, corrections, prisms_ds, grav_results, region)[source]#
create grids from the various data variables of the supplied gravity dataframe and prism dataset
- Parameters:
misfits (list[str]) – list of misfit column names in the gravity results dataframe
topos (list[str]) – list of topography variable names in the prism dataset
corrections (list[str]) – list of correction variable names in the prism dataset
prisms_ds (xr.Dataset) – resulting dataset of prism layer from the inversion
grav_results (pd.DataFrame) – resulting dataframe of gravity data from the inversion
region (tuple[float, float, float, float]) – region to use for gridding in format (xmin, xmax, ymin, ymax)
- Returns:
lists of misfit, topography, and correction grids
- Return type:
tuple[list[xr.DataArray], list[xr.DataArray], list[xr.DataArray]]
- plot_inversion_topo_results(prisms_ds, topo_cmap_perc=1, region=None)[source]#
plot the initial and final topography grids from the inversion and their difference
- plot_inversion_grav_results(grav_results, region, iterations)[source]#
plot the initial and final misfit grids from the inversion and their difference
- plot_inversion_iteration_results(grids, grav_results, topo_results, parameters, iterations, topo_cmap_perc=1, misfit_cmap_perc=1, corrections_cmap_perc=1)[source]#
plot the starting misfit, updated topography, and correction grids for a specified number of the iterations of an inversion
- Parameters:
grids (tuple[list[xr.DataArray], list[xr.DataArray], list[xr.DataArray]]) – lists of misfit, topography, and correction grids
grav_results (pd.DataFrame) – gravity dataframe resulting from the inversion
topo_results (pd.DataFrame) – topography dataframe resulting from the inversion
parameters (dict[str, Any]) – inversion parameters resulting from the inversion
iterations (list[int]) – list of all the iteration numbers which occurred in the inversion
topo_cmap_perc (float, optional) – value to multiply the max and min colorscale values by, by default 1
misfit_cmap_perc (float, optional) – value to multiply the max and min colorscale values by, by default 1
corrections_cmap_perc (float, optional) – value to multiply the max and min colorscale values by, by default 1
- Return type:
None
- plot_inversion_results(grav_results, topo_results, parameters, grav_region, iters_to_plot=None, plot_iter_results=True, plot_topo_results=True, plot_grav_results=True, **kwargs)[source]#
plot various results from the inversion
- Parameters:
grav_results (pd.DataFrame | str) – gravity results dataframe or filename
topo_results (pd.DataFrame | str) – topography results dataframe or filename
parameters (dict[str, Any] | str) – inversion parameters dictionary or filename
grav_region (tuple[float, float, float, float] | None) – region to use for gridding in format (xmin, xmax, ymin, ymax), by default None
iters_to_plot (int | None, optional) – number of iterations to plot, including the first and last, by default None
plot_iter_results (bool, optional) – plot the iteration results, by default True
plot_topo_results (bool, optional) – plot the topography results, by default True
plot_grav_results (bool, optional) – plot the gravity results, by default True
kwargs (Any)
- Return type:
None
- add_light(plotter, prisms)[source]#
add a light to a pyvista plotter object
- Parameters:
plotter (pyvista.Plotter) – pyvista plotter object
prisms (xr.Dataset) – harmonica prisms layer
- Return type:
None
- show_prism_layers(prisms, cmap='viridis', color_by='density', **kwargs)[source]#
show prism layers using PyVista
- Parameters:
prisms (list | xr.Dataset) – either a single harmonica prism layer of list of layers,
cmap (str, optional) – matplotlib colorscale to use, by default “viridis”
color_by (str, optional) – either use a variable of the prism_layer dataset, typically ‘density’ or ‘thickness’, or choose ‘constant’ to have each layer colored by a unique color use kwarg colors to alter these colors, by default is “density”
kwargs (Any)
- Return type:
None