| 1 | # |
| 2 | # scikit-rf (aka skrf) documentation build configuration file |
| 3 | # |
| 4 | |
| 5 | # -- Project information ----------------------------------------------------- |
| 6 | |
| 7 | project = 'scikit-rf' |
| 8 | copyright = '2025, scikit-rf team' |
| 9 | author = 'scikit-rf team' |
| 10 | |
| 11 | # -- General configuration --------------------------------------------------- |
| 12 | |
| 13 | import os |
| 14 | import sys |
| 15 | import warnings |
| 16 | |
| 17 | warnings.filterwarnings('ignore') |
| 18 | |
| 19 | # If extensions (or modules to document with autodoc) are in another directory, |
| 20 | # add these directories to sys.path here. If the directory is relative to the |
| 21 | # documentation root, use os.path.abspath to make it absolute, like shown here. |
| 22 | sys.path.insert(0, os.path.abspath('../../')) |
| 23 | |
| 24 | import skrf as rf |
| 25 | |
| 26 | rf.setup_pylab() |
| 27 | |
| 28 | # Add any Sphinx extension module names here, as strings. They can be |
| 29 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 30 | # ones. |
| 31 | |
| 32 | # Add any Sphinx extension module names here, as strings. They can be extensions |
| 33 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. |
| 34 | sys.path.insert(0, os.path.abspath('../sphinxext')) |
| 35 | |
| 36 | extensions = [ |
| 37 | 'sphinx.ext.autodoc', |
| 38 | 'sphinx.ext.autosectionlabel', |
| 39 | 'sphinx.ext.autosummary', |
| 40 | 'sphinx.ext.napoleon', |
| 41 | 'sphinx.ext.mathjax', |
| 42 | 'sphinx.ext.viewcode', |
| 43 | 'sphinx.ext.intersphinx', |
| 44 | 'sphinx_rtd_theme', |
| 45 | 'nbsphinx', |
| 46 | #'inheritance_diagram', |
| 47 | 'IPython.sphinxext.ipython_directive', |
| 48 | 'IPython.sphinxext.ipython_console_highlighting', |
| 49 | ] |
| 50 | |
| 51 | # Napoleon settings |
| 52 | napoleon_google_docstring = True |
| 53 | napoleon_numpy_docstring = True |
| 54 | napoleon_include_init_with_doc = False |
| 55 | napoleon_include_private_with_doc = False |
| 56 | napoleon_include_special_with_doc = True |
| 57 | napoleon_use_admonition_for_examples = False |
| 58 | napoleon_use_admonition_for_notes = False |
| 59 | napoleon_use_admonition_for_references = False |
| 60 | napoleon_use_ivar = False |
| 61 | napoleon_use_param = True |
| 62 | napoleon_use_rtype = True |
| 63 | |
| 64 | # NBsphinx settings |
| 65 | nbsphinx_execute = 'always' |
| 66 | nbsphinx_allow_errors = True |
| 67 | nbsphinx_kernel_name = 'python' |
| 68 | numpydoc_show_class_members = False |
| 69 | nbsphinx_timeout = 180 |
| 70 | |
| 71 | # Autodoc settings |
| 72 | autodoc_typehints = "description" |
| 73 | |
| 74 | # Add any paths that contain templates here, relative to this directory. |
| 75 | templates_path = ['_templates'] |
| 76 | |
| 77 | # The suffix of source filenames. |
| 78 | source_suffix = '.rst' |
| 79 | |
| 80 | # The master toctree document. |
| 81 | master_doc = 'index' |
| 82 | |
| 83 | # List of patterns, relative to source directory, that match files and |
| 84 | # directories to ignore when looking for source files. |
| 85 | # This pattern also affects html_static_path and html_extra_path. |
| 86 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', "**/*.rst.rst", '**.ipynb_checkpoints'] |
| 87 | |
| 88 | # The name of the Pygments (syntax highlighting) style to use. |
| 89 | pygments_style = 'sphinx' |
| 90 | |
| 91 | |
| 92 | # -- Options for HTML output --------------------------------------------------- |
| 93 | |
| 94 | # The theme to use for HTML and HTML Help pages. See the documentation for |
| 95 | # a list of builtin themes. |
| 96 | |
| 97 | # Theme options are theme-specific and customize the look and feel of a theme |
| 98 | # further. For a list of options available for each theme, see the |
| 99 | # documentation. |
| 100 | |
| 101 | html_theme = "sphinx_rtd_theme" |
| 102 | |
| 103 | # Add any paths that contain custom themes here, relative to this directory. |
| 104 | # html_theme_path = [] |
| 105 | |
| 106 | # The name for this set of Sphinx documents. If None, it defaults to |
| 107 | # "<project> v<release> documentation". |
| 108 | html_title = 'scikit-rf Documentation' |
| 109 | |
| 110 | # A shorter title for the navigation bar. Default is the same as html_title. |
| 111 | html_short_title = html_title |
| 112 | |
| 113 | # The name of an image file (relative to this directory) to place at the top |
| 114 | # of the sidebar. |
| 115 | #html_logo = 'scikit-rf-logo-flat.svg' |
| 116 | #html_logo = '_static/scikit-rf-logo-flat-docs.svg' |
| 117 | |
| 118 | # The name of an image file (within the static path) to use as favicon of the |
| 119 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 |
| 120 | # pixels large. |
| 121 | #html_favicon = None |
| 122 | |
| 123 | # Add any paths that contain custom static files (such as style sheets) here, |
| 124 | # relative to this directory. They are copied after the builtin static files, |
| 125 | # so a file named "default.css" will overwrite the builtin "default.css". |
| 126 | html_static_path = ['_static'] |
| 127 | |
| 128 | # Output file base name for HTML help builder. |
| 129 | htmlhelp_basename = 'skrfdoc' |
| 130 | |
| 131 | |
| 132 | # -- Options for LaTeX output -------------------------------------------------- |
| 133 | |
| 134 | # The paper size ('letter' or 'a4'). |
| 135 | #latex_paper_size = 'letter' |
| 136 | |
| 137 | # The font size ('10pt', '11pt' or '12pt'). |
| 138 | #latex_font_size = '10pt' |
| 139 | |
| 140 | # Grouping the document tree into LaTeX files. List of tuples |
| 141 | # (source start file, target name, title, author, documentclass [howto/manual]). |
| 142 | latex_documents = [ |
| 143 | ('index', 'scikit-rf.tex', 'scikit-rf Documentation', |
| 144 | 'scikit-rf Developers', 'manual'), |
| 145 | ] |
| 146 | |
| 147 | # The name of an image file (relative to this directory) to place at the top of |
| 148 | # the title page. |
| 149 | latex_logo = '_static/scikit-rf-title-flat.pdf' |
| 150 | |
| 151 | # For "manual" documents, if this is true, then toplevel headings are parts, |
| 152 | # not chapters. |
| 153 | #latex_use_parts = False |
| 154 | |
| 155 | # If true, show page references after internal links. |
| 156 | #latex_show_pagerefs = False |
| 157 | |
| 158 | # If true, show URL addresses after external links. |
| 159 | #latex_show_urls = False |
| 160 | |
| 161 | # Additional stuff for the LaTeX preamble. |
| 162 | latex_preamble = r'\usepackage{epstopdf}' |
| 163 | |
| 164 | # Documents to append as an appendix to all manuals. |
| 165 | #latex_appendices = [] |
| 166 | |
| 167 | # If false, no module index is generated. |
| 168 | #latex_domain_indices = True |
| 169 | |
| 170 | autosummary_generate = True |
| 171 | |
| 172 | # -- Options for manual page output -------------------------------------------- |
| 173 | |
| 174 | # One entry per manual page. List of tuples |
| 175 | # (source start file, name, description, authors, manual section). |
| 176 | man_pages = [ |
| 177 | ('index', 'scikit-rf', 'scikit-rf Documentation', |
| 178 | ['alex arsenovic'], 1) |
| 179 | ] |
| 180 | |
| 181 | |
| 182 | # Example configuration for intersphinx: refer to the Python standard library. |
| 183 | intersphinx_mapping = { |
| 184 | 'python': ('https://docs.python.org/3', None), |
| 185 | 'numpy': ('https://numpy.org/doc/stable', None), |
| 186 | 'pd': ('https://pandas.pydata.org/docs', None), |
| 187 | 'scipy': ('https://docs.scipy.org/doc/scipy/', None), |
| 188 | } |
| 189 | |
| 190 | def process_signature(app, what, name, obj, options, signature, return_annotation): |
| 191 | |
| 192 | func_name = name.split(".")[-1] |
| 193 | if func_name.startswith("plot_") and func_name[5:] in rf.Network._generated_functions().keys(): |
| 194 | signature = signature.split(",")[2:] |
| 195 | return "(" + ", ".join(signature), return_annotation |
| 196 | |
| 197 | return signature, return_annotation |
| 198 | |
| 199 | def setup(app): |
| 200 | app.connect("autodoc-process-signature", process_signature) |