From b8553cbbe05daabe304596c372c4f830521f410c Mon Sep 17 00:00:00 2001 From: Stefan Ecklebe Date: Fri, 18 Oct 2024 16:40:58 +0200 Subject: [PATCH] Fix deprecation error in docs and add more docstrings to SimulationModule --- docs/conf.py | 1 - docs/modules/simulation_core.rst | 2 +- docs/modules/simulation_modules.rst | 10 +++++++++ pymoskito/simulation_modules.py | 32 ++++++++++++++++++++++++++++- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 0d764640..9d4fa6be 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -161,7 +161,6 @@ if not on_rtd: # only import and set the theme if we're building docs locally import sphinx_rtd_theme html_theme = 'sphinx_rtd_theme' - html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # Theme options are theme-specific and customize the look and feel of a # theme further. For a list of options available for each theme, see the diff --git a/docs/modules/simulation_core.rst b/docs/modules/simulation_core.rst index 609acb26..c482aee9 100644 --- a/docs/modules/simulation_core.rst +++ b/docs/modules/simulation_core.rst @@ -3,4 +3,4 @@ Simulation Core =============== .. automodule:: pymoskito.simulation_core - :members: \ No newline at end of file + :members: diff --git a/docs/modules/simulation_modules.rst b/docs/modules/simulation_modules.rst index 576247e2..aadc5a15 100644 --- a/docs/modules/simulation_modules.rst +++ b/docs/modules/simulation_modules.rst @@ -2,6 +2,16 @@ Simulation Modules ================== + + .. automodule:: pymoskito.simulation_modules :members: :private-members: + :exclude-members: SimulationModule + + .. autoclass:: SimulationModule + :members: + + .. autoproperty:: public_settings + + .. automethod:: calc_output(self) diff --git a/pymoskito/simulation_modules.py b/pymoskito/simulation_modules.py index af1ec17e..4d2a8576 100644 --- a/pymoskito/simulation_modules.py +++ b/pymoskito/simulation_modules.py @@ -23,7 +23,7 @@ class SimulationException(Exception): class SimulationModule(QObject, metaclass=SimulationModuleMeta): """ - Smallest unit pof the simulation framework. + Base unit of the simulation framework. This class provides necessary functions like output calculation and holds all settings that can be accessed by the user. @@ -71,6 +71,12 @@ def __init__(self, settings): @property @abstractmethod def public_settings(self): + """ + Dict of public settings. + + This contains all settings that will be shown and can be edited + in the GUI. + """ pass @property @@ -79,10 +85,27 @@ def settings(self): @property def tick_divider(self): + """ + Simulation tick divider. + + This property controls the frequency at which this Module is evaluated + in the main simulation loop. If e.g. a value of `2` is provided, the + module will be evaluated at every 2nd step that the solver makes. + + This feature comes in handy if discrete setups with different sample rates + are simulated. + """ return self._settings["tick divider"] @property def step_width(self): + """ + The discrete step width that this module is called with. + + This parameter will be set when the simulation is initialised + and is based on the solver step size and the selected tick + divider of the module. + """ return self._settings["step width"] @step_width.setter @@ -91,6 +114,13 @@ def step_width(self, value): @abstractmethod def calc_output(self, input_vector): + """ + Main evaluation routine. + + Every time the solver has made the amount of steps specified in `tick_divider`, + this method will be called to compute the next output of the module. + This is typically where the main logic of a module is implemented. + """ pass