Datasets:
Modalities:
3D
Size:
10K<n<100K
Upload windtunnel.py with huggingface_hub
Browse files- windtunnel.py +67 -0
windtunnel.py
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import os
|
3 |
+
import datasets
|
4 |
+
|
5 |
+
|
6 |
+
class WindtunnelDataset(datasets.GeneratorBasedBuilder):
|
7 |
+
"""Dataset for loading simulation data with JSON and mesh files"""
|
8 |
+
|
9 |
+
def _info(self):
|
10 |
+
print("nnnnn")
|
11 |
+
return datasets.DatasetInfo(
|
12 |
+
features=datasets.Features(
|
13 |
+
{
|
14 |
+
"coeff": datasets.Value("binary"), # JSON file as a dictionary
|
15 |
+
"input": datasets.Value("binary"), # JSON file as a dictionary
|
16 |
+
"input_mesh": datasets.Value("binary"), # OBJ mesh file as binary
|
17 |
+
"openfoam_mesh": datasets.Value(
|
18 |
+
"binary"
|
19 |
+
), # OBJ mesh file as binary
|
20 |
+
"pressure_field_mesh": datasets.Value(
|
21 |
+
"binary"
|
22 |
+
), # VTK file as binary
|
23 |
+
"streamlines_mesh": datasets.Value("binary"), # PLY file as binary
|
24 |
+
}
|
25 |
+
),
|
26 |
+
homepage="https://inductiva.ai",
|
27 |
+
)
|
28 |
+
|
29 |
+
def _split_generators(self, dl_manager):
|
30 |
+
dl_dir = dl_manager.download(
|
31 |
+
{
|
32 |
+
"data": "data",
|
33 |
+
}
|
34 |
+
)
|
35 |
+
print("aaaaa")
|
36 |
+
"""Define the splits for the dataset."""
|
37 |
+
train_dir = "train"
|
38 |
+
val_dir = "validation"
|
39 |
+
test_dir = "test"
|
40 |
+
print("zzzzz")
|
41 |
+
print(os.getcwd())
|
42 |
+
return [
|
43 |
+
datasets.SplitGenerator(
|
44 |
+
name=datasets.Split.TRAIN, gen_kwargs={"path": train_dir}
|
45 |
+
),
|
46 |
+
datasets.SplitGenerator(
|
47 |
+
name=datasets.Split.VALIDATION,
|
48 |
+
gen_kwargs={"path": val_dir},
|
49 |
+
),
|
50 |
+
datasets.SplitGenerator(
|
51 |
+
name=datasets.Split.TEST,
|
52 |
+
gen_kwargs={"path": test_dir},
|
53 |
+
),
|
54 |
+
]
|
55 |
+
|
56 |
+
def _generate_examples(self, path):
|
57 |
+
"""Generate examples for each split."""
|
58 |
+
id = 0
|
59 |
+
for root, dirs, files in os.walk(path):
|
60 |
+
for file in files:
|
61 |
+
yield (
|
62 |
+
id,
|
63 |
+
{
|
64 |
+
"label": id,
|
65 |
+
},
|
66 |
+
)
|
67 |
+
id += 1
|