Skip to content

Commit

Permalink
updated math docstrings to avoid flake8 W605
Browse files Browse the repository at this point in the history
  • Loading branch information
martibosch committed Sep 2, 2020
1 parent 4baf330 commit c88df9e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
40 changes: 21 additions & 19 deletions pylandstats/landscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ def area(self, class_val=None, hectares=True):
The area of each patch of the landscape
.. math::
AREA = a_{i,j} \\quad [hec] \; or \; [m]
AREA = a_{i,j} \\quad [hec] \\; or \\; [m]
Parameters
----------
Expand Down Expand Up @@ -710,7 +710,7 @@ def perimeter_area_ratio(self, class_val=None, hectares=True):
smaller perimeter-area ratio.
.. math::
PARA = \\frac{p_{i,j}}{a_{i,j}} \\quad [m/hec] \; or \; [m/m^2]
PARA = \\frac{p_{i,j}}{a_{i,j}} \\quad [m/hec] \\; or \\; [m/m^2]
Parameters
----------
Expand Down Expand Up @@ -763,7 +763,7 @@ def shape_index(self, class_val=None):
shape.
.. math::
SHAPE = \\frac{.25 \; p_{i,j}}{\\sqrt{a_{i,j}}}
SHAPE = \\frac{.25 \\; p_{i,j}}{\\sqrt{a_{i,j}}}
Parameters
----------
Expand Down Expand Up @@ -802,7 +802,7 @@ def fractal_dimension(self, class_val=None):
sizes
.. math::
FRAC = \\frac{2 \; ln (.25 \; p_{i,j})}{ln (a_{i,j})}
FRAC = \\frac{2 \\; ln (.25 \\; p_{i,j})}{ln (a_{i,j})}
Parameters
----------
Expand Down Expand Up @@ -945,13 +945,13 @@ def total_area(self, class_val=None, hectares=True):
class level as in:
.. math::
TA_i = \\sum_{j=1}^{n_i} a_{i,j} \\quad [hec] \; or \; [m] \\quad
(class \; i)
TA_i = \\sum_{j=1}^{n_i} a_{i,j} \\quad [hec] \\; or \\; [m] \\quad
(class \\; i)
otherwise, the metric is computed at the landscape level as in:
.. math::
TA = A \\quad [hec] \; or \; [m] \\quad (landscape)
TA = A \\quad [hec] \\; or \\; [m] \\quad (landscape)
Parameters
----------
Expand Down Expand Up @@ -1017,7 +1017,7 @@ def number_of_patches(self, class_val=None):
at the class level as in:
.. math::
NP_i = n_i \\quad (class \; i)
NP_i = n_i \\quad (class \\; i)
otherwise, the metric is computed at the landscape level as in:
Expand Down Expand Up @@ -1051,13 +1051,14 @@ def patch_density(self, class_val=None, percent=True, hectares=True):
the class level as in:
.. math::
PD_i = \\frac{n_i}{A} \\quad [1/hec] \; or \; [1/m^2] \\quad (class
\; i)
PD_i = \\frac{n_i}{A} \\quad [1/hec] \\; or \\; [1/m^2] \\quad
(class \\; i)
otherwise, the metric is computed at the landscape level as in:
.. math::
PD = \\frac{N}{A} \\quad [1/hec] \; or \; [1/m^2] \\quad (landscape)
PD = \\frac{N}{A} \\quad [1/hec] \\; or \\; [1/m^2] \\quad
(landscape)
Parameters
----------
Expand Down Expand Up @@ -1101,7 +1102,7 @@ def largest_patch_index(self, class_val=None, percent=True):
in:
.. math::
LPI_i = \\frac{1}{A} \\max_{j=1}^{n_i} a_{i,j} \\quad (class \; i)
LPI_i = \\frac{1}{A} \\max_{j=1}^{n_i} a_{i,j} \\quad (class \\; i)
otherwise, the metric is computed at the landscape level as in:
Expand Down Expand Up @@ -1142,7 +1143,7 @@ def total_edge(self, class_val=None, count_boundary=False):
metric is computed at the class level as in:
.. math::
TE_i = \\sum_{k=1}^{m} e_{i,k} \\quad [m] \\quad (class \; i)
TE_i = \\sum_{k=1}^{m} e_{i,k} \\quad [m] \\quad (class \\; i)
otherwise, the metric is computed at the landscape level as in:
Expand Down Expand Up @@ -1232,13 +1233,14 @@ def edge_density(self, class_val=None, count_boundary=False,
metric is computed at the class level as in:
.. math::
ED_i = \\frac{1}{A} \\sum_{k=1}^{m} e_{i,k} \\quad [m/hec] \; or
\; [m/m^2] \\quad (class \; i)
ED_i = \\frac{1}{A} \\sum_{k=1}^{m} e_{i,k} \\quad [m/hec] \\; or
\\; [m/m^2] \\quad (class \\; i)
otherwise, the metric is computed at the landscape level as in:
.. math::
ED = \\frac{E}{A} \\quad [m/hec] \; or \; [m/m^2] \\quad (landscape)
ED = \\frac{E}{A} \\quad [m/hec] \\; or \\; [m/m^2] \\quad
(landscape)
Parameters
----------
Expand Down Expand Up @@ -2245,7 +2247,7 @@ def landscape_shape_index(self, class_val=None):
.. math::
LSI_i = \\frac{.25 \\sum \\limits_{k=1}^{m} e_{i,k}}{\\sqrt{A}}
\\quad (class \; i)
\\quad (class \\; i)
otherwise, the metric is computed at the landscape level as in:
Expand Down Expand Up @@ -2325,7 +2327,7 @@ def effective_mesh_size(self, class_val=None, hectares=True):
.. math::
MESH_i = \\frac{1}{A} \\sum_{j=1}^{n_i} a_{i,j}^2 \\quad [m] \\quad
(class \; i)
(class \\; i)
otherwise, the metric is computed at the landscape level as in:
Expand Down Expand Up @@ -2432,7 +2434,7 @@ def shannon_diversity_index(self):
computed at the landscape level as in:
.. math::
SHDI = - \\sum \\limits_{i=1}^{m} \\Big( P_i \; ln P_i \\Big)
SHDI = - \\sum \\limits_{i=1}^{m} \\Big( P_i \\; ln P_i \\Big)
Returns
-------
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exclude =
pylandstats/__pythran__
per-file-ignores =
pylandstats/__init__.py:F401,F403
pylandstats/landscape.py:F821,W605
pylandstats/landscape.py:F821
tests/test_pylandstats.py:F401

[yapf]
Expand Down

0 comments on commit c88df9e

Please sign in to comment.