Skip to content

Commit

Permalink
Fix/docstring warnings (NeuralEnsemble#478)
Browse files Browse the repository at this point in the history
* fix headings for release notes, elephant versions > 0.10.0

* fixed warnings on build html for asset docstring

* fixed warnings on build html for causality.granger docstring

* fixed warnings on build html for cell_assembly_detection docstring

* more fixes

* fixed indentation errors

* fixed import errors

* Apply suggestions from code review

Co-authored-by: Michael Denker <m.denker@fz-juelich.de>

* removed 'binsize', deprecated, use 'bin_size'

* removed deprecation for __init__

* added template for gpfa

* overline for heading in install.rst

* remove template for gpfa

* increase timeout for urlopen

* remove unused variable

* change context for urlopen

* remove timeout

* fix typo

* add template for GPFA class

* fix math expression

---------

Co-authored-by: Michael Denker <m.denker@fz-juelich.de>
  • Loading branch information
Moritz-Alexander-Kern and mdenker committed Feb 16, 2023
1 parent eb9f00e commit b6f8440
Show file tree
Hide file tree
Showing 18 changed files with 183 additions and 134 deletions.
7 changes: 7 additions & 0 deletions doc/_templates/autosummary/gpfa_class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:special-members: __contains__,__getitem__,__iter__,__len__,__add__,__sub__,__mul__,__div__,__neg__
:members:
30 changes: 30 additions & 0 deletions doc/_templates/autosummary/spike_train_generation_class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}

{% block methods %}

{% if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
{%- if item not in ["process_operational_time","isi_generator"] %}
~{{ name }}.{{ item }}
{%- endif %}
{%- endfor %}
{% endif %}
{% endblock %}
100 changes: 54 additions & 46 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Elephant documentation build configuration file, created by
# sphinx-quickstart on Wed Feb 5 17:11:26 2014.
#
# This file is execfile()d with the current directory set to its containing dir.
# This file is execfile()d with the current directory set to its containing
# dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
Expand All @@ -21,11 +22,11 @@
sys.path.insert(0, '..')

# -- General configuration -----------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be extensions
# Add any Sphinx extension module names here, as strings. They can be
# extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
Expand All @@ -43,13 +44,13 @@
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ['_templates/autosummary']

# The suffix of source filenames.
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
Expand All @@ -75,13 +76,13 @@

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand All @@ -90,25 +91,26 @@
'**.ipynb_checkpoints',
]

# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# The reST default role (used for this markup: `text`) to use for all
# documents.
# default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# modindex_common_prefix = []

# Only execute Jupyter notebooks that have no evaluated cells
nbsphinx_execute = 'auto'
Expand All @@ -129,6 +131,10 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'alabaster'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
'font_family': 'Arial',
'page_width': '1200px', # default is 940
Expand All @@ -137,11 +143,11 @@
}

# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# html_theme_path = []

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# html_title = None

# A shorter title for the navigation bar. Default is the same as html_title.
html_short_title = None
Expand All @@ -162,30 +168,30 @@

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# html_additional_pages = {}

# If false, no module index is generated.
#html_domain_indices = True
# html_domain_indices = True

# If false, no index is generated.
html_use_index = True

# If true, the index is split into individual pages for each letter.
#html_split_index = False
# html_split_index = False

# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# html_show_sourcelink = True

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
html_show_sphinx = False
Expand All @@ -196,10 +202,10 @@
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# html_use_opensearch = ''

# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'elephantdoc'
Expand Down Expand Up @@ -231,31 +237,32 @@
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
('index', 'elephant.tex', u'Elephant Documentation',
authors, 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# latex_use_parts = False

# If true, show page references after internal links.
#latex_show_pagerefs = False
# latex_show_pagerefs = False

# If true, show URL addresses after external links.
#latex_show_urls = False
# latex_show_urls = False

# Documents to append as an appendix to all manuals.
#latex_appendices = []
# latex_appendices = []

# If false, no module index is generated.
#latex_domain_indices = True
# latex_domain_indices = True


# -- Options for manual page output --------------------------------------
Expand All @@ -268,7 +275,7 @@
]

# If true, show URL addresses after external links.
#man_show_urls = False
# man_show_urls = False


# -- Options for Texinfo output ------------------------------------------
Expand All @@ -287,13 +294,13 @@
]

# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# texinfo_appendices = []

# If false, no module index is generated.
#texinfo_domain_indices = True
# texinfo_domain_indices = True

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# texinfo_show_urls = 'footnote'


# -- Options for Epub output ---------------------------------------------
Expand All @@ -306,37 +313,37 @@

# The language of the text. It defaults to the language option
# or en if the language is not set.
#epub_language = ''
# epub_language = ''

# The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = ''
# epub_scheme = ''

# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#epub_identifier = ''
# epub_identifier = ''

# A unique identification for the text.
#epub_uid = ''
# epub_uid = ''

# A tuple containing the cover image and cover page html template filenames.
#epub_cover = ()
# epub_cover = ()

# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_pre_files = []
# epub_pre_files = []

# HTML files shat should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_post_files = []
# epub_post_files = []

# A list of files that should not be packed into the epub file.
#epub_exclude_files = []
# epub_exclude_files = []

# The depth of the table of contents in toc.ncx.
#epub_tocdepth = 3
# epub_tocdepth = 3

# Allow duplicate toc entries.
#epub_tocdup = True
# epub_tocdup = True


# configuration for intersphinx: refer to Viziphant
Expand All @@ -345,6 +352,7 @@
'numpy': ('https://numpy.org/doc/stable', None)
}


# The name of math_renderer extension for HTML output.
html_math_renderer = 'mathjax'

Expand Down
5 changes: 3 additions & 2 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,10 @@ You can have one, both, or none installed in your system.
unresponsive until the compute program terminates.

.. _no-compile-spade:
***********

****************************
Resolving compilation issues
***********
****************************

Some modules in Elephant make use of C extensions to speed up computation.
However, those extensions need to be compiled before use. In some cases, this
Expand Down
10 changes: 6 additions & 4 deletions elephant/asset/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,7 @@ def intersection_matrix(self, normalization=None):
* 'intersection': `len(intersection(s_i, s_j))`
* 'mean': `sqrt(len(s_1) * len(s_2))`
* 'union': `len(union(s_i, s_j))`
Default: None
Returns
Expand Down Expand Up @@ -2029,9 +2030,9 @@ def probability_matrix_montecarlo(self, n_surrogates, imat=None,
If None, the output of :func:`ASSET.intersection_matrix` is used.
Default: None
surrogate_method : {'dither_spike_train', 'dither_spikes',
'jitter_spikes',
'randomise_spikes', 'shuffle_isis',
'joint_isi_dithering'}, optional
'jitter_spikes', 'randomise_spikes', 'shuffle_isis',
'joint_isi_dithering'}, optional
The method to generate surrogate spike trains. Refer to the
:func:`spike_train_surrogates.surrogates` documentation for more
information about each surrogate method. Note that some of these
Expand Down Expand Up @@ -2305,9 +2306,10 @@ def joint_probability_matrix(self, pmat, filter_shape, n_largest,
precision : {'float', 'double'}, optional
Single or double floating-point precision for the resulting `jmat`
matrix.
* `'float'`: 32 bits; the tolerance error is ``≲1e-3``.
* `'float'`: 32 bits; the tolerance error is ``≲1e-3``.
* `'double'`: 64 bits; the tolerance error is ``<1e-5``.
Double floating-point precision is typically x4 times slower than
the single floating-point equivalent.
Default: 'float'
Expand Down
12 changes: 8 additions & 4 deletions elephant/causality/granger.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,10 @@ def pairwise_granger(signals, max_order, information_criterion='aic'):
Maximal order of autoregressive model.
information_criterion : {'aic', 'bic'}, optional
A function to compute the information criterion:
`bic` for Bayesian information_criterion,
`aic` for Akaike information criterion,
* `bic` for Bayesian information_criterion,
* `aic` for Akaike information criterion,
Default: 'aic'
Returns
Expand Down Expand Up @@ -538,8 +540,10 @@ def conditional_granger(signals, max_order, information_criterion='aic'):
Maximal order of autoregressive model.
information_criterion : {'aic', 'bic'}, optional
A function to compute the information criterion:
`bic` for Bayesian information_criterion,
`aic` for Akaike information criterion,
* `bic` for Bayesian information_criterion,
* `aic` for Akaike information criterion,
Default: 'aic'
Returns
Expand Down

0 comments on commit b6f8440

Please sign in to comment.