Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -465,32 +465,36 @@ Mesh objects included in samples follow the [CGNS](https://cgns.github.io/) stan
|
|
| 465 |
|
| 466 |
Example of commands:
|
| 467 |
```python
|
| 468 |
-
import pickle
|
| 469 |
from datasets import load_dataset
|
| 470 |
from plaid.containers.sample import Sample
|
|
|
|
| 471 |
|
| 472 |
# Load the dataset
|
| 473 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 474 |
|
| 475 |
-
# Get
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
sample_0_split_0 = dataset[ids_split_0[0]]["sample"]
|
| 479 |
-
plaid_sample = Sample.model_validate(pickle.loads(sample_0_split_0))
|
| 480 |
-
print("type(plaid_sample) =", type(plaid_sample))
|
| 481 |
|
| 482 |
-
|
|
|
|
|
|
|
| 483 |
|
| 484 |
-
#
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
|
| 489 |
-
|
|
|
|
| 490 |
|
| 491 |
# Get the mesh and convert it to Muscat
|
| 492 |
from Muscat.Bridges import CGNSBridge
|
| 493 |
-
CGNS_tree =
|
| 494 |
mesh = CGNSBridge.CGNSToMesh(CGNS_tree)
|
| 495 |
print(mesh)
|
| 496 |
```
|
|
|
|
| 465 |
|
| 466 |
Example of commands:
|
| 467 |
```python
|
|
|
|
| 468 |
from datasets import load_dataset
|
| 469 |
from plaid.containers.sample import Sample
|
| 470 |
+
import pickle
|
| 471 |
|
| 472 |
# Load the dataset
|
| 473 |
+
hf_dataset = load_dataset("PLAID-datasets/2D_profile", split="all_samples")
|
| 474 |
+
|
| 475 |
+
# Get split ids
|
| 476 |
+
ids_train = hf_dataset.description["split"]['train']
|
| 477 |
+
ids_test = hf_dataset.description["split"]['test']
|
| 478 |
|
| 479 |
+
# Get inputs/outputs names
|
| 480 |
+
in_scalars_names = hf_dataset.description["in_scalars_names"]['train']
|
| 481 |
+
out_fields_names = hf_dataset.description["out_fields_names"]['train']
|
|
|
|
|
|
|
|
|
|
| 482 |
|
| 483 |
+
# Get samples
|
| 484 |
+
sample = Sample.model_validate(pickle.loads(hf_dataset[ids_train[0]]["sample"]))
|
| 485 |
+
sample = Sample.model_validate(pickle.loads(hf_dataset[ids_test[0]]["sample"]))
|
| 486 |
|
| 487 |
+
# Examples data retrievals
|
| 488 |
+
nodes = sample.get_nodes()
|
| 489 |
+
elements = sample.get_elements()
|
| 490 |
+
nodal_tags = sample.get_nodal_tags())
|
| 491 |
|
| 492 |
+
for fn in ['Mach', 'Pressure', 'Velocity-x', 'Velocity-y']:
|
| 493 |
+
field = sample.get_field(fn)
|
| 494 |
|
| 495 |
# Get the mesh and convert it to Muscat
|
| 496 |
from Muscat.Bridges import CGNSBridge
|
| 497 |
+
CGNS_tree = sample.get_mesh()
|
| 498 |
mesh = CGNSBridge.CGNSToMesh(CGNS_tree)
|
| 499 |
print(mesh)
|
| 500 |
```
|