lsapy 0.3.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. {lsapy-0.3.0 → lsapy-0.3.1}/CHANGELOG.rst +9 -1
  2. {lsapy-0.3.0 → lsapy-0.3.1}/PKG-INFO +1 -1
  3. {lsapy-0.3.0 → lsapy-0.3.1}/pyproject.toml +1 -1
  4. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/__init__.py +1 -1
  5. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/functions/membership.py +2 -2
  6. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/standardize.py +10 -16
  7. {lsapy-0.3.0 → lsapy-0.3.1}/tests/test_fitting.py +1 -1
  8. {lsapy-0.3.0 → lsapy-0.3.1}/tests/test_membership_fitting.py +1 -1
  9. {lsapy-0.3.0 → lsapy-0.3.1}/CODE_OF_CONDUCT.md +0 -0
  10. {lsapy-0.3.0 → lsapy-0.3.1}/CONTRIBUTING.rst +0 -0
  11. {lsapy-0.3.0 → lsapy-0.3.1}/LICENSE +0 -0
  12. {lsapy-0.3.0 → lsapy-0.3.1}/README.rst +0 -0
  13. {lsapy-0.3.0 → lsapy-0.3.1}/docs/Makefile +0 -0
  14. {lsapy-0.3.0 → lsapy-0.3.1}/docs/api/criteria.rst +0 -0
  15. {lsapy-0.3.0 → lsapy-0.3.1}/docs/api/deprecated.rst +0 -0
  16. {lsapy-0.3.0 → lsapy-0.3.1}/docs/api/lsa.rst +0 -0
  17. {lsapy-0.3.0 → lsapy-0.3.1}/docs/api/standardize.rst +0 -0
  18. {lsapy-0.3.0 → lsapy-0.3.1}/docs/api/stats.rst +0 -0
  19. {lsapy-0.3.0 → lsapy-0.3.1}/docs/api/utils.rst +0 -0
  20. {lsapy-0.3.0 → lsapy-0.3.1}/docs/api.rst +0 -0
  21. {lsapy-0.3.0 → lsapy-0.3.1}/docs/changelog.rst +0 -0
  22. {lsapy-0.3.0 → lsapy-0.3.1}/docs/community/code_of_conduct.rst +0 -0
  23. {lsapy-0.3.0 → lsapy-0.3.1}/docs/community/contributing.rst +0 -0
  24. {lsapy-0.3.0 → lsapy-0.3.1}/docs/community/index.rst +0 -0
  25. {lsapy-0.3.0 → lsapy-0.3.1}/docs/conf.py +0 -0
  26. {lsapy-0.3.0 → lsapy-0.3.1}/docs/getting_started/index.rst +0 -0
  27. {lsapy-0.3.0 → lsapy-0.3.1}/docs/index.rst +0 -0
  28. {lsapy-0.3.0 → lsapy-0.3.1}/docs/logos/FT2050-full_colour.png +0 -0
  29. {lsapy-0.3.0 → lsapy-0.3.1}/docs/logos/UCBlack.png +0 -0
  30. {lsapy-0.3.0 → lsapy-0.3.1}/docs/logos/UCWhite.png +0 -0
  31. {lsapy-0.3.0 → lsapy-0.3.1}/docs/logos/lsapy/LSAPy_Icon.png +0 -0
  32. {lsapy-0.3.0 → lsapy-0.3.1}/docs/logos/lsapy/LSAPy_Icon.svg +0 -0
  33. {lsapy-0.3.0 → lsapy-0.3.1}/docs/logos/lsapy/LSAPy_Logo_Dark.png +0 -0
  34. {lsapy-0.3.0 → lsapy-0.3.1}/docs/logos/lsapy/LSAPy_Logo_FullColour.png +0 -0
  35. {lsapy-0.3.0 → lsapy-0.3.1}/docs/logos/lsapy/LSAPy_Logo_FullColour.svg +0 -0
  36. {lsapy-0.3.0 → lsapy-0.3.1}/docs/logos/lsapy/LSAPy_Logo_FullDark.png +0 -0
  37. {lsapy-0.3.0 → lsapy-0.3.1}/docs/logos/lsapy/LSAPy_Logo_FullLight.png +0 -0
  38. {lsapy-0.3.0 → lsapy-0.3.1}/docs/logos/lsapy/LSAPy_Logo_Light.png +0 -0
  39. {lsapy-0.3.0 → lsapy-0.3.1}/docs/logos/lsapy/branding.md +0 -0
  40. {lsapy-0.3.0 → lsapy-0.3.1}/docs/make.bat +0 -0
  41. {lsapy-0.3.0 → lsapy-0.3.1}/docs/notebooks/criteria.ipynb +0 -0
  42. {lsapy-0.3.0 → lsapy-0.3.1}/docs/notebooks/functions.ipynb +0 -0
  43. {lsapy-0.3.0 → lsapy-0.3.1}/docs/notebooks/index.rst +0 -0
  44. {lsapy-0.3.0 → lsapy-0.3.1}/docs/notebooks/lsa.ipynb +0 -0
  45. {lsapy-0.3.0 → lsapy-0.3.1}/docs/readme.rst +0 -0
  46. {lsapy-0.3.0 → lsapy-0.3.1}/docs/references.bib +0 -0
  47. {lsapy-0.3.0 → lsapy-0.3.1}/docs/references.rst +0 -0
  48. {lsapy-0.3.0 → lsapy-0.3.1}/environment.yml +0 -0
  49. {lsapy-0.3.0 → lsapy-0.3.1}/noxfile.py +0 -0
  50. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/aggregate.py +0 -0
  51. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/core/__init__.py +0 -0
  52. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/core/formatting.py +0 -0
  53. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/core/functions.py +0 -0
  54. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/core/options.py +0 -0
  55. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/criteria.py +0 -0
  56. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/data/registry.txt +0 -0
  57. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/functions/__init__.py +0 -0
  58. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/functions/_discrete.py +0 -0
  59. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/functions/_suitability.py +0 -0
  60. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/lsa.py +0 -0
  61. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/stats.py +0 -0
  62. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/utils/__init__.py +0 -0
  63. {lsapy-0.3.0 → lsapy-0.3.1}/src/lsapy/utils/_utils.py +0 -0
  64. {lsapy-0.3.0 → lsapy-0.3.1}/tests/conftest.py +0 -0
  65. {lsapy-0.3.0 → lsapy-0.3.1}/tests/test_aggregate.py +0 -0
  66. {lsapy-0.3.0 → lsapy-0.3.1}/tests/test_criteria.py +0 -0
  67. {lsapy-0.3.0 → lsapy-0.3.1}/tests/test_formatting.py +0 -0
  68. {lsapy-0.3.0 → lsapy-0.3.1}/tests/test_functions.py +0 -0
  69. {lsapy-0.3.0 → lsapy-0.3.1}/tests/test_lsa.py +0 -0
  70. {lsapy-0.3.0 → lsapy-0.3.1}/tests/test_standardize.py +0 -0
  71. {lsapy-0.3.0 → lsapy-0.3.1}/tests/test_stats.py +0 -0
  72. {lsapy-0.3.0 → lsapy-0.3.1}/tests/test_utils.py +0 -0
