Skip to content

Commit

Permalink
refactor the add nodes methods (#251)
Browse files Browse the repository at this point in the history
- Move the add_nodes method into a separate file and split the different node types into separate functions.
- Create separate functions for tasks that are shared across nodes.
- Remove the generic-input type. This will be replaced by custom nodes in a forthcoming PR.
  • Loading branch information
LegrandNico authored Nov 21, 2024
1 parent c4ab757 commit eb05544
Show file tree
Hide file tree
Showing 15 changed files with 612 additions and 595 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
language_version: python3
Expand All @@ -24,7 +24,7 @@ repos:
args: ['--ignore', 'D213,D100,D203,D104']
files: ^src/
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.11.2'
rev: 'v1.13.0'
hooks:
- id: mypy
files: ^src/
Expand Down
8 changes: 8 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@ and creates a standard node structure for these models.

HGF
Network
add_continuous_state
add_binary_state
add_ef_state
add_categorical_state
add_dp_state
get_couplings
update_parameters
insert_nodes

Plots
*****
Expand Down
20 changes: 10 additions & 10 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
# -- Project information -----------------------------------------------------

project = "pyhgf"
copyright = u"2022-{}, Nicolas Legrand".format(time.strftime("%Y"))
copyright = "2022-{}, Nicolas Legrand".format(time.strftime("%Y"))
author = "Nicolas Legrand"
release = pyhgf.__version__

nb_execution_timeout = 300

image_scrapers = ("matplotlib",)

bibtex_bibfiles = ['refs.bib']
bibtex_bibfiles = ["refs.bib"]
bibtex_reference_style = "author_year"
bibtex_default_style = "unsrt"

Expand Down Expand Up @@ -73,10 +73,10 @@
plot_html_show_source_link = False

source_suffix = {
'.rst': 'restructuredtext',
'.md': 'myst-nb',
'.ipynb': 'myst-nb',
'.myst': 'myst-nb',
".rst": "restructuredtext",
".md": "myst-nb",
".ipynb": "myst-nb",
".myst": "myst-nb",
}

# The master toctree document.
Expand Down Expand Up @@ -112,13 +112,13 @@
"logo": {
"text": "pyhgf",
},
"show_nav_level": 2
"show_nav_level": 2,
}

myst_enable_extensions = ["dollarmath", "colon_fence"]

html_sidebars = {
"api": [],
"cite": [],
"references": [],
"api": [],
"cite": [],
"references": [],
}
297 changes: 57 additions & 240 deletions docs/source/notebooks/0.3-Generalised_filtering.ipynb

Large diffs are not rendered by default.

24 changes: 23 additions & 1 deletion pyhgf/model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
from .add_nodes import (
add_binary_state,
add_categorical_state,
add_continuous_state,
add_dp_state,
add_ef_state,
get_couplings,
insert_nodes,
update_parameters,
)
from .network import Network

from .hgf import HGF # isort: skip

__all__ = ["HGF", "Network"]
__all__ = [
"HGF",
"Network",
"add_nodes",
"add_continuous_state",
"add_binary_state",
"add_ef_state",
"add_categorical_state",
"add_dp_state",
"get_couplings",
"update_parameters",
"insert_nodes",
]
Loading

0 comments on commit eb05544

Please sign in to comment.