Skip to content

Commit ef6ad1b

Browse files
committed
chore(docs): convert non-numpy :param docstrings to numpy-style
1 parent a26fc49 commit ef6ad1b

File tree

16 files changed

+351
-213
lines changed

16 files changed

+351
-213
lines changed

loopstructural/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,15 @@
1515
def classFactory(iface):
1616
"""Load the plugin class.
1717
18-
:param iface: A QGIS interface instance.
19-
:type iface: QgsInterface
18+
Parameters
19+
----------
20+
iface : QgsInterface
21+
A QGIS interface instance provided by QGIS when loading plugins.
22+
23+
Returns
24+
-------
25+
LoopstructuralPlugin
26+
An instance of the plugin class initialized with `iface`.
2027
"""
2128
from .plugin_main import LoopstructuralPlugin
2229

loopstructural/gui/dlg_settings.py

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ def __init__(self, parent):
8080
self.load_settings()
8181

8282
def apply(self):
83-
"""Called to permanently apply the settings shown in the options page (e.g. \
84-
save them to QgsSettings objects). This is usually called when the options \
85-
dialog is accepted.
86-
"""
83+
"""Apply settings from the form and persist them to QgsSettings."""
8784
settings = self.plg_settings.get_plg_settings()
8885

8986
# misc
@@ -104,7 +101,7 @@ def apply(self):
104101
)
105102

106103
def load_settings(self):
107-
"""Load options from QgsSettings into UI form."""
104+
"""Load options from QgsSettings into the UI form."""
108105
settings = self.plg_settings.get_plg_settings()
109106

110107
# global
@@ -117,7 +114,7 @@ def load_settings(self):
117114
self.npw_spin_box.setValue(settings.interpolator_npw)
118115

119116
def reset_settings(self):
120-
"""Reset settings to default values (set in preferences.py module)."""
117+
"""Reset settings in the UI and persisted settings to plugin defaults."""
121118
default_settings = PlgSettingsStructure()
122119

123120
# dump default settings into QgsSettings
@@ -135,36 +132,46 @@ def __init__(self):
135132
super().__init__()
136133

137134
def icon(self) -> QIcon:
138-
"""Returns plugin icon, used to as tab icon in QGIS options tab widget.
135+
"""Returns plugin icon used as tab icon in QGIS options.
139136
140-
:return: _description_
141-
:rtype: QIcon
137+
Returns
138+
-------
139+
QIcon
140+
Plugin icon instance.
142141
"""
143142
return QIcon(str(__icon_path__))
144143

145144
def createWidget(self, parent) -> ConfigOptionsPage:
146145
"""Create settings widget.
147146
148-
:param parent: Qt parent where to include the options page.
149-
:type parent: QObject
147+
Parameters
148+
----------
149+
parent : QObject
150+
Qt parent where to include the options page.
150151
151-
:return: options page for tab widget
152-
:rtype: ConfigOptionsPage
152+
Returns
153+
-------
154+
ConfigOptionsPage
155+
Instantiated options page.
153156
"""
154157
return ConfigOptionsPage(parent)
155158

156159
def title(self) -> str:
157-
"""Returns plugin title, used to name the tab in QGIS options tab widget.
160+
"""Plugin title used to name options tab.
158161
159-
:return: plugin title from about module
160-
:rtype: str
162+
Returns
163+
-------
164+
str
165+
Plugin title string.
161166
"""
162167
return __title__
163168

164169
def helpId(self) -> str:
165-
"""Returns plugin help URL.
170+
"""Plugin help URL.
166171
167-
:return: plugin homepage url from about module
168-
:rtype: str
172+
Returns
173+
-------
174+
str
175+
URL of the plugin homepage.
169176
"""
170177
return __uri_homepage__

loopstructural/gui/modelling/model_definition/bounding_box.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ def __init__(self, parent=None, data_manager=None):
2424
self.data_manager.set_bounding_box_update_callback(self.set_bounding_box)
2525

2626
def set_bounding_box(self, bounding_box):
27-
"""
28-
Set the bounding box values in the UI.
29-
:param bounding_box: BoundingBox object with xmin, xmax, ymin, ymax, zmin, zmax attributes.
27+
"""Populate UI controls with values from a BoundingBox object.
28+
29+
Parameters
30+
----------
31+
bounding_box : object
32+
BoundingBox-like object with `origin` and `maximum` sequences of length 3.
3033
"""
3134
self.originXSpinBox.setValue(bounding_box.origin[0])
3235
self.maxXSpinBox.setValue(bounding_box.maximum[0])
@@ -36,10 +39,7 @@ def set_bounding_box(self, bounding_box):
3639
self.maxZSpinBox.setValue(bounding_box.maximum[2])
3740

3841
def useCurrentViewExtent(self):
39-
"""
40-
Use the current view extent from the map canvas.
41-
This method should be connected to a button or action in the UI.
42-
"""
42+
"""Set bounding box values from the current map canvas view extent."""
4343
if self.data_manager.map_canvas:
4444
extent = self.data_manager.map_canvas.extent()
4545
self.originXSpinBox.setValue(extent.xMinimum())
@@ -50,10 +50,7 @@ def useCurrentViewExtent(self):
5050
self.maxZSpinBox.setValue(1000)
5151

