Skip to content

Commit

Permalink
add sphinx documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gituser789 committed May 8, 2024
1 parent 0aedc9a commit 60d2f63
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea/
pygeckocircuits2/__pycache__/
pygeckocircuits2/config.json
examples/remote_geckocircuits_example.ipes
examples/remote_geckocircuits_example.ipes
docs/build/
17 changes: 0 additions & 17 deletions README.md

This file was deleted.

23 changes: 23 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Welcome to PyGeckoCircuits2
==================================================
This repository was inspired by `MaurerM/pygeckocircuits <https://github.com/MauererM/pygeckocircuits>`__, added by certain functions and a pip-installable package.

Installation
---------------------------------------
Install pygeckocircuits2 directly from pyPI:

::

pip install pygeckocircuits2


Usage
---------------------------------------
Download the compiled gecko-version from `tinix84/gecko <https://github.com/tinix84/gecko/releases/tag/v1.1>`__.

Run the `example file <https://github.com/upb-lea/pygeckocircuits2/blob/main/examples/remote_geckocircuits_example.py>`__ to see the given functions.


Troubleshooting
---------------------------------------
* As of now, there are issues with OpenJDK 21 (LTS). Please use OpenJDK 17 (LTS) so far. See also `this issue <https://github.com/tinix84/gecko/issues/1>`__.
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
37 changes: 37 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.

import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join('..', '..')))

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'PyGeckoCircuits2'
copyright = '2024, UPB-LEA'
author = 'UPB-LEA'
release = '0.0.1'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx.ext.todo']

templates_path = ['_templates']
exclude_patterns = []



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
22 changes: 22 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.. PyGeckoCircuits2 documentation master file, created by
sphinx-quickstart on Wed May 8 10:34:43 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to PyGeckoCircuits2's documentation!
============================================

.. toctree::
:maxdepth: 6
:caption: Contents:

intro



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
14 changes: 14 additions & 0 deletions docs/source/intro.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.. sectnum::

.. include:: ../../README.rst

PyGeckoCircuits2 class and function documentation
==================================================
The ``GeckoSimulation`` class
---------------------------------------
.. currentmodule:: pygeckocircuits2.GeckoSimulation

.. autoclass:: pygeckocircuits2.GeckoSimulation
:members: save_file, open_file, run_simulation, set_global_parameters, get_global_parameters, get_sim_time, set_sim_time, get_component_keys, get_component_values, set_component_values, set_switch_values, set_loss_file, get_switch_keys, get_scope_data, get_values

:special-members: __init__
9 changes: 7 additions & 2 deletions pygeckocircuits2/geckoCircuitsRemote.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class GeckoSimulation:
* a node is a net-node in GeckoCIRCUITS, e.g. you can name a net with a label 'v_in'
Method naming:
* set_ : e.g. to set values or parameters
* get_ : e.g: to get keys, values or parameters
* set : e.g. to set values or parameters
* get : e.g: to get keys, values or parameters
"""

timestep: float
Expand Down Expand Up @@ -249,6 +249,7 @@ def set_global_parameters(self, params_dict: Dict, save_file: bool = False) -> N
:rtype: None
:Example:
>>> import pygeckocircuits2 as pgc
>>> gecko_instance = pgc.GeckoSimulation('path/to/simfile.ipes')
>>> gecko_instance.set_global_parameters({'V_in': 60})
Expand Down Expand Up @@ -276,6 +277,7 @@ def get_global_parameters(self, parameters: Union[List, str]) -> Dict:
:rtype: Dict
:Example:
>>> import pygeckocircuits2 as pgc
>>> buck_converter = pgc.GeckoSimulation('path/to/gecko_file.ipes')
>>> params = buck_converter.get_global_parameters(['V_in', 'f_s', 'duty_cycle', 'V_out', 'L'])
Expand Down Expand Up @@ -370,6 +372,7 @@ def get_component_values(self, component_name: str) -> Dict:
:rtype: Dict
:Example:
>>> import pygeckocircuits2 as pgc
>>> gecko_instance = pgc.GeckoSimulation('path/to/simfile.ipes')
>>> gecko_instance.get_component_values('mosfet.1')
Expand Down Expand Up @@ -397,6 +400,7 @@ def set_component_values(self, component_name: str, component_dict: Dict) -> Non
:raises KeyError: if invalid keys are provided as the component parameters
:Example:
>>> import pygeckocircuits2 as pgc
>>> gecko = pgc.GeckoSimulation('path/to/simfile.ipes')
>>> gecko.set_component_values('L.1', {'iL(0)': 100})
Expand Down Expand Up @@ -495,6 +499,7 @@ def get_switch_keys(self, sw_type: str) -> List:
:rtype: List
:Example:
>>> import pygeckocircuits2 as pgc
>>> buck_converter = pgc.GeckoSimulation('Example_Gecko.ipes', simtime=0.05, timestep=50e-9)
>>> mosfet_parameter_list = buck_converter.get_switch_keys('mosfet')
Expand Down

0 comments on commit 60d2f63

Please sign in to comment.