From 4b4b5c360e6750176c219d9db4402a0f5278d4b9 Mon Sep 17 00:00:00 2001 From: HydrogenSulfate <490868991@qq.com> Date: Mon, 11 Dec 2023 10:14:21 +0800 Subject: [PATCH] [Fix] Fix doc and requirements.txt (#692) * fix(test=document_fix) * replace wrong symbols * enlarge readalbe page width to a relative ratio(70%), update document and requirements.txt --- docs/index.md | 2 +- docs/requirements.txt | 2 +- docs/stylesheets/extra.css | 2 +- docs/zh/examples/labelfree_DNN_surrogate.md | 4 ++-- docs/zh/user_guide.md | 6 ++--- ppsci/utils/misc.py | 4 ++-- pyproject.toml | 25 ++++++++++----------- 7 files changed, 22 insertions(+), 23 deletions(-) diff --git a/docs/index.md b/docs/index.md index 469e08635..e825c16e3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -94,7 +94,7 @@ pip install paddlesci ``` -=== "[完整安装流程](./zh/install_setup.md)" +- **完整安装流程**:[安装与使用](./zh/install_setup.md) --8<-- ./README.md:feature diff --git a/docs/requirements.txt b/docs/requirements.txt index a62a5a727..10a2e6064 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,4 @@ -Jinja2==3.0.3 +Jinja2~=3.1 matplotlib mkdocs mkdocs-autorefs diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css index 97d34cc25..ebc042903 100644 --- a/docs/stylesheets/extra.css +++ b/docs/stylesheets/extra.css @@ -7,7 +7,7 @@ .md-grid { /* readable page width */ - max-width: 1440px; + max-width: 70%; } .md-header__topic > .md-ellipsis { diff --git a/docs/zh/examples/labelfree_DNN_surrogate.md b/docs/zh/examples/labelfree_DNN_surrogate.md index cd81bd64c..8656b3f6c 100644 --- a/docs/zh/examples/labelfree_DNN_surrogate.md +++ b/docs/zh/examples/labelfree_DNN_surrogate.md @@ -233,7 +233,7 @@ examples/pipe/poiseuille_flow.py:152:164 1. 在 $x=0$ 截面速度 $u(y)$ 随 $y$ 在四种不同的动力粘性系数 ${\nu}$ 采样下的曲线和解析解的对比 -2. 当我们选取截断高斯分布的动力粘性系数 ${\nu}$ 采样(均值为 $\hat{\nu} = 10^{−3}$, 方差 $\sigma_{\nu}​=2.67×10^{−4}$),中心处速度的概率密度函数和解析解对比 +2. 当我们选取截断高斯分布的动力粘性系数 ${\nu}$ 采样(均值为 $\hat{\nu} = 10^{−3}$, 方差 $\sigma_{\nu}​=2.67 \times 10^{−4}$),中心处速度的概率密度函数和解析解对比 ``` py linenums="166" --8<-- @@ -253,7 +253,7 @@ examples/pipe/poiseuille_flow.py
![laplace 2d]( https://paddle-org.bj.bcebos.com/paddlescience/docs/labelfree_DNN_surrogate/pipe_result.png){ loading=lazy } -
(左)在 x=0 截面速度 u(y) 随 y 在四种不同的动力粘性系数采样下的曲线和解析解的对比 (右)当我们选取截断高斯分布的动力粘性系数 nu 采样(均值为 nu=0.001, 方差 sigma​=2.67×10e−4),中心处速度的概率密度函数和解析解对比
+
(左)在 x=0 截面速度 u(y) 随 y 在四种不同的动力粘性系数采样下的曲线和解析解的对比 (右)当我们选取截断高斯分布的动力粘性系数 nu 采样(均值为 nu=0.001, 方差 sigma​=2.67 x 10e−4),中心处速度的概率密度函数和解析解对比
DNN代理模型的结果如左图所示,和泊肃叶流动的精确解(论文公式13)进行比较: diff --git a/docs/zh/user_guide.md b/docs/zh/user_guide.md index 5a4dd4ef4..0ce7cda3a 100644 --- a/docs/zh/user_guide.md +++ b/docs/zh/user_guide.md @@ -28,7 +28,7 @@ pip install hydra-core 以 bracket 案例为例,其正常运行命令为:`python bracket.py`。若在其运行命令末尾加上 `-c job`,则可以打印出从运行配置文件 `conf/bracket.yaml` 中解析出的配置参数,如下所示。 -``` shell title=">>> python bracket.py {++-c job++}" +``` shell title="$ python bracket.py {++-c job++}" mode: train seed: 2023 output_dir: ${hydra:run.dir} @@ -95,7 +95,7 @@ TRAIN: 执行如下命令即可按顺序自动运行这 4 组实验。 -``` shell title=">>> python bracket.py {++-m seed=42,1024 TRAIN.epochs=10,20++}" +``` shell title="$ python bracket.py {++-m seed=42,1024 TRAIN.epochs=10,20++}" [HYDRA] Launching 4 jobs locally [HYDRA] #0 : seed=42 TRAIN.epochs=10 .... @@ -109,7 +109,7 @@ TRAIN: 多组实验各自的参数文件、日志文件则保存在以不同参数组合为名称的子文件夹中,如下所示。 -``` shell title=">>> tree PaddleScience/examples/bracket/outputs_bracket/" +``` shell title="$ tree PaddleScience/examples/bracket/outputs_bracket/" PaddleScience/examples/bracket/outputs_bracket/ └──2023-10-14 # (1) └── 04-01-52 # (2) diff --git a/ppsci/utils/misc.py b/ppsci/utils/misc.py index f21004f81..bdf3b3be2 100644 --- a/ppsci/utils/misc.py +++ b/ppsci/utils/misc.py @@ -345,13 +345,13 @@ def cartesian_product(*arrays: np.ndarray) -> np.ndarray: Reference: https://stackoverflow.com/questions/11144513/cartesian-product-of-x-and-y-array-points-into-single-array-of-2d-points Assume shapes of input arrays are: $(N_1,), (N_2,), (N_3,), ..., (N_M,)$, - then the cartesian product result will be shape of $(N_1×N_2×N_3×...×N_M, M)$. + then the cartesian product result will be shape of $(N_1xN_2xN_3x...xN_M, M)$. Args: arrays (np.ndarray): Input arrays. Returns: - np.ndarray: Cartesian product result of shape $(N_1×N_2×N_3×...×N_M, M)$. + np.ndarray: Cartesian product result of shape $(N_1xN_2xN_3x...xN_M, M)$. Examples: >>> t = np.array([1, 2]) diff --git a/pyproject.toml b/pyproject.toml index 728618d8b..0634b0bf6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,26 +33,25 @@ classifiers = [ "Topic :: Scientific/Engineering :: Mathematics", ] dependencies = [ - "numpy>=1.20.0,<=1.23.1", - "sympy", + "colorlog", + "h5py", + "hydra-core", + "imageio", "matplotlib", - "vtk", + "meshio==5.3.4", + "numpy>=1.20.0,<=1.23.1", "pyevtk", - "wget", - "scipy", - "visualdl", "pyvista==0.37.0", "pyyaml", "scikit-optimize", - "h5py", - "meshio==5.3.4", + "scipy", + "seaborn", + "sympy", "tqdm", - "imageio", "typing-extensions", - "seaborn", - "colorlog", - "hydra-core", - "opencv-python", + "visualdl", + "vtk", + "wget", ] [project.urls]