5252
def selectFromCurrentLayer(self):
53-
"""
54-
Select the bounding box from the current layer.
55-
This method should be connected to a button or action in the UI.
56-
"""
53+
"""Set bounding box values from the currently selected layer's 3D extent."""
5754
layer = self.data_manager.map_canvas.currentLayer()
5855
if layer:
5956
extent = layer.extent3D()

loopstructural/gui/modelling/stratigraphic_column/stratigraphic_column.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,19 @@
1414

1515

1616
class StratColumnWidget(QWidget):
17-
"""In control of building the stratigraphic column
18-
19-
:param QWidget: _description_
20-
:type QWidget: _type_
17+
"""Widget that controls building the stratigraphic column.
18+
19+
Parameters
20+
----------
21+
parent : QWidget, optional
22+
Parent widget, by default None.
23+
data_manager : object
24+
Data manager instance used to manage the stratigraphic column. Must be provided.
25+
26+
Notes
27+
-----
28+
The widget updates its display based on the data_manager's stratigraphic column
29+
and registers a callback via data_manager.set_stratigraphic_column_callback.
2130
"""
2231

2332
def __init__(self, parent=None, data_manager=None):

loopstructural/gui/modelling/stratigraphic_column/stratigraphic_unit.py

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,19 @@ def name(self, value: str):
4040
self._name = str(value)
4141

4242
def set_thickness(self, thickness: float):
43-
"""
44-
Set the thickness of the stratigraphic unit.
45-
:param thickness: The thickness value to set.
43+
"""Set the thickness of the stratigraphic unit.
44+
45+
Parameters
46+
----------
47+
thickness : float
48+
The thickness value to set.
4649
"""
4750
self.thickness = thickness
4851
self.spinBoxThickness.setValue(thickness)
4952
self.validateFields()
5053

5154
def onColourSelectClicked(self):
52-
"""
53-
Open a color dialog to select a color for the stratigraphic unit.
54-
"""
55+
"""Open a color dialog to select a color for the stratigraphic unit."""
5556
from PyQt5.QtWidgets import QColorDialog
5657

5758
color = QColorDialog.getColor()
@@ -60,19 +61,19 @@ def onColourSelectClicked(self):
6061
self.buttonColor.setStyleSheet(f"background-color: {self.colour};")
6162

6263
def onThicknessChanged(self, thickness: float):
63-
"""
64-
Update the thickness of the stratigraphic unit.
65-
:param thickness: The new thickness value.
64+
"""Handle changes to the thickness spinbox.
65+
66+
Parameters
67+
----------
68+
thickness : float
69+
The new thickness value.
6670
"""
6771
self.thickness = thickness
6872
self.validateFields()
6973
self.thicknessChanged.emit(thickness)
7074

7175
def onNameChanged(self):
72-
"""
73-
Update the name of the stratigraphic unit.
74-
:param name: The new name value.
75-
"""
76+
"""Handle name edit completion and emit nameChanged if modified."""
7677
name = self.lineEditName.text().strip()
7778
if name != self.name:
7879
self.name = name
@@ -84,9 +85,7 @@ def request_delete(self):
8485
self.deleteRequested.emit(self)
8586

8687
def validateFields(self):
87-
"""
88-
Validate the fields and update the widget's appearance.
89-
"""
88+
"""Validate the widget fields and update UI hints."""
9089
# Reset all styles first
9190
self.lineEditName.setStyleSheet("")
9291
self.spinBoxThickness.setStyleSheet("")
@@ -101,9 +100,12 @@ def validateFields(self):
101100
self.spinBoxThickness.setToolTip("Thickness must be greater than zero.")
102101

103102
def setData(self, data: Optional[dict] = None):
104-
"""
105-
Set the data for the stratigraphic unit widget.
106-
:param data: A dictionary containing 'name' and 'colour' keys.
103+
"""Set the data for the stratigraphic unit widget.
104+
105+
Parameters
106+
----------
107+
data : dict or None
108+
Dictionary containing 'name' and 'colour' keys. If None, defaults are used.
107109
"""
108110
if data:
109111
self.name = str(data.get("name", ""))
@@ -119,9 +121,12 @@ def setData(self, data: Optional[dict] = None):
119121
self.validateFields()
120122

121123
def getData(self) -> dict:
122-
"""
123-
Get the data from the stratigraphic unit widget.
124-
:return: A dictionary containing 'name', 'colour', and 'thickness'.
124+
"""Return the widget data as a dictionary.
125+
126+
Returns
127+
-------
128+
dict
129+
Dictionary containing 'uuid', 'name', 'colour', and 'thickness'.
125130
"""
126131
return {
127132
"uuid": self.uuid,

loopstructural/gui/modelling/stratigraphic_column/unconformity.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ def request_delete(self):
2929
self.deleteRequested.emit(self)
3030

3131
def setData(self, data: Optional[dict] = None):
32-
"""
33-
Set the data for the unconformity widget.
34-
:param data: A dictionary containing 'unconformity_type' key.
32+
"""Set the data for the unconformity widget.
33+
34+
Parameters
35+
----------
36+
data : dict or None
37+
Dictionary containing 'unconformity_type' key. If None, defaults are used.
3538
"""
3639
if data:
3740
self.unconformity_type = data.get("unconformity_type", "")

