Skip to content

Commit

Permalink
docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
GJHSimmons committed Sep 4, 2024
1 parent 002f7b3 commit 2091a1e
Show file tree
Hide file tree
Showing 20 changed files with 44 additions and 565 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ jobs:
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material "mkdocstrings[python]"
- run: mkdocs gh-deploy --force
- run: pip install mkdocs-material "mkdocstrings[python]" mike
- name: Build Docs
run: mike deploy --push main
2 changes: 1 addition & 1 deletion docs/components/composite_ported_objects.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Defining composite models

A composite model consists of collections of functions and differential equations composed together by [functional substitution](functional_substitution.md) and [variable aggregation](variable_aggregation.md). Composite models in `psymple` are captured by [composite ported objects](../mathematics/ported_objects/#composite-ported-objects).
A composite model consists of collections of functions and differential equations composed together by [functional substitution](../mathematics/functional_substitution.md) and [variable aggregation](../mathematics/variable_aggregation.md). Composite models in `psymple` are captured by [composite ported objects](../mathematics/ported_objects.md/#composite-ported-objects).

The functions and differential equations to be composed come from ported objects added as children. The ports of these child objects are then connected to the ports of the parent ported object by [directed wires](../mathematics/functional_substitution.md/#implementation-detail) to capture functional substitution, and [variable wires](../mathematics/variable_aggregation.md/#implementation-detail) to capture variable aggregation.

Expand Down
4 changes: 2 additions & 2 deletions docs/components/functional_ported_objects.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Defining functions

Functions in `psymple` are captured by [functional ported objects](../mathematics/ported_objects/#functional-ported-objects). A system of multivariate functions of the form
Functions in `psymple` are captured by [functional ported objects](../mathematics/ported_objects.md/#functional-ported-objects). A system of multivariate functions of the form

$$
\underline{y} = \underline{f}(t, \underline{d})
$$

is captured by a functional ported object with a set of [parameter assignments](../mathematics/variables_parameters/#parameter-assignments) modelling $y_i = f_i(t,\underline{d}_i)$ for each $i$, where $\underline{d}_i \subseteq \underline{d}$.
is captured by a functional ported object with a set of [parameter assignments](../mathematics/variables_parameters.md/#parameter-assignments) modelling $y_i = f_i(t,\underline{d}_i)$ for each $i$, where $\underline{d}_i \subseteq \underline{d}$.

## Example

Expand Down
4 changes: 2 additions & 2 deletions docs/components/variable_ported_objects.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Defining ODEs

Differential equations in `psymple` are captured by [variable ported objects](../mathematics/ported_objects/#variable-ported-objects). A system of differential equations of the form
Differential equations in `psymple` are captured by [variable ported objects](../mathematics/ported_objects.md/#variable-ported-objects). A system of differential equations of the form

$$
\frac{d \underline{x}}{dt} = \underline{f}(\underline{x}, t, \underline{b})
$$

is captured by a variable ported object with a set of [differential assignments](../mathematics/variables_parameters/#differential-assignments) modelling $\frac{dx_i}{dt} = f_i (\underline{x}, t, \underline{b}_i)$ for each $i$, where $\underline{b}_i \subseteq \underline{b}$.
is captured by a variable ported object with a set of [differential assignments](../mathematics/variables_parameters.md/#differential-assignments) modelling $\frac{dx_i}{dt} = f_i (\underline{x}, t, \underline{b}_i)$ for each $i$, where $\underline{b}_i \subseteq \underline{b}$.

## Example

Expand Down
13 changes: 12 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# mkdocs.yml
site_name: Psymple Docs

repo_url: https://github.com/casasglobal-org/psymple
repo_name: casasglobal-org/psymple

theme:
name: "material"
icon:
Expand All @@ -12,6 +15,8 @@ theme:
- navigation.tabs
- navigation.tabs.sticky
- navigation.sections
- search.suggest
- search.highlight

markdown_extensions:
- admonition
Expand All @@ -31,12 +36,13 @@ markdown_extensions:
- pymdownx.tabbed:
alternate_style: true


extra_javascript:
- javascripts/mathjax.js
- https://unpkg.com/mathjax@3/es5/tex-mml-chtml.js

plugins:
- autorefs:
resolve_closest: true
- mkdocstrings:
handlers:
python:
Expand All @@ -47,6 +53,11 @@ plugins:
show_root_heading: true
show_root_full_path: false
docstring_section_style: spacy
- search

extra:
version:
provider: mike

nav:
- Introduction: index.md
Expand Down
8 changes: 4 additions & 4 deletions psymple/build/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ def __init__(
Args:
name: a string which must be unique for each `PortedObject` inside a common
[`CompositePortedObject`][psymple.ported_objects.CompositePortedObject].
[`CompositePortedObject`][psymple.build.CompositePortedObject].
input_ports: list of input ports to expose.
See [add_input_ports][psymple.ported_objects.abstract.PortedObject.add_input_ports].
See [add_input_ports][psymple.build.abstract.PortedObject.add_input_ports].
output_ports: list of output ports to expose.
See [add_output_ports][psymple.ported_objects.abstract.PortedObject.add_input_ports].
See [add_output_ports][psymple.build.abstract.PortedObject.add_input_ports].
variable_ports: list of variable ports to expose.
See [add_variable_ports][psymple.ported_objects.abstract.PortedObject.add_variable_ports].
See [add_variable_ports][psymple.build.abstract.PortedObject.add_variable_ports].
parsing_locals: a dictionary mapping strings to `sympy` objects.
"""
self.name = name
Expand Down
14 changes: 7 additions & 7 deletions psymple/build/ported_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ def __init__(
def add_variable_assignments(
self,
*assignments: DifferentialAssignment | dict | tuple,
create_variable_ports=True,
create_input_ports=True,
create_variable_ports: bool = True,
create_input_ports: bool = True,
):
"""
Add variable assignments to self.
Expand Down Expand Up @@ -456,7 +456,7 @@ def add_parameter_assignments(
self.assignments[parameter_name] = assignment
self.output_ports[parameter_name] = OutputPort(parameter_name)

def compile(self, prefix_names=False):
def compile(self, prefix_names: bool = False):
"""
Generate a [`CompiledPortedObject`][psymple.build.ported_objects.CompiledPortedObject] with:
Expand Down Expand Up @@ -587,7 +587,7 @@ def __init__(
variable_ports: list[VariablePort | dict | str] = [],
variable_wires: list[dict | tuple] = [],
directed_wires: list[dict | tuple] = [],
parsing_locals = {},
parsing_locals: dict = {},
):
"""
Construct a CompositePortedObject.
Expand Down Expand Up @@ -799,7 +799,7 @@ def add_variable_wire(
Add a variable wire to self.
Args:
source_ports: a list of strings identifying variable ports to aggregate
child_ports: a list of strings identifying variable ports to aggregate
parent_port: a string identifying the parent variable port of self to identify with
output_name: a string identifying the aggregation internally if a parent port
is not specified.
Expand Down Expand Up @@ -880,7 +880,7 @@ def _get_child(self, name: str):
raise KeyError(f"{name} is not a child of {self.name}")


def compile(self, prefix_names=False):
def compile(self, prefix_names: bool = False):
"""
Generate a [`CompiledPortedObject`][psymple.build.ported_objects.CompiledPortedObject] with:
Expand Down Expand Up @@ -1117,7 +1117,7 @@ def _dump_directed_wires(self):
]
return directed_wires

def to_data(self):
def to_data(self) -> PortedObjectData:
"""
A dismantler method such that every instance X of `CompositePortedObject`
can be recreated by calling `X.to_data().to_ported_object()`
Expand Down
8 changes: 4 additions & 4 deletions psymple/build/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def __init__(
ported_object: instance of `PortedObject` or `PortedObjectData defining the system model.
utility_functions: list of the utility functions available in the system. See documentation
for [`add_utility_function`][psymple.build.System.add_utility_function] for acceptable values.
system_paramters: list of the system parameters available in the system. See documentation
system_parameters: list of the system parameters available in the system. See documentation
for [`add_system_paramter`][psymple.build.System.add_system_parameter] for acceptable values.
time_symbol: The symbol used for the independent variable time in the system.
compile: If `True` and `ported_object` is provided, then system will be compiled automatically.
Expand Down Expand Up @@ -525,7 +525,7 @@ def set_initial_values(self, values: dict[str, int | float]):
Initial values must be `int` or `float` instances only.
Args:
initial_values: a dictionary of `variable: value` pairs where `variable` is the string
values: a dictionary of `variable: value` pairs where `variable` is the string
identifier of a variable in `self.variables` and `value` is `int` or `float`.
"""
if not self.compiled:
Expand Down Expand Up @@ -584,8 +584,8 @@ def _check_required_parameters(self):

def create_simulation(
self,
name=None,
solver="continuous",
name: str = None,
solver: str = "continuous",
initial_values: dict = {},
input_parameters: dict = {},
) -> Simulation:
Expand Down
8 changes: 4 additions & 4 deletions psymple/build/wires.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class VariableAggregationWiring:
warning: Warning
This class should not be instantiated on its own. Instead, use
[`psymple.ported_objects.CompositePortedObject.add_variable_wire`][] or
[`psymple.ported_objects.CompositePortedObject.add_wires`][].
[`psymple.build.CompositePortedObject.add_variable_wire`][] or
[`psymple.build.CompositePortedObject.add_wires`][].
"""

def __init__(self, child_ports: list[str], parent_port: str, output_name: str):
Expand Down Expand Up @@ -63,8 +63,8 @@ class DirectedWire:
warning: Warning
This class should not be instantiated on its own. Instead, use
[`psymple.ported_objects.CompositePortedObject.add_directed_wire`][] or
[`psymple.ported_objects.CompositePortedObject.add_wires`][].
[`psymple.build.CompositePortedObject.add_directed_wire`][] or
[`psymple.build.CompositePortedObject.add_wires`][].
"""

def __init__(self, source_port: str, destination_ports: list[str]):
Expand Down
Empty file removed psymple/continuous/__init__.py
Empty file.
30 changes: 0 additions & 30 deletions psymple/continuous/cohorts.py

This file was deleted.

84 changes: 0 additions & 84 deletions psymple/continuous/equation.py

This file was deleted.

18 changes: 0 additions & 18 deletions psymple/continuous/examples1.py

This file was deleted.

14 changes: 0 additions & 14 deletions psymple/continuous/examples2.py

This file was deleted.

Loading

0 comments on commit 2091a1e

Please sign in to comment.