Skip to content

Commit

Permalink
ENH: Remove Notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
User-DK committed Aug 25, 2024
1 parent b982d6d commit 767c618
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 230 deletions.
5 changes: 3 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'sphinx.ext.autosummary',
'sphinx.ext.viewcode',
'sphinx.ext.coverage',
'nbsphinx',
# 'nbsphinx',
'sphinxcontrib.bibtex',
'myst_nb',
'sphinx_copybutton',
Expand All @@ -26,7 +26,8 @@
bibtex_bibfiles = [
'refs.bib',
]
nbsphinx_execute = 'never'

jupyter_execute_notebooks = "auto"
autosummary_generate = True
numpydoc_show_class_members = False

Expand Down
143 changes: 0 additions & 143 deletions docs/examples/degrootmodel.ipynb

This file was deleted.

52 changes: 52 additions & 0 deletions docs/examples/degrootmodel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
jupytext:
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.16.4
kernelspec:
display_name: Python 3
language: python
name: python3
---

# DeGroot Model (Reaching Consensus)

+++

Import the packages

```{code-cell} ipython3
import pyseldonlib
import pathlib
import shutil
```

Initialize some other settings for the simulation

```{code-cell} ipython3
other_settings = pyseldonlib.Other_Settings(n_output_agents=10,
n_output_network= None,
print_progress= True,
output_initial=True,
start_output=1,
number_of_agents = 200,
connections_per_agent = 10)
```

Initialize the model with parameters.

```{code-cell} ipython3
model = pyseldonlib.DeGroot_Model(max_iterations=1000,
convergence_tol=1e-6,
rng_seed=120,
other_settings=other_settings)
output_dir_path = str("./output")
if pathlib.Path(output_dir_path).exists():
shutil.rmtree(output_dir_path)
model.run(output_dir_path)
if pathlib.Path(output_dir_path).exists():
shutil.rmtree(output_dir_path)
```
### On your local machine you can see a C++ std::out
83 changes: 0 additions & 83 deletions docs/examples/network.ipynb

This file was deleted.

38 changes: 38 additions & 0 deletions docs/examples/network.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
jupytext:
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.16.4
kernelspec:
display_name: Python 3
language: python
name: python3
---

# Example Usage of the Network Class from the pyseldonlib Package

```{code-cell} ipython3
# Import necessary modules
import pyseldonlib
```

```{code-cell} ipython3
# Initialize the Network object
network = pyseldonlib.Network(
model_string="DeGroot",
neighbour_list=[[1, 2], [0, 2], [0, 1], [4], [3]],
weight_list=[[0.5, 0.5], [0.5, 0.5], [0.5, 0.5], [1], [1]],
direction="Incoming"
)
```

```{code-cell} ipython3
# Print the network details
print(f"Number of agents: {network.n_agents}")
print(f"Edges of 1st index agent: {network.n_edges(1)}")
print(f"Direction: {network.get_direction}")
print(f"Neighbour List: {network.get_neighbours(1)}")
print(f"Weight List: {network.get_weights(1)}")
```
3 changes: 1 addition & 2 deletions visualisations/cytoscapenormalisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@
for target, weight in zip(indices_neighbours, weights):
writer.writerow([idx_agent, target.strip(), weight.strip()])

print("Edge list saved to edges.csv")

print("Edge list saved to edges.csv")

0 comments on commit 767c618

Please sign in to comment.