@@ -2,7 +2,15 @@
2
2
  Changelog
3
3
  =========
4
4
 
5
- v0.3.0 (2025-10-11)
5
+ v0.3.1 (2025-11-14)
6
+ -------------------
7
+ Contributor to this version: Baptiste Hamon (@baptistehamon).
8
+
9
+ Bug fixes
10
+ ^^^^^^^^^
11
+ * The `np.vectorize` decorator has been removed of standardization functions to fix fitting functions issues (issue `#101 <https://github.com/baptistehamon/lsapy/issues/101>`_, PR `#102 <https://github.com/baptistehamon/lsapy/pull/102>`_).
12
+
13
+ v0.3.0 (2025-11-10)
6
14
  -------------------
7
15
  Contributor to this version: Baptiste Hamon (@baptistehamon).
8
16
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lsapy
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: A Python package for Land Suitability Analysis.
5
5
  Keywords: LSAPy,Land Suitability Analysis,Geospatial Analysis,GIS,Geography
6
6
  Author-email: Baptiste Hamon <baptiste.hamon@pg.canterbury.ac.nz>
@@ -83,7 +83,7 @@ Issues = "https://github.com/baptistehamon/lsapy/issues"
83
83
  Zenodo = "https://doi.org/10.5281/zenodo.15015110"
