Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -2363,44 +2363,31 @@ Mesh objects included in samples follow the [CGNS](https://cgns.github.io/) stan
|
|
| 2363 |
Example of commands:
|
| 2364 |
```python
|
| 2365 |
from datasets import load_dataset
|
| 2366 |
-
from plaid.
|
| 2367 |
-
import pickle
|
| 2368 |
|
| 2369 |
-
# Load the dataset
|
| 2370 |
hf_dataset = load_dataset("PLAID-datasets/2D_Multiscale_Hyperelasticity", split="all_samples")
|
| 2371 |
|
| 2372 |
-
|
| 2373 |
-
ids_train = hf_dataset.description["split"]['DOE_train']
|
| 2374 |
-
ids_test = hf_dataset.description["split"]['DOE_test']
|
| 2375 |
|
| 2376 |
-
|
| 2377 |
-
|
| 2378 |
-
out_fields_names = hf_dataset.description["out_fields_names"]
|
| 2379 |
|
| 2380 |
-
|
| 2381 |
-
|
| 2382 |
-
sample_2 = Sample.model_validate(pickle.loads(hf_dataset[ids_test[0]]["sample"]))
|
| 2383 |
|
| 2384 |
-
# Examples data retrievals
|
| 2385 |
# inputs
|
| 2386 |
-
nodes =
|
| 2387 |
-
elements =
|
| 2388 |
-
nodal_tags =
|
| 2389 |
|
| 2390 |
for sn in ['C11', 'C12', 'C22']:
|
| 2391 |
-
scalar =
|
| 2392 |
|
| 2393 |
# outputs
|
| 2394 |
for fn in ['u1', 'u2', 'P11', 'P12', 'P22', 'P21', 'psi']:
|
| 2395 |
-
field =
|
| 2396 |
|
| 2397 |
-
effective_energy =
|
| 2398 |
-
|
| 2399 |
-
# Get the mesh and convert it to Muscat
|
| 2400 |
-
from Muscat.Bridges import CGNSBridge
|
| 2401 |
-
CGNS_tree = sample.get_mesh()
|
| 2402 |
-
mesh = CGNSBridge.CGNSToMesh(CGNS_tree)
|
| 2403 |
-
print(mesh)
|
| 2404 |
```
|
| 2405 |
|
| 2406 |
## Dataset Details
|
|
|
|
| 2363 |
Example of commands:
|
| 2364 |
```python
|
| 2365 |
from datasets import load_dataset
|
| 2366 |
+
from plaid.bridges.huggingface_bridge import huggingface_dataset_to_plaid
|
|
|
|
| 2367 |
|
|
|
|
| 2368 |
hf_dataset = load_dataset("PLAID-datasets/2D_Multiscale_Hyperelasticity", split="all_samples")
|
| 2369 |
|
| 2370 |
+
dataset, problem = huggingface_dataset_to_plaid(hf_dataset, processes_number = 4)
|
|
|
|
|
|
|
| 2371 |
|
| 2372 |
+
ids_train = problem.get_split('DOE_train')
|
| 2373 |
+
ids_test = problem.get_split('DOE_test')
|
|
|
|
| 2374 |
|
| 2375 |
+
sample_train_0 = dataset[ids_train[0]]
|
| 2376 |
+
sample_test_0 = dataset[ids_test[0]]
|
|
|
|
| 2377 |
|
|
|
|
| 2378 |
# inputs
|
| 2379 |
+
nodes = sample_train_0.get_nodes()
|
| 2380 |
+
elements = sample_train_0.get_elements()
|
| 2381 |
+
nodal_tags = sample_train_0.get_nodal_tags()
|
| 2382 |
|
| 2383 |
for sn in ['C11', 'C12', 'C22']:
|
| 2384 |
+
scalar = sample_train_0.get_scalar(sn)
|
| 2385 |
|
| 2386 |
# outputs
|
| 2387 |
for fn in ['u1', 'u2', 'P11', 'P12', 'P22', 'P21', 'psi']:
|
| 2388 |
+
field = sample_train_0.get_field(fn)
|
| 2389 |
|
| 2390 |
+
effective_energy = sample_train_0.get_scalar("effective_energy")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2391 |
```
|
| 2392 |
|
| 2393 |
## Dataset Details
|