Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -1282,45 +1282,32 @@ Mesh objects included in samples follow the [CGNS](https://cgns.github.io/) stan
|
|
| 1282 |
Example of commands:
|
| 1283 |
```python
|
| 1284 |
from datasets import load_dataset
|
| 1285 |
-
from plaid.
|
| 1286 |
-
import pickle
|
| 1287 |
|
| 1288 |
-
# Load the dataset
|
| 1289 |
hf_dataset = load_dataset("PLAID-datasets/Tensile2d", split="all_samples")
|
| 1290 |
|
| 1291 |
-
|
| 1292 |
-
ids_train = hf_dataset.description["split"]['train_500']
|
| 1293 |
-
ids_test = hf_dataset.description["split"]['test']
|
| 1294 |
|
| 1295 |
-
|
| 1296 |
-
|
| 1297 |
-
out_fields_names = hf_dataset.description["out_fields_names"]
|
| 1298 |
|
| 1299 |
-
|
| 1300 |
-
|
| 1301 |
-
sample_2 = Sample.model_validate(pickle.loads(hf_dataset[ids_test[0]]["sample"]))
|
| 1302 |
|
| 1303 |
-
# Examples data retrievals
|
| 1304 |
# inputs
|
| 1305 |
-
nodes =
|
| 1306 |
-
elements =
|
| 1307 |
-
nodal_tags =
|
| 1308 |
|
| 1309 |
for sn in ['P', 'p1', 'p2', 'p3', 'p4', 'p5']:
|
| 1310 |
-
scalar =
|
| 1311 |
|
| 1312 |
# outputs
|
| 1313 |
for fn in ['U1', 'U2', 'q', 'sig11', 'sig22', 'sig12']:
|
| 1314 |
-
field =
|
| 1315 |
|
| 1316 |
for sn in ['max_von_mises', 'max_q', 'max_U2_top', 'max_sig22_top']:
|
| 1317 |
-
scalar =
|
| 1318 |
-
|
| 1319 |
-
# Get the mesh and convert it to Muscat
|
| 1320 |
-
from Muscat.Bridges import CGNSBridge
|
| 1321 |
-
CGNS_tree = sample.get_mesh()
|
| 1322 |
-
mesh = CGNSBridge.CGNSToMesh(CGNS_tree)
|
| 1323 |
-
print(mesh)
|
| 1324 |
```
|
| 1325 |
|
| 1326 |
## Dataset Details
|
|
|
|
| 1282 |
Example of commands:
|
| 1283 |
```python
|
| 1284 |
from datasets import load_dataset
|
| 1285 |
+
from plaid.bridges.huggingface_bridge import huggingface_dataset_to_plaid
|
|
|
|
| 1286 |
|
|
|
|
| 1287 |
hf_dataset = load_dataset("PLAID-datasets/Tensile2d", split="all_samples")
|
| 1288 |
|
| 1289 |
+
dataset, problem = huggingface_dataset_to_plaid(hf_dataset, processes_number = 4)
|
|
|
|
|
|
|
| 1290 |
|
| 1291 |
+
ids_train = problem.get_split('train_500')
|
| 1292 |
+
ids_test = problem.get_split('test')
|
|
|
|
| 1293 |
|
| 1294 |
+
sample_train_0 = dataset[ids_train[0]]
|
| 1295 |
+
sample_test_0 = dataset[ids_test[0]]
|
|
|
|
| 1296 |
|
|
|
|
| 1297 |
# inputs
|
| 1298 |
+
nodes = sample_train_0.get_nodes()
|
| 1299 |
+
elements = sample_train_0.get_elements()
|
| 1300 |
+
nodal_tags = sample_train_0.get_nodal_tags()
|
| 1301 |
|
| 1302 |
for sn in ['P', 'p1', 'p2', 'p3', 'p4', 'p5']:
|
| 1303 |
+
scalar = sample_train_0.get_scalar(sn)
|
| 1304 |
|
| 1305 |
# outputs
|
| 1306 |
for fn in ['U1', 'U2', 'q', 'sig11', 'sig22', 'sig12']:
|
| 1307 |
+
field = sample_train_0.get_field(fn)
|
| 1308 |
|
| 1309 |
for sn in ['max_von_mises', 'max_q', 'max_U2_top', 'max_sig22_top']:
|
| 1310 |
+
scalar = sample_train_0.get_scalar(sn)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1311 |
```
|
| 1312 |
|
| 1313 |
## Dataset Details
|