84
84
 
85
85
  [tool.bumpversion]
86
- current_version = "0.3.0"
86
+ current_version = "0.3.1"
87
87
  commit = true
88
88
  commit_args = "--no-verify --signoff"
89
89
  tag = false
@@ -6,4 +6,4 @@ from lsapy.lsa import LandSuitabilityAnalysis
6
6
 
7
7
  __author__ = "Baptiste Hamon"
8
8
  __email__ = "baptiste.hamon@pg.canterbury.ac.nz"
9
- __version__ = "0.3.0"
9
+ __version__ = "0.3.1"
@@ -281,14 +281,14 @@ def fit_membership(x, y=None, fit_on: str | list[str] = "all", plot: bool = Fals
281
281
  --------
282
282
  >>> from lsapy.functions.membership import fit_membership
283
283
  >>> fit_membership([1, 3, 5, 7, 10]) # doctest: +ELLIPSIS
284
- (<numpy.vectorize object at 0x...>, array([1., 5.]))
284
+ (<function vetharaniam2022_eq5 at 0x...>, array([-2.789..., 4.864...]))
285
285
 
286
286
  By default, the function will fit all available membership equations. If you want to fit only specific equations,
287
287
  you can specify it using the `fit_on` parameter: "all", "sigmoid_like", "gaussian_like", or a list of equations.
288
288
  The default `y` values can also be changed.
289
289
 
290
290
  >>> fit_membership(x=[1, 3, 5, 5, 7, 9], y=[0, 0.5, 1, 1, 0.5, 0], fit_on="gaussian_like") # doctest: +ELLIPSIS
291
- (<numpy.vectorize object at 0x...>, array([0.667..., 4.941..., 0.846...]))
291
+ (<function vetharaniam2024_eq10 at 0x...>, array([0.382..., 4.972..., 0.939...]))
292
292
  """
293
293
  if y is None:
294
294
  y = [0, 0.25, 0.5, 0.75, 1]
@@ -68,7 +68,6 @@ def boolean(x, op: str, thresh: int | float, skipna: bool = True):
68
68
 
69
69
 
70
70
  @declare_equation("categorical")
71
- @np.vectorize(otypes=[np.float32])
72
71
  def discrete(x, rules: dict[str | int, int | float]) -> np.ndarray:
73
72
  """
74
73
  Discrete function.
@@ -88,12 +87,11 @@ def discrete(x, rules: dict[str | int, int | float]) -> np.ndarray:
88
87
  np.ndarray
89
88
  Mapped output values.
90
89
  """
91
- return rules.get(x, np.nan)
90
+ return np.vectorize(rules.get)(x, np.nan)
92
91
 
93
92
 
94
93
  @declare_equation("sigmoid")
95
- @np.vectorize(otypes=[np.float32])
96
- def logistic(x, a, b):
94
+ def logistic(x, a, b) -> np.ndarray:
97
95
  r"""
98
96
  Logistic function capped to 1.
99
97
 
@@ -122,11 +120,11 @@ def logistic(x, a, b):
122
120
 
123
121
  f(x) = \frac{1}{1 + e^{-a(x - b)}}
124
122
  """
125
- return 1 / (1 + np.exp(-a * (x - b)))
123
+ return 1 / (1 + np.exp(-a * np.subtract(x, b)))
126
124
 
127
125
 
128
126
  @declare_equation("sigmoid")
129
- def sigmoid(x):
127
+ def sigmoid(x) -> np.ndarray:
130
128
  r"""
131
129
  Logistic sigmoid function.
132
130
 
@@ -159,8 +157,7 @@ def sigmoid(x):
159
157
 
160
158
 
161
159
  @declare_equation("sigmoid", "VTR22_eq3")
162
- @np.vectorize(otypes=[np.float32])
163
- def vetharaniam2022_eq3(x, a, b):
160
+ def vetharaniam2022_eq3(x, a, b) -> np.ndarray:
164
161
  r"""
165
162
  Sigmoid like function.
166
163
 
@@ -200,12 +197,11 @@ def vetharaniam2022_eq3(x, a, b):
200
197
  ----------
201
198
  :cite:cts:`vetharaniam_lsa_2022`
202
199
  """
203
- return np.exp(a * (x - b)) / (1 + np.exp(a * (x - b)))
200
+ return np.exp(a * np.subtract(x, b)) / (1 + np.exp(a * np.subtract(x, b)))
204
201
 
205
202
 
206
203
  @declare_equation("sigmoid", "VTR22_eq5")
207
- @np.vectorize(otypes=[np.float32])
208
- def vetharaniam2022_eq5(x, a, b):
204
+ def vetharaniam2022_eq5(x, a, b) -> np.ndarray:
209
205
  r"""
210
206
  Sigmoid like function.
211
207
 
@@ -243,8 +239,7 @@ def vetharaniam2022_eq5(x, a, b):
243
239
 
244
240
 
245
241
  @declare_equation("gaussian", "VTR24_eq8")
246
- @np.vectorize(otypes=[np.float32])
247
- def vetharaniam2024_eq8(x, a, b, c):
242
+ def vetharaniam2024_eq8(x, a, b, c) -> np.ndarray:
248
243
  r"""
249
244
  Gaussian like function.
250
245
 
@@ -280,12 +275,11 @@ def vetharaniam2024_eq8(x, a, b, c):
280
275
  ----------
281
276
  :cite:cts:`vetharaniam_lsa_2024`
282
277
  """
283
- return np.exp(-a * np.power(x - b, c))
278
+ return np.exp(-a * np.power(np.subtract(x, b), c))
284
279
 
285
280
 
286
281
  @declare_equation("gaussian", "VTR24_eq10")
287
- @np.vectorize(otypes=[np.float32])
288
- def vetharaniam2024_eq10(x, a, b, c):
282
+ def vetharaniam2024_eq10(x, a, b, c) -> np.ndarray:
289
283
  r"""
290
284
  Gaussian like function.
291
285
 
@@ -97,7 +97,7 @@ class TestFit:
97
97
  x = [-10, -6.5, -5, -3.5, 0]
98
98
  f, p = std.fit(x, kind="all", plot=True)
99
99
  assert f == std.logistic
100
- np.testing.assert_array_almost_equal(p, [0.91, -5.0], decimal=2)
100
+ np.testing.assert_array_almost_equal(p, [0.76, -5.0], decimal=2)
101
101
 
102
102
  def test_skipped(self):
103
103
  with pytest.warns(UserWarning, match="No methods to fit. Skipping: vetharaniam2024_eq8, vetharaniam2024_eq10."):
@@ -98,7 +98,7 @@ class TestFitMembership:
98
98
  x = [-10, -6.5, -5, -3.5, 0]
99
99
  f, p = mbs.fit_membership(x, fit_on="all", plot=True)
100
100
  assert f == std.logistic
101
- np.testing.assert_array_almost_equal(p, [0.91, -5.0], decimal=2)
101
+ np.testing.assert_array_almost_equal(p, [0.76, -5.0], decimal=2)
102
102
 
103
103
  def test_skipped(self):
104
104
  with pytest.warns(UserWarning, match="No methods to fit. Skipping: vetharaniam2024_eq8, vetharaniam2024_eq10."):
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes