Skip to content

Commit

Permalink
match filter improved. template normalisation include removing mean. …
Browse files Browse the repository at this point in the history
…docs improved with linked code
  • Loading branch information
pravirkr committed Sep 15, 2024
1 parent 4506dd4 commit 5377cb5
Show file tree
Hide file tree
Showing 10 changed files with 714 additions and 326 deletions.
9 changes: 9 additions & 0 deletions docs/api/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
:show-inheritance:
```

## sigpyproc.core.filters

```{eval-rst}
.. automodule:: sigpyproc.core.filters
:members:
:undoc-members:
:show-inheritance:
```

## sigpyproc.core.rfi

```{eval-rst}
Expand Down
66 changes: 51 additions & 15 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.

from __future__ import annotations

import datetime
import inspect
import os
import sys
from importlib import import_module
from importlib.metadata import version as meta_version
from pathlib import Path

Expand All @@ -26,21 +31,23 @@
version = meta_version("sigpyproc")
release = version
master_doc = "index"
repo_url = "https://github.com/FRBs/sigpyproc3"

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

# 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",
"numpydoc",
"sphinx_autodoc_typehints",
"sphinx.ext.coverage",
"sphinx.ext.intersphinx",
"sphinx.ext.linkcode",
"sphinx_click",
"sphinx-prompt",
"sphinx_copybutton",
"numpydoc",
"myst_nb",
"jupyter_sphinx",
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -62,60 +69,58 @@
# a list of builtin themes.

html_theme = "sphinx_book_theme"
html_context = {"default_mode": "light"}
html_title = project
html_theme_options = {
"repository_url": "https://github.com/FRBs/sigpyproc3",
"repository_url": repo_url,
"use_repository_button": True,
"use_issues_button": True,
"use_download_button": True,
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# \html_static_path = ["_static"]

# -- Extension configuration -------------------------------------------------

autoclass_content = "class" # include both class docstring and __init__
autodoc_member_order = "bysource"
autodoc_typehints = "none"
autodoc_inherit_docstrings = True

typehints_document_rtype = False

numpydoc_use_plots = True
numpydoc_class_members_toctree = False
numpydoc_show_class_members = False
numpydoc_show_inherited_class_members = False
numpydoc_class_members_toctree = False
numpydoc_xref_param_type = True
numpydoc_xref_aliases = {
"ndarray": "numpy.ndarray",
"dtype": "numpy.dtype",
"ArrayLike": "numpy.typing.ArrayLike",
"plt": "matplotlib.pyplot",
"Figure": "matplotlib.figure.Figure",
"scipy": "scipy",
"astropy": "astropy",
"attrs": "attrs",
"Path": "pathlib.Path",
"Buffer": "typing_extensions.Buffer",
"Iterator": "collections.abc.Iterator",
"Callable": "collections.abc.Callable",
"Literal": "typing.Literal",
}
numpydoc_xref_ignore = {
"of",
"or",
"shape",
"type",
"optional",
"scalar",
"default",
}


coverage_show_missing_items = True

myst_enable_extensions = ["colon_fence"]
myst_enable_extensions = ["colon_fence", "deflist", "dollarmath", "amsmath"]

nb_execution_mode = "auto"
nb_execution_timeout = -1

copybutton_prompt_text = ">>> "

# -- Options for intersphinx extension ---------------------------------------

intersphinx_mapping = {
Expand All @@ -127,3 +132,34 @@
"matplotlib": ("https://matplotlib.org/stable/", None),
"typing_extensions": ("https://typing-extensions.readthedocs.io/en/stable/", None),
}

# -- Linkcode configuration --------------------------------------------------


def linkcode_resolve(domain: str, info: dict) -> str | None:
"""Point to the source code repository, file and line number."""
if domain != "py" or not info["module"]:
return None
try:
mod = import_module(info["module"])
if "." in info["fullname"]:
objname, attrname = info["fullname"].split(".")
obj = getattr(getattr(mod, objname), attrname)
else:
obj = getattr(mod, info["fullname"])

file = inspect.getsourcefile(obj)
lines, start_line = inspect.getsourcelines(obj)
except (TypeError, AttributeError, ImportError):
return None

if not file or not lines:
return None
file_path = Path(file).resolve().relative_to(Path("..").resolve())
end_line = start_line + len(lines) - 1

# Determine the branch based on RTD version
rtd_version = os.getenv("READTHEDOCS_VERSION", "latest")
github_branch = "develop" if rtd_version == "develop" else "main"

return f"{repo_url}/blob/{github_branch}/{file_path}#L{start_line}-L{end_line}"
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies = [
"attrs",
"click",
"rich",
"rocket-fft",
"bidict",
"typing_extensions",
]
Expand All @@ -58,9 +59,9 @@ docs = [
"sphinx-click",
"sphinx-prompt",
"sphinx-copybutton",
"sphinx-autodoc-typehints",
"myst-nb",
"numpydoc",
"myst-nb",
"jupyter_sphinx",
]
develop = ["ruff"]

Expand Down Expand Up @@ -89,7 +90,7 @@ indent-style = "space"

[tool.ruff.lint]
select = ["ALL"]
ignore = ["D1", "ANN1", "PLR2004", "G004"]
ignore = ["D1", "D301", "ANN1", "PLR2004", "G004"]

[tool.ruff.lint.pylint]
max-args = 15
Expand Down
8 changes: 2 additions & 6 deletions sigpyproc/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@


class FilterbankBlock:
"""An array class to handle a discrete block of data in time-major order.
"""
An array class to handle a discrete block of data in time-major order.
Parameters
----------
Expand All @@ -19,11 +20,6 @@ class FilterbankBlock:
header object containing metadata
dm : float, optional
DM of the input_array, by default 0
Returns
-------
:py:obj:`~numpy.ndarray`
2 dimensional array of shape (nchans, nsamples) with header metadata
"""

def __init__(self, data: np.ndarray, hdr: Header, dm: float = 0) -> None:
Expand Down
Loading

0 comments on commit 5377cb5

Please sign in to comment.