Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup type hints + spelling, source API links #64

Merged
merged 12 commits into from
Mar 2, 2022
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
**Bug fixes**

* Correct dependency name for jupyter-notebook
* Move jupyter-notebook to base install dependecy
* Move jupyter-notebook to base install dependency

**New features**

Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The tutorials are written as Jupyter Notebooks which are available in the `GitHu
The two tutorials use the `WaveBot`_ WEC, which is a single-body WEC developed at Sandia.
The tutorials are meant to be sequential.
The first tutorial solves only the inner optimization loop, and serves as an introduction to WecOptTool.
The second tutorial builds on the first to solve a design opotimization problem, using both the inner and outer optimization loops, and is more reflective of the optimization problems WecOptTool is designed to solve.
The second tutorial builds on the first to solve a design optimization problem, using both the inner and outer optimization loops, and is more reflective of the optimization problems WecOptTool is designed to solve.

- :doc:`_examples/tutorial_1_wavebot`: Simple example of the *inner loop* using a single-body WEC moving in one degree of freedom in regular waves. The example finds the optimal control strategy for a fixed WEC design. See :cite:`Coe2020Initial` for further discussion of this example.
- :doc:`_examples/tutorial_2_wavebot_optimization`: Simple example of a design optimization problem (*outer* and *inner* optimization loops). The example optimizes the WEC geometry (outer loop) while finding the optimal control strategy for each design considered (inner loop).
Expand Down
257 changes: 36 additions & 221 deletions examples/tutorial_1_wavebot.ipynb

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions examples/tutorial_2_wavebot_optimization.ipynb

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions wecopttool/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from autograd import grad, jacobian
import xarray as xr
import capytaine as cpy
from scipy.optimize import minimize
from scipy.optimize import minimize, OptimizeResult
from scipy.linalg import block_diag
import matplotlib.pyplot as plt
import matplotlib as mpl
Expand Down Expand Up @@ -68,15 +68,15 @@ def __init__(self, fb: cpy.FloatingBody, mass: np.ndarray,
mass: np.ndarray
Mass matrix shape of (``ndof`` x ``ndof``).
hydrostatic_stiffness: np.ndarray
Hydrstatic stiffness matrix matrix of shape
Hydrostatic stiffness matrix matrix of shape
(``ndof`` x ``ndof``).
f0: float
Initial frequency (in Hz) for frequency array.
Frequency array given as [``f0``, 2 ``f0``, ..., ``nfreq f0``].
nfreq: int
Number of frequencies in frequency array. See ``f0``.
dissipation: np.ndarray
Additional dissipiation for the impedance calculation in
Additional dissipation for the impedance calculation in
``capytaine.post_pro.impedance``. Shape:
(``ndof`` x ``ndof`` x ``1``) or (``ndof`` x ``ndof`` x ``nfreq``).
stiffness: np.ndarray
Expand Down Expand Up @@ -586,7 +586,7 @@ def solve(self,
use_grad: bool = True,
maximize: bool = False,
) -> tuple[xr.Dataset, xr.Dataset, np.ndarray, np.ndarray, float,
optimize.optimize.OptimizeResult]:
OptimizeResult]:
"""Solve the WEC co-design problem.

Parameters
Expand Down Expand Up @@ -884,7 +884,7 @@ def scale_dofs(scale_list: list[float], ncomponents: int) -> np.ndarray:


def complex_xarray_from_netcdf(fpath: str | Path) -> xr.Dataset:
"""Read a NetCDF file with commplex entries as an xarray dataSet.
"""Read a NetCDF file with complex entries as an xarray dataSet.
"""
with xr.open_dataset(fpath) as ds:
ds.load()
Expand Down Expand Up @@ -1226,7 +1226,7 @@ def delaxes(axs, idof, jdof, ndof):


def post_process_continuous_time(results: xr.DataArray
) -> Callable[float, float]:
) -> Callable[[float, float]]:
"""Create a continuous function from the results in an xarray
DataArray.

Expand Down