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

Address flake8 rst docstring issues #190

Merged
merged 2 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pygeo/constraints/DVCon.py
Original file line number Diff line number Diff line change
Expand Up @@ -3139,6 +3139,8 @@ def addMonotonicConstraints(
self, key, slope=1.0, name=None, start=0, stop=-1, config=None, childIdx=None, comp=None, DVGeoName="default"
):
"""
Add monotonic constraints to a given design variable.

Parameters
----------
key : str
Expand Down
8 changes: 8 additions & 0 deletions pygeo/parameterization/BaseDVGeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,12 @@ def mapXDictToDVGeo(self, inDict):
def mapXDictToComp(self, inDict):
"""
The inverse of :func:`mapXDictToDVGeo`, where we map the DVs to the composite space

Parameters
----------
inDict : dict
The DVs to be mapped

Returns
-------
dict
Expand All @@ -234,10 +236,12 @@ def mapXDictToComp(self, inDict):
def mapVecToDVGeo(self, inVec):
"""
This is the vector version of :func:`mapXDictToDVGeo`, where the actual mapping is done

Parameters
----------
inVec : ndarray
The DVs in a single 1D array

Returns
-------
ndarray
Expand All @@ -250,10 +254,12 @@ def mapVecToDVGeo(self, inVec):
def mapVecToComp(self, inVec):
"""
This is the vector version of :func:`mapXDictToComp`, where the actual mapping is done

Parameters
----------
inVec : ndarray
The DVs in a single 1D array

Returns
-------
ndarray
Expand All @@ -266,10 +272,12 @@ def mapVecToComp(self, inVec):
def mapSensToComp(self, inVec):
"""
Maps the sensitivity matrix to the composite design space

Parameters
----------
inVec : ndarray
The sensitivities to be mapped

Returns
-------
ndarray
Expand Down
10 changes: 5 additions & 5 deletions pygeo/parameterization/DVGeoCST.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def addPointSet(self, points, ptName, boundTol=1e-10, **kwargs):
boundTol : float, optional
Small absolute deviation by which the airfoil coordinates can exceed the initial
minimum and maximum x coordinates, by default 1e-10.
kwargs
\*\*kwargs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be surprised if backslash is necessary here

Copy link
Contributor Author

@eirikurj eirikurj Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that was my thought too. However, if removed, the following is generated
RST210 Inline strong start-string without end-string. There is an open issue on this peterjc/flake8-rst-docstrings#18 and some PR, but not sure why its not merged yet. While escaping is ugly, it works and is consistent with rst. Not sure if there is any other approach at the moment, but any suggestions are welcome.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I guess I'm fine with this then, even though it is harder to read. The alternative would be to ignore RST210 but that may mask other issues.

Any other parameters are ignored.
"""
# Convert points to the type specified at initialization (with isComplex) and store the points
Expand Down Expand Up @@ -556,7 +556,7 @@ def totalSensitivity(self, dIdpt, ptSetName, comm=None, **kwargs):
If you have many to do, it is faster to do many at once.
ptSetName : str
The name of set of points we are dealing with
kwargs
\*\*kwargs
Any other parameters ignored, but this is maintained to allow the same
interface as other DVGeo implementations.

Expand Down Expand Up @@ -691,7 +691,7 @@ def totalSensitivityProd(self, vec, ptSetName, **kwargs):
values are the derivative seeds of the corresponding design variable.
ptSetName : str
The name of set of points we are dealing with
kwargs
\*\*kwargs
Any other parameters ignored, but this is maintained to allow the same
interface as other DVGeo implementations.

Expand Down Expand Up @@ -799,7 +799,7 @@ def update(self, ptSetName, **kwargs):
ptSetName : str
Name of point-set to return. This must match ones of the
given in an :func:`addPointSet()` call.
kwargs
\*\*kwargs
Any other parameters ignored, but this is maintained to allow the same
interface as other DVGeo implementations.

Expand Down Expand Up @@ -1207,7 +1207,7 @@ def plotCST(upperCoeff, lowerCoeff, N1=0.5, N2=1.0, nPts=100, ax=None, **kwargs)
Number of coordinates to compute on each surface.
ax : matplotlib Axes, optional
Axes on which to plot airfoil.
**kwargs
\*\*kwargs
Keyword arguments passed to matplotlib.pyplot.plot

Returns
Expand Down
5 changes: 5 additions & 0 deletions pygeo/parameterization/DVGeoSketch.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def addCompositeDV(self, dvName, ptSetName=None, u=None, scale=None, comm=None):
"""
Add composite DVs. Note that this is essentially a preprocessing call which only works in serial
at the moment.

Parameters
----------
dvName : str
Expand Down Expand Up @@ -168,11 +169,13 @@ def convertDictToSensitivity(self, dIdxDict):
convertSensitivityToDict(); it transforms the dictionary back
into an array. This function is important for the matrix-free
interface.

Parameters
----------
dIdxDict : dictionary
Dictionary of information keyed by this object's
design variables

Returns
-------
dIdx : array
Expand All @@ -193,6 +196,7 @@ def convertSensitivityToDict(self, dIdx, out1D=False, useCompositeNames=False):
"""
This function takes the result of totalSensitivity and
converts it to a dict for use in pyOptSparse

Parameters
----------
dIdx : array
Expand All @@ -205,6 +209,7 @@ def convertSensitivityToDict(self, dIdx, out1D=False, useCompositeNames=False):
Whether the sensitivity dIdx is with respect to the composite DVs or the original DVGeo DVs.
If False, the returned dictionary will have keys corresponding to the original set of geometric DVs.
If True, the returned dictionary will have replace those with a single key corresponding to the composite DV name.

Returns
-------
dIdxDict : dictionary
Expand Down