Skip to content

Commit

Permalink
Merge pull request #158 from pysal/docsupdate
Browse files Browse the repository at this point in the history
update docs
  • Loading branch information
knaaptime authored Dec 29, 2020
2 parents 0236651 + 1a53534 commit aa3b4cc
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 32 deletions.
46 changes: 45 additions & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ API reference

Aspatial Indices
---------------------

.. currentmodule:: segregation

.. autosummary::
:toctree: generated/

Expand All @@ -26,6 +29,9 @@ Aspatial Indices

Spatial Indices
---------------------

.. currentmodule:: segregation

.. autosummary::
:toctree: generated/

Expand All @@ -44,9 +50,22 @@ Spatial Indices
spatial.AbsoluteCentralization
spatial.RelativeCentralization
spatial.SpatialMinMax


Multi-Scalar Spatial Measures
----------------------------------

.. currentmodule:: segregation

.. autosummary::
:toctree: generated/

spatial.compute_segregation_profile

Multigroup Indices
---------------------

.. currentmodule:: segregation

.. autosummary::
:toctree: generated/

Expand All @@ -63,6 +82,9 @@ Multigroup Indices

Local Indices
---------------------

.. currentmodule:: segregation

.. autosummary::
:toctree: generated/

Expand All @@ -75,6 +97,9 @@ Local Indices

Batch Compute Wrappers
---------------------

.. currentmodule:: segregation

.. autosummary::
:toctree: generated/

Expand All @@ -84,6 +109,9 @@ Batch Compute Wrappers

Inference Wrappers
---------------------

.. currentmodule:: segregation

.. autosummary::
:toctree: generated/

Expand All @@ -92,15 +120,31 @@ Inference Wrappers

Decomposition
---------------------

.. currentmodule:: segregation

.. autosummary::
:toctree: generated/

decomposition.DecomposeSegregation

Network
---------------------

.. currentmodule:: segregation

.. autosummary::
:toctree: generated/

network.get_osm_network
network.calc_access

Util
----------------

.. currentmodule:: segregation

.. autosummary::
:toctree: generated/

util.project_gdf
21 changes: 16 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
'matplotlib.sphinxext.plot_directive']



# sphinx_gallery_conf = {
# # path to your examples scripts
# 'examples_dirs': '../examples',
Expand Down Expand Up @@ -146,7 +145,7 @@

# Global TOC depth for "site" navbar tab. (Default: 1)
# Switching to -1 shows all levels.
'globaltoc_depth': 2,
'globaltoc_depth': 1,

# Include hidden TOCs in Site navbar?
#
Expand Down Expand Up @@ -268,10 +267,11 @@

# Generate the API documentation when building
autosummary_generate = True
numpydoc_show_class_members = True
numpydoc_show_class_members = False
class_members_toctree = True
numpydoc_show_inherited_class_members = True
numpydoc_show_inherited_class_members = False
numpydoc_use_plots = True
numpydoc_xref_param_type = True

# display the source code for Plot directive
plot_include_source = True
Expand All @@ -280,4 +280,15 @@ def setup(app):
app.add_stylesheet("pysal-styles.css")

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/3.6/': None}
intersphinx_mapping = {
"esda": ("https://pysal.org/esda/", None),
"geopandas": ("https://geopandas.readthedocs.io/en/latest/", None),
"libpysal": ("https://pysal.org/libpysal/", None),
"matplotlib": ("https://matplotlib.org/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
"python": ("https://docs.python.org/3.9/", None),
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", None),
}

autodoc_default_options = {"members": True, "undoc-members": True}
47 changes: 21 additions & 26 deletions segregation/decomposition/decompose_segregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,35 +107,30 @@ class DecomposeSegregation:
to measure whether the differences between index measures arise from
differences in spatial structure or population structure
Examples
--------
Several examples can be found at https://github.com/pysal/segregation/blob/master/notebooks/decomposition_wrapper_example.ipynb.
"""
Parameters
----------
index1 : segregation.SegIndex class
First SegIndex class to compare.
index2 : segregation.SegIndex class
Second SegIndex class to compare.
counterfactual_approach : str, one of {"composition", "share", "dual_composition"}
The technique used to generate the counterfactual population
distributions.
def __init__(self, index1, index2, counterfactual_approach="composition"):
"""Decompose segregation differences into spatial and attribute components.
Attributes
----------
c_s : float
Shapley's Spatial Component of the decomposition
c_a : float
Shapley's Attribute Component of the decomposition
indices : dict
Dictionary of index values for all four combinations of spatial/attribute data
Given two segregation indices of the same type, use Shapley decomposition
to measure whether the differences between index measures arise from
differences in spatial structure or population structure
Parameters
----------
index1 : segregation.SegIndex class
First SegIndex class to compare.
index2 : segregation.SegIndex class
Second SegIndex class to compare.
counterfactual_approach : str, one of {"composition", "share", "dual_composition"}
The technique used to generate the counterfactual population
distributions.
Attributes
----------
c_s : float
Shapley's Spatial Component of the decomposition
c_a : float
Shapley's Attribute Component of the decomposition
"""
"""

def __init__(self, index1, index2, counterfactual_approach="composition"):
"""Initialize class."""
aux = _decompose_segregation(index1, index2, counterfactual_approach)

self.c_s = aux[0]
Expand Down

0 comments on commit aa3b4cc

Please sign in to comment.