Skip to content

Commit

Permalink
doc: change reference section style
Browse files Browse the repository at this point in the history
  • Loading branch information
JSS95 committed Oct 11, 2023
1 parent 56a1f47 commit 2874ee5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
28 changes: 14 additions & 14 deletions src/dipcoatimage/finitedepth/polysubstrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class PolySubstrateBase(
):
"""Abstract base class for substrate whose cross section is a simple polygon.
A simple polygon does not have intersection nor hole [#simple-polygon]_.
Smooth corners are allowed.
A simple polygon does not have intersection nor hole. Smooth corners are
allowed.
The following substrate images are not supported:
Expand All @@ -76,7 +76,7 @@ class PolySubstrateBase(
draw_options
References:
.. [#simple-polygon] https://en.wikipedia.org/wiki/Simple_polygon
* https://en.wikipedia.org/wiki/Simple_polygon
"""

SidesNum: int
Expand All @@ -103,22 +103,22 @@ def contour(self) -> npt.NDArray[np.int32]:
def vertices(self) -> npt.NDArray[np.int32]:
"""Find vertices of the polygon from its contour.
A vertex is a point where two sides of a polygon meet[#vertex-geom]_.
A vertex is a point where two sides of a polygon meet.
The sides can be curves, where the vertices can be defined as local
extrema of curvature [#vertex-curve]_.
extrema of curvature.
Returns:
Indices of the vertex points in :meth:`contour`.
The number of the vertices is defined by :attr:`SidesNum`.
Note:
Contour is Gaussian-filtered to reduce noise[#so-curvature]_.
Contour is Gaussian-filtered to reduce noise.
Sigma value of the kernel is determined from :attr:`parameters`.
References:
.. [#vertex-geom] https://en.wikipedia.org/wiki/Vertex_(geometry)
.. [#vertex-curve] https://en.wikipedia.org/wiki/Vertex_(curve)
.. [#so-curvature] https://stackoverflow.com/q/32629806
* https://en.wikipedia.org/wiki/Vertex_(geometry)
* https://en.wikipedia.org/wiki/Vertex_(curve)
* https://stackoverflow.com/q/32629806
"""
cnt = self.contour().astype(np.float64)

Expand Down Expand Up @@ -171,14 +171,14 @@ def sides(self) -> Tuple[npt.NDArray[np.int32], ...]:
def sidelines(self) -> npt.NDArray[np.float32]:
r"""Find linear model of polygon sides.
This method finds straight sidelines [#extended-side]_ using
Hough line transformation. Radian and angle resolutions are determined
by :attr:`parameters`.
This method finds straight sidelines using Hough line transformation.
Radian and angle resolutions are determined by :attr:`parameters`.
Returns:
Vector of line parameters in :math:`(\rho, \theta)`.
:math:`\rho` is the distance from the coordinate origin.
:math:`\theta` is the angle of normal vector from the origin to the line.
:math:`\theta` is the angle of normal vector from the origin
to the line.
Note:
Range of angle is
Expand All @@ -187,7 +187,7 @@ def sidelines(self) -> npt.NDArray[np.float32]:
:math:`\theta + \frac{\pi}{2}`.
References:
.. [#extended-side] https://en.wikipedia.org/wiki/Extended_side
* https://en.wikipedia.org/wiki/Extended_side
"""
# Do not find the line from smoothed contour. Noise is removed anyway
# without smoothing by Hough transformation. In fact, smoothing
Expand Down
26 changes: 15 additions & 11 deletions src/dipcoatimage/finitedepth/rectcoatinglayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ def surface(self) -> Tuple[np.int64, np.int64]:
def uniform_layer(self) -> Tuple[np.float64, npt.NDArray[np.float64]]:
"""Imaginary uniform layer.
Uniform layer is a parallel curve[#parallel]_ of substrate surface, having
same cross-sectional area as the actual coating layer.
Uniform layer is a parallel curve of substrate surface, having same
cross-sectional area as the actual coating layer.
Returns:
Thickness and points of the uniform layer.
Expand All @@ -506,7 +506,7 @@ def uniform_layer(self) -> Tuple[np.float64, npt.NDArray[np.float64]]:
:func:`polyline_parallel_area`.
References:
.. [#parallel] https://en.wikipedia.org/wiki/Parallel_curve
* https://en.wikipedia.org/wiki/Parallel_curve
"""
if not self.interfaces():
return (np.float64(0), np.empty((0, 1, 2), np.float64))
Expand Down Expand Up @@ -823,7 +823,7 @@ def equidistant_interpolate(points, n) -> npt.NDArray[np.float64]:


def polyline_parallel_area(line: npt.NDArray, t: float) -> np.float64:
"""Calculate the area between convex polyline[#polyline]_ and its parallel curve.
"""Calculate the area between convex polyline and its parallel curve.
Arguments:
line: Vertices of a polyline.
Expand All @@ -835,7 +835,7 @@ def polyline_parallel_area(line: npt.NDArray, t: float) -> np.float64:
area: Area between the polyline and its parallel curve.
References:
.. [#polyline] https://en.wikipedia.org/wiki/Polygonal_chain
* https://en.wikipedia.org/wiki/Polygonal_chain
"""
vec = np.diff(line, axis=0)
d_l = np.linalg.norm(vec, axis=-1)
Expand All @@ -847,8 +847,6 @@ def polyline_parallel_area(line: npt.NDArray, t: float) -> np.float64:
def acm(cm: npt.NDArray[np.float64]) -> npt.NDArray[np.float64]:
"""Compute accumulated cost matrix from local cost matrix.
Implements the algorithm from [#dtw1]_, with modification from [#dtw2]_.
Arguments:
cm: Local cost matrix.
Expand All @@ -858,10 +856,10 @@ def acm(cm: npt.NDArray[np.float64]) -> npt.NDArray[np.float64]:
If *cm* is empty, return value is an empty array.
References:
.. [#dtw1] Senin, Pavel. "Dynamic time warping algorithm review."
Information and Computer Science Department University of Hawaii at
Manoa Honolulu, USA 855.1-23 (2008): 40.
.. [#dtw2] https://pypi.org/project/similaritymeasures/
* Senin, Pavel. "Dynamic time warping algorithm review."
Information and Computer Science Department University of Hawaii at
Manoa Honolulu, USA 855.1-23 (2008): 40.
* https://pypi.org/project/similaritymeasures/
"""
p, q = cm.shape
ret = np.zeros((p, q), dtype=np.float64)
Expand Down Expand Up @@ -892,6 +890,12 @@ def owp(acm: npt.NDArray[np.float64]) -> npt.NDArray[np.int32]:
Returns:
Indices for the two series to get the optimal warping path.
References:
* Senin, Pavel. "Dynamic time warping algorithm review."
Information and Computer Science Department University of Hawaii at
Manoa Honolulu, USA 855.1-23 (2008): 40.
* https://pypi.org/project/similaritymeasures/
"""
p, q = acm.shape
if p == 0 or q == 0:
Expand Down

0 comments on commit 2874ee5

Please sign in to comment.