Utils.reader(读取函数) 模块¶
ppsci.utils.reader
¶
load_csv_file(file_path, keys, alias_dict=None, delimiter=',', encoding='utf-8')
¶
Load *.csv file and fetch data as given keys.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
CSV file path. |
required |
keys |
Tuple[str, ...]
|
Required fetching keys. |
required |
alias_dict |
Optional[Dict[str, str]]
|
Alias for keys, i.e. {inner_key: outer_key}. Defaults to None. |
None
|
encoding |
str
|
Encoding code when open file. Defaults to "utf-8". |
'utf-8'
|
Returns:
Type | Description |
---|---|
Dict[str, ndarray]
|
Dict[str, np.ndarray]: Loaded data in dict. |
Source code in ppsci/utils/reader.py
load_mat_file(file_path, keys, alias_dict=None)
¶
Load *.mat file and fetch data as given keys.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
Mat file path. |
required |
keys |
Tuple[str, ...]
|
Required fetching keys. |
required |
alias_dict |
Optional[Dict[str, str]]
|
Alias for keys, i.e. {original_key: original_key}. Defaults to None. |
None
|
Returns:
Type | Description |
---|---|
Dict[str, ndarray]
|
Dict[str, np.ndarray]: Loaded data in dict. |
Source code in ppsci/utils/reader.py
load_npz_file(file_path, keys, alias_dict=None)
¶
Load *.npz file and fetch data as given keys.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
Npz file path. |
required |
keys |
Tuple[str, ...]
|
Required fetching keys. |
required |
alias_dict |
Optional[Dict[str, str]]
|
Alias for keys, i.e. {original_key: original_key}. Defaults to None. |
None
|
Returns:
Type | Description |
---|---|
Dict[str, ndarray]
|
Dict[str, np.ndarray]: Loaded data in dict. |
Source code in ppsci/utils/reader.py
load_vtk_file(filename_without_timeid, time_step, time_index, input_keys, label_keys)
¶
Load coordinates and attached label from the *.vtu file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename_without_timeid |
str
|
File name without time id. |
required |
time_step |
float
|
Physical time step. |
required |
time_index |
Tuple[int, ...]
|
Physical time indexes. |
required |
input_keys |
Tuple[str, ...]
|
Input coordinates name keys. |
required |
label_keys |
Optional[Tuple[str, ...]]
|
Input label name keys. |
required |
Returns:
Type | Description |
---|---|
Dict[str, ndarray]
|
Dict[str, np.ndarray]: Input coordinates dict, label coordinates dict |
Source code in ppsci/utils/reader.py
load_vtk_with_time_file(file)
¶
Temporary interface for points cloud, will be banished sooner.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file |
str
|
Input file name. |
required |
Returns:
Type | Description |
---|---|
Dict[str, ndarray]
|
Dict[str, np.ndarray]: Input coordinates dict. |