Skip to content

Commit 5f7ec8c

Browse files
support custom delimeter for load_csv_file
1 parent 35b6da2 commit 5f7ec8c

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

docs/zh/install_setup.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828

2929
???+ Info "安装注意事项"
3030

31-
如需使用外部导入STL文件来构建几何,以及使用加密采样等功能,还需额外安装三个依赖库
32-
- [pymesh](https://pymesh.readthedocs.io/en/latest/installation.html#download-the-source)(推荐编译安装)
33-
- [open3d](https://github.com/isl-org/Open3D/tree/master#python-quick-start)(推荐pip安装)
34-
- [pysdf](https://github.com/sxyu/sdf) (推荐pip安装)
31+
如需使用外部导入STL文件来构建几何,以及使用加密采样等功能,还需额外安装三个依赖库
32+
[pymesh](https://pymesh.readthedocs.io/en/latest/installation.html#download-the-source)(推荐编译安装),
33+
[open3d](https://github.com/isl-org/Open3D/tree/master#python-quick-start)(推荐pip安装),
34+
[pysdf](https://github.com/sxyu/sdf)(推荐pip安装)
3535

3636
#### 1.2.2 pip 安装
3737

ppsci/utils/reader.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def load_csv_file(
3939
file_path: str,
4040
keys: Tuple[str, ...],
4141
alias_dict: Optional[Dict[str, str]] = None,
42+
delimeter: str = ",",
4243
encoding: str = "utf-8",
4344
) -> Dict[str, np.ndarray]:
4445
"""Load *.csv file and fetch data as given keys.
@@ -59,7 +60,7 @@ def load_csv_file(
5960
try:
6061
# read all data from csv file
6162
with open(file_path, "r", encoding=encoding) as csv_file:
62-
reader = csv.DictReader(csv_file)
63+
reader = csv.DictReader(csv_file, delimiter=delimeter)
6364
raw_data = collections.defaultdict(list)
6465
for _, line_dict in enumerate(reader):
6566
for key, value in line_dict.items():
@@ -121,7 +122,7 @@ def load_mat_file(
121122

122123
def load_vtk_file(
123124
filename_without_timeid: str,
124-
time_step: Union[float, int],
125+
time_step: float,
125126
time_index: Tuple[int, ...],
126127
input_keys: Tuple[str, ...],
127128
label_keys: Optional[Tuple[str, ...]],
@@ -130,7 +131,7 @@ def load_vtk_file(
130131
131132
Args:
132133
filename_without_timeid (str): File name without time id.
133-
time_step (Union[float, Dict]): Physical time step.
134+
time_step (float): Physical time step.
134135
time_index (Tuple[int, ...]): Physical time indexes.
135136
input_keys (Tuple[str, ...]): Input coordinates name keys.
136137
label_keys (Optional[Tuple[str, ...]]): Input label name keys.

0 commit comments

Comments
 (0)