-
Notifications
You must be signed in to change notification settings - Fork 205
【PPSCI Doc No.41-57】 #833
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
【PPSCI Doc No.41-57】 #833
Conversation
Thanks for your contribution! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢提交PR,修改得很仔细👍。有几处小问题可以按照建议辛苦修改一下。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 函数的参数可以加上和typehint,与docstring保持一(当类型注解为类自身时,建议加上双引号,比如
geom: "Geometry"
) - docstring的 Returns 类型外面好像不需要套上小括号?
ppsci/geometry/geometry.py
Outdated
where D is the number of dimension of geometry. | ||
|
||
Returns: | ||
(np.ndarray): Boolean array where x is inside the geometry. The shape is [N, 1]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
实测输出形状应该是[N]
,下面类似的可以一起改一下
ppsci/geometry/geometry.py
Outdated
[ 0.25868416]], dtype=float32), 'sdf__y': array([[-0. ], | ||
[ 0.74118376]], dtype=float32)} | ||
>>> cuboid = ppsci.geometry.Cuboid((0, 0, 0), (1, 1, 1)) | ||
>>> cuboid.sample_interior(2,"pseudo", None, True, True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
参数之间的逗号后面加上空格
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有几处可能漏了的地方,还辛苦修改一下
ppsci/geometry/geometry.py
Outdated
n, | ||
random="pseudo", | ||
n: int, | ||
random: str = "pseudo", | ||
criteria=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
criteria的类型注解是Optional[Callable]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
默认值为None的类型注解需要在原类型外面加上Optional,比如Optional[bool]
ppsci/geometry/geometry.py
Outdated
def sample_boundary(self, n, random="pseudo", criteria=None, evenly=False): | ||
"""Compute the random points in the geometry and return those meet criteria.""" | ||
def sample_boundary( | ||
self, n: int, random: str = "pseudo", criteria=None, evenly=False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
比如,这里可以改为:criteria: Optional[Callable]
和evenly: bool = False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文件开头加一下:
from typing import Callable
from typing import Dict
ppsci/geometry/geometry.py
Outdated
np.ndarray: Random points in the geometry. The shape is [N, D]. | ||
their signed distance function. The shape is [N]. | ||
their derivatives of SDF(optional). The shape is [N]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 返回值是Dict[str, np.ndarray],而不是np.ndarray
- their signed distance function. The shape is [N, 1].
- their derivatives of SDF(optional). The shape is [N, D].
ppsci/geometry/geometry.py
Outdated
Returns: | ||
np.ndarray: Random points in the geometry. The shape is [N, D]. | ||
their normal vectors. The shape is [N, D]. | ||
their area. The shape is [N].(only if the geometry is a mesh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
ppsci/geometry/geometry.py
Outdated
"""Compute the random points in the geometry and return those meet criteria.""" | ||
def sample_boundary( | ||
self, n: int, random: str = "pseudo", criteria: Optional[Callable] = None, evenly: bool = False | ||
) -> np.ndarray: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
ppsci/geometry/geometry.py
Outdated
compute_sdf_derivatives: bool = False, | ||
): | ||
"""Sample random points in the geometry and return those meet criteria.""" | ||
) -> np.ndarray: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
返回值类型改为Dict[str, np.ndarray]
ppsci/geometry/geometry.py
Outdated
def uniform_boundary_points(self, n: int): | ||
"""Compute the equi-spaced points on the boundary.""" | ||
"""Compute the equi-spaced points on the boundary(not implemented). | ||
|
||
Warings: | ||
This function is not implemented, please use random_boundary_points instead. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
补充一下返回值类型
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
hi, @wufei2
|
* fix docs bugs * fix docs bugs * fix codestyle bug * fix codestyle bugs * fix codestyle bugs * fix some bugs * fix codetype error * fix other bugs * fix typehint bugs * fix other bugs * fix codestyle bug * fix codestyle bug
PR types
Others
PR changes
Others
Describe
对以下文档进行了补全:
ppsci.geometry.Geometry.and
ppsci.geometry.Geometry.or
ppsci.geometry.Geometry.sub
ppsci.geometry.Geometry.str
ppsci.geometry.Geometry.difference
ppsci.geometry.Geometry.intersection
ppsci.geometry.Geometry.is_inside
ppsci.geometry.Geometry.on_boundary
ppsci.geometry.Geometry.periodic_point
ppsci.geometry.Geometry.random_boundary_points
ppsci.geometry.Geometry.random_points
ppsci.geometry.Geometry.sample_boundary
ppsci.geometry.Geometry.sample_interior
ppsci.geometry.Geometry.sdf_derivatives
ppsci.geometry.Geometry.uniform_boundary_points
ppsci.geometry.Geometry.uniform_points
ppsci.geometry.Geometry.union