loopstructural/gui/visualisation/feature_list_widget.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ def _get_vector_scale(self, scale: Optional[Union[float, int]] = None) -> float:
5757
return scale
5858

5959
def add_feature(self, feature):
60-
"""Add a feature to the feature list.
60+
"""Add a feature to the feature list widget.
6161
62-
:param feature: The feature to add.
63-
:type feature: Feature
62+
Parameters
63+
----------
64+
feature : Feature
65+
The feature object to add to the list.
6466
"""
6567
featureItem = QTreeWidgetItem(self.treeWidget)
6668
featureItem.setText(0, feature.name)

loopstructural/gui/visualisation/loop_pyvistaqt_wrapper.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,30 @@ def add_mesh_object(self, mesh, name: str, *, scalars: Optional[Any] = None, cma
3636
This wrapper stores metadata to allow robust re-adding and
3737
updating of visualization parameters.
3838
39-
:param mesh: a pyvista mesh-like object
40-
:param name: unique name for the mesh
41-
:param scalars: name of scalar array or scalar values to map
42-
:param cmap: colormap name
43-
:param clim: tuple (min, max) for colormap
44-
:param opacity: float 0-1 for surface opacity
45-
:param show_scalar_bar: whether to show scalar bar
46-
:param color: tuple of 3 floats (r,g,b) in 0..1 for solid color; if provided, overrides scalars
39+
Parameters
40+
----------
41+
mesh : pyvista.PolyData or similar
42+
Mesh-like object to add.
43+
name : str
44+
Unique name for the mesh.
45+
scalars : Optional[Any]
46+
Name of scalar array or scalar values to map (optional).
47+
cmap : Optional[str]
48+
Colormap name (optional).
49+
clim : Optional[tuple(float, float)]
50+
Color limits as (min, max) for the colormap (optional).
51+
opacity : Optional[float]
52+
Surface opacity in the range 0-1 (optional).
53+
show_scalar_bar : bool
54+
Whether to show a scalar bar for mapped scalars.
55+
color : Optional[tuple(float, float, float)]
56+
Solid color as (r, g, b) in 0..1; if provided, overrides scalars.
57+
**kwargs : dict
58+
Additional keyword arguments forwarded to the underlying pyvista add_mesh call.
59+
60+
Returns
61+
-------
62+
None
4763
"""
4864
# Remove any previous entry with the same name (to keep metadata consistent)
4965
# if name in self.meshes:

loopstructural/main/callableToLayer.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,21 @@
1010
def callableToLayer(callable, layer, dtm, name: str):
1111
"""Convert a feature to a raster and store it in QGIS as a temporary layer.
1212
13-
:param feature: The object that has an `evaluate_value` method for computing values.
14-
:param dtm: Digital terrain model (if needed for processing).
15-
:param bounding_box: Object with `origin`, `maximum`, `step_vector`, and `nsteps`.
16-
:param crs: Coordinate reference system (QGIS CRS object).
13+
Parameters
14+
----------
15+
callable : callable
16+
A callable that accepts an (N,3) numpy array of points and returns values.
17+
layer : QgsVectorLayer
18+
QGIS vector layer to update with computed values.
19+
dtm : QgsRaster or None
20+
Digital terrain model used to extract Z values for points (optional).
21+
name : str
22+
Name of the attribute/field to store the computed values.
23+
24+
Returns
25+
-------
26+
None
27+
The function updates the provided `layer` in-place.
1728
"""
1829
layer.startEditing()
1930
if name not in [field.name() for field in layer.fields()]:

loopstructural/main/geometry/mapGrid.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33

44

55
def createGrid(boundingBox, dtm):
6-
"""Create a grid from a bounding box and a digital terrain model
6+
"""Create a grid from a bounding box and an optional DEM.
77
8-
:param boundingBox: Bounding box of the grid
9-
:type boundingBox: tuple
10-
:param dtm: Digital Terrain Model
11-
:type dtm: _type_
12-
:return: the grid
13-
:rtype: _type_
8+
Parameters
9+
----------
10+
boundingBox : object
11+
Bounding box of the grid. Must provide `corners_global` and `nsteps`.
12+
dtm : QgsRaster or None
13+
Digital Terrain Model used to sample Z values (optional).
14+
15+
Returns
16+
-------
17+
numpy.ndarray
18+
Array of shape (N, 3) with X, Y, Z coordinates for grid points.
1419
"""
1520
minx, miny, maxx, maxy = boundingBox.corners_global[[0, 2], :2].flatten()
1621
x = np.linspace(minx, maxx, boundingBox.nsteps[0])

0 commit comments

Comments
 (0)