Skip to content

Commit a4f4ef6

Browse files
jGaboardiljwolf
andauthored
pruning down warnings/errors in make html (#394)
* pruning down warnings/errors in make html * remove pathlib import * add missing docs images * move notebook links to github --------- Co-authored-by: Levi John Wolf <[email protected]>
1 parent dc98f71 commit a4f4ef6

File tree

9 files changed

+42
-63
lines changed

9 files changed

+42
-63
lines changed

docs/_static/images/missipq.png

151 KB
Loading

docs/_static/images/mvmoran.png

120 KB
Loading
334 KB
Loading

docs/_static/references.bib

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,3 +304,14 @@ @article{wolf2024confounded
304304
pages={0-0},
305305
journal={Annals of the American Association of Geographers}
306306
}
307+
308+
@article{AnselinLi2019,
309+
title={{Operational Local Join Count Statistics for Cluster Detection}},
310+
author={Anselin, Luc and Li, Xun},
311+
journal={Journal of Geographical Systems},
312+
volume={21},
313+
number={2},
314+
pages={189--210},
315+
year={2019},
316+
publisher={Springer}
317+
}

docs/conf.py

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,5 @@
1-
# -*- coding: utf-8 -*-
2-
#
3-
# giddy documentation build configuration file, created by
4-
# sphinx-quickstart on Wed Jun 6 15:54:22 2018.
5-
#
6-
# This file is execfile()d with the current directory set to its
7-
# containing dir.
8-
#
9-
# Note that not all possible configuration values are present in this
10-
# autogenerated file.
11-
#
12-
# All configuration values have a default; values that are commented out
13-
# serve to show the default.
14-
15-
# If extensions (or modules to document with autodoc) are in another directory,
16-
# add these directories to sys.path here. If the directory is relative to the
17-
# documentation root, use os.path.abspath to make it absolute, like shown here.
18-
#
19-
import os
20-
import sys
21-
221
import sphinx_bootstrap_theme
232

24-
sys.path.insert(0, os.path.abspath("../"))
25-
263
# import your package to obtain the version info to display on the docs website
274
import esda # noqa E402
285

@@ -34,7 +11,7 @@
3411
# Add any Sphinx extension module names here, as strings. They can be
3512
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3613
# ones.
37-
extensions = [ # 'sphinx_gallery.gen_gallery',
14+
extensions = [
3815
"sphinx.ext.autodoc",
3916
"sphinx.ext.autosummary",
4017
"sphinx.ext.viewcode",
@@ -297,7 +274,7 @@ def setup(app):
297274

298275
# This is processed by Jinja2 and inserted before each notebook
299276
nbsphinx_prolog = r"""
300-
{% set docname = env.doc2path(env.docname, base='docsrc/') %}
277+
{% set docname = env.doc2path(env.docname, base=None) %}
301278
302279
.. only:: html
303280
@@ -308,9 +285,9 @@ def setup(app):
308285
309286
This page was generated from `{{ docname }}`__.
310287
Interactive online version:
311-
:raw-html:`<a href="https://mybinder.org/v2/gh/pysal/esda/master?filepath={{ docname }}"><img alt="Binder badge" src="https://mybinder.org/badge_logo.svg" style="vertical-align:text-bottom"></a>`
288+
:raw-html:`<a href="https://mybinder.org/v2/gh/pysal/esda/main?filepath={{ docname }}"><img alt="Binder badge" src="https://mybinder.org/badge_logo.svg" style="vertical-align:text-bottom"></a>`
312289
313-
__ https://github.com/pysal/esda/{{ docname }}
290+
__ https://github.com/pysal/esda/blob/main/{{ docname }}
314291
315292
316293
.. raw:: latex
@@ -335,6 +312,6 @@ def setup(app):
335312
"--InlineBackend.rc={'figure.dpi': 96}",
336313
]
337314

338-
mathjax_config = {
315+
mathjax3_config = {
339316
"TeX": {"equationNumbers": {"autoNumber": "AMS", "useLabelIds": True}},
340317
}

docs/index.rst

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ESDA is an open-source Python library for the exploratory analysis of spatial da
1010
<div class="container-fluid">
1111
<div class="row equal-height">
1212
<div class="col-12">
13-
<a href="https://nbviewer.org/github/pysal/esda/blob/main/notebooks/spatial_autocorrelation_for_areal_unit_data.ipynb" class="thumbnail">
13+
<a href="https://github.com/pysal/esda/blob/main/notebooks/spatial_autocorrelation_for_areal_unit_data.ipynb" class="thumbnail">
1414
<img src="_static/images/prices.png" class="img-fluid center-block w-100">
1515
<div class="caption text-center">
1616
<h6>Spatial Autocorrelation for continuous and discrete data</h6>
@@ -20,15 +20,15 @@ ESDA is an open-source Python library for the exploratory analysis of spatial da
2020
</div>
2121
<div class="row equal-height">
2222
<div class="col-6">
23-
<a href="https://nbviewer.org/github/pysal/esda/blob/main/notebooks/shape-measures.ipynb" class="thumbnail">
23+
<a href="https://github.com/pysal/esda/blob/main/notebooks/shape-measures.ipynb" class="thumbnail">
2424
<img src="_static/images/missipq.png" class="img-fluid center-block w-100">
2525
<div class="caption text-center">
2626
<h6>Shape Regularity Statistics</h6>
2727
</div>
2828
</a>
2929
</div>
3030
<div class="col-6">
31-
<a href="https://nbviewer.org/github/pysal/esda/blob/main/notebooks/geosilhouettes.ipynb" class="thumbnail">
31+
<a href="https://github.com/pysal/esda/blob/main/notebooks/geosilhouettes.ipynb" class="thumbnail">
3232
<img src="_static/images/silhouettes.png" class="img-fluid center-block w-100">
3333
<div class="caption text-center">
3434
<h6>Boundary and Region Statistics
@@ -39,7 +39,7 @@ ESDA is an open-source Python library for the exploratory analysis of spatial da
3939
</div>
4040
<div class='row equal-height'>
4141
<div class="col-6">
42-
<a href="https://nbviewer.org/github/pysal/esda/blob/main/notebooks/multivariable_moran.ipynb" class="thumbnail">
42+
<a href="https://github.com/pysal/esda/blob/main/notebooks/multivariable_moran.ipynb" class="thumbnail">
4343
<img src="_static/images/mvmoran.png" class="img-fluid center-block w-100">
4444
<div class="caption text-center">
4545
<h6>Multivariable Moran Statistics
@@ -48,7 +48,7 @@ ESDA is an open-source Python library for the exploratory analysis of spatial da
4848
</a>
4949
</div>
5050
<div class="col-6">
51-
<a href="https://nbviewer.org/github/pysal/esda/blob/main/notebooks/localjoincounts.ipynb" class="thumbnail">
51+
<a href="https://github.com/pysal/esda/blob/main/notebooks/localjoincounts.ipynb" class="thumbnail">
5252
<img src="_static/images/joincount.png" class="img-fluid center-block w-100">
5353
<div class="caption text-center">
5454
<h6>Discrete Spatial Autocorrelation with Join Counts
@@ -60,16 +60,6 @@ ESDA is an open-source Python library for the exploratory analysis of spatial da
6060
</div>
6161

6262

63-
.. toctree::
64-
:hidden:
65-
:maxdepth: 3
66-
:caption: Contents:
67-
68-
Installation <installation>
69-
API <api>
70-
Tutorial <tutorial>
71-
References <references>
72-
7363
************
7464
Introduction
7565
************

docs/tutorial.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ Tutorial
55
:maxdepth: 1
66
:caption: Contents:
77

8-
notebooks/spatialautocorrelation.ipynb
98
notebooks/localjoincounts.ipynb
109
notebooks/LOSH.ipynb
1110
notebooks/geosilhouettes.ipynb
1211
notebooks/adbscan_berlin_example.ipynb
1312
notebooks/shape-measures.ipynb
1413
notebooks/spatial_autocorrelation_for_areal_unit_data.ipynb
1514
notebooks/multivariable_moran.ipynb
15+
notebooks/correlogram.ipynb
16+
notebooks/topo.ipynb

esda/moran.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def __init__(
217217
self.EI_sim = sim.sum() / permutations
218218
self.seI_sim = np.array(sim).std()
219219
self.VI_sim = self.seI_sim**2
220-
with np.errstate(divide='ignore'):
220+
with np.errstate(divide="ignore"):
221221
self.z_sim = (self.I - self.EI_sim) / self.seI_sim
222222
if self.z_sim > 0:
223223
self.p_z_sim = stats.norm.sf(self.z_sim)
@@ -307,7 +307,7 @@ def by_col(
307307
documentation for the Moran statistic.
308308
309309
Returns
310-
--------
310+
-------
311311
If inplace, None, and operation is conducted on dataframe
312312
in memory. Otherwise, returns a copy of the dataframe with
313313
the relevant columns attached.
@@ -540,7 +540,7 @@ def __init__(self, x, y, w, transformation="r", permutations=PERMUTATIONS):
540540
self.EI_sim = sim.sum() / permutations
541541
self.seI_sim = np.array(sim).std()
542542
self.VI_sim = self.seI_sim**2
543-
with np.errstate(divide='ignore'):
543+
with np.errstate(divide="ignore"):
544544
self.z_sim = (self.I - self.EI_sim) / self.seI_sim
545545
if self.z_sim > 0:
546546
self.p_z_sim = stats.norm.sf(self.z_sim)
@@ -603,7 +603,7 @@ def by_col(
603603
documentation for the Moran_BV statistic.
604604
605605
Returns
606-
--------
606+
-------
607607
If inplace, None, and operation is conducted on dataframe
608608
in memory. Otherwise, returns a copy of the dataframe with
609609
the relevant columns attached.
@@ -1074,7 +1074,7 @@ def by_col(
10741074
documentation for the Moran_Rate statistic.
10751075
10761076
Returns
1077-
--------
1077+
-------
10781078
If inplace, None, and operation is conducted on dataframe
10791079
in memory. Otherwise, returns a copy of the dataframe with
10801080
the relevant columns attached.
@@ -1217,13 +1217,13 @@ class Moran_Local: # noqa: N801
12171217
variance of Is from permutations
12181218
EI : array
12191219
analytical expectation of Is under total permutation,
1220-
from :cite:`Anselin1995`. Is the same at each site,
1220+
from :cite:`Anselin95`. Is the same at each site,
12211221
and equal to the expectation of I itself when
12221222
transformation='r'. We recommend using EI_sim, not EI,
12231223
for analysis. This EI is only provided for reproducibility.
12241224
VI : array
12251225
analytical variance of Is under total permutation,
1226-
from :cite:`Anselin1995`. Varies according only to
1226+
from :cite:`Anselin95`. Varies according only to
12271227
cardinality. We recommend using VI_sim, not VI, for
12281228
analysis. This VI is only provided for reproducibility.
12291229
EIc : array
@@ -1350,7 +1350,7 @@ def __init__(
13501350
self.EI_sim = self.sim.mean(axis=0)
13511351
self.seI_sim = self.sim.std(axis=0)
13521352
self.VI_sim = self.seI_sim * self.seI_sim
1353-
with np.errstate(divide='ignore'):
1353+
with np.errstate(divide="ignore"):
13541354
self.z_sim = (self.Is - self.EI_sim) / self.seI_sim
13551355
self.p_z_sim = stats.norm.sf(np.abs(self.z_sim))
13561356
else:
@@ -1460,7 +1460,7 @@ def by_col(
14601460
documentation for the Moran_Local statistic.
14611461
14621462
Returns
1463-
--------
1463+
-------
14641464
If inplace, None, and operation is conducted on dataframe
14651465
in memory. Otherwise, returns a copy of the dataframe with
14661466
the relevant columns attached.
@@ -1828,7 +1828,7 @@ def __init__(
18281828
self.EI_sim = sim.mean(axis=0)
18291829
self.seI_sim = sim.std(axis=0)
18301830
self.VI_sim = self.seI_sim * self.seI_sim
1831-
with np.errstate(divide='ignore'):
1831+
with np.errstate(divide="ignore"):
18321832
self.z_sim = (self.Is - self.EI_sim) / self.seI_sim
18331833
self.p_z_sim = stats.norm.sf(np.abs(self.z_sim))
18341834

@@ -1899,7 +1899,7 @@ def by_col(
18991899
documentation for the Moran_Local_BV statistic.
19001900
19011901
Returns
1902-
--------
1902+
-------
19031903
If inplace, None, and operation is conducted on dataframe
19041904
in memory. Otherwise, returns a copy of the dataframe with
19051905
the relevant columns attached.
@@ -2284,7 +2284,7 @@ def by_col(
22842284
documentation for the Moran_Local_Rate statistic.
22852285
22862286
Returns
2287-
--------
2287+
-------
22882288
If inplace, None, and operation is conducted on dataframe
22892289
in memory. Otherwise, returns a copy of the dataframe with
22902290
the relevant columns attached.
@@ -2782,8 +2782,8 @@ def _wikh_fast(W, sokal_correction=False):
27822782
where this function is called, the defaults should always return
27832783
the version in the original :cite:`Anselin1995 paper`.
27842784
2785-
Arguments
2786-
---------
2785+
Parameters
2786+
----------
27872787
W : scipy sparse matrix
27882788
a sparse matrix describing the spatial relationships
27892789
between observations.
@@ -2806,7 +2806,7 @@ def _wikh_fast(W, sokal_correction=False):
28062806
def _wikh_numba(n, row, col, data, sokal_correction=False):
28072807
"""
28082808
This is a fast implementation of the wi(kh) function from
2809-
:cite:`Anselin1995`.
2809+
:cite:`Anselin95`.
28102810
28112811
This uses numpy to compute the outer product of each observation's
28122812
weights, after removing the w_ii entry. Then, the sum of the outer
@@ -2831,7 +2831,7 @@ def _wikh_numba(n, row, col, data, sokal_correction=False):
28312831
def _wikh_slow(W, sokal_correction=False):
28322832
"""
28332833
This is a slow implementation of the wi(kh) function from
2834-
:cite:`Anselin1995`
2834+
:cite:`Anselin95`
28352835
28362836
This does three nested for-loops over n, doing the literal operations
28372837
stated by the expression.

esda/silhouettes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def path_silhouette(
5858
5959
6060
Parameters
61-
-----------
61+
----------
6262
data : np.ndarray (N,P)
6363
matrix of data with N observations and P covariates.
6464
labels : np.ndarray (N,)
@@ -94,7 +94,7 @@ def path_silhouette(
9494
asymmetry is ignored.
9595
9696
Returns
97-
--------
97+
-------
9898
An (N_obs,) array of the path silhouette values for each observation.
9999
"""
100100
if not HAS_REQUIREMENTS:
@@ -427,7 +427,7 @@ def silhouette_alist(data, labels, alist, indices=None, metric=skp.euclidean_dis
427427
a function that takes an argument (data) and returns the all-pairs
428428
distances/dissimilarity between observations.
429429
430-
Results
430+
Returns
431431
-------
432432
pandas.DataFrame, copy of the adjacency list `alist`, with an additional
433433
column called `silhouette` that contains the pseudo-silhouette values

0 commit comments

Comments
 (0)