Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -466,37 +466,27 @@ Mesh objects included in samples follow the [CGNS](https://cgns.github.io/) stan
|
|
| 466 |
Example of commands:
|
| 467 |
```python
|
| 468 |
from datasets import load_dataset
|
| 469 |
-
from plaid.
|
| 470 |
-
import pickle
|
| 471 |
|
| 472 |
-
# Load the dataset
|
| 473 |
hf_dataset = load_dataset("PLAID-datasets/2D_profile", split="all_samples")
|
| 474 |
|
| 475 |
-
|
| 476 |
-
ids_train = hf_dataset.description["split"]['train']
|
| 477 |
-
ids_test = hf_dataset.description["split"]['test']
|
| 478 |
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
out_fields_names = hf_dataset.description["out_fields_names"]
|
| 482 |
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
sample_2 = 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 |
-
|
| 493 |
-
|
|
|
|
|
|
|
| 494 |
|
| 495 |
-
#
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
mesh = CGNSBridge.CGNSToMesh(CGNS_tree)
|
| 499 |
-
print(mesh)
|
| 500 |
```
|
| 501 |
|
| 502 |
## Dataset Details
|
|
|
|
| 466 |
Example of commands:
|
| 467 |
```python
|
| 468 |
from datasets import load_dataset
|
| 469 |
+
from plaid.bridges.huggingface_bridge import huggingface_dataset_to_plaid
|
|
|
|
| 470 |
|
|
|
|
| 471 |
hf_dataset = load_dataset("PLAID-datasets/2D_profile", split="all_samples")
|
| 472 |
|
| 473 |
+
dataset, problem = huggingface_dataset_to_plaid(hf_dataset, processes_number = 4)
|
|
|
|
|
|
|
| 474 |
|
| 475 |
+
ids_train = problem.get_split('train')
|
| 476 |
+
ids_test = problem.get_split('test')
|
|
|
|
| 477 |
|
| 478 |
+
sample_train_0 = dataset[ids_train[0]]
|
| 479 |
+
sample_test_0 = dataset[ids_test[0]]
|
|
|
|
| 480 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
|
| 482 |
+
# inputs
|
| 483 |
+
nodes = sample_train_0.get_nodes()
|
| 484 |
+
elements = sample_train_0.get_elements()
|
| 485 |
+
nodal_tags = sample_train_0.get_nodal_tags()
|
| 486 |
|
| 487 |
+
# outputs
|
| 488 |
+
for fn in ['Mach', 'Pressure', 'Velocity-x', 'Velocity-y']:
|
| 489 |
+
field = sample_train_0.get_field(fn)
|
|
|
|
|
|
|
| 490 |
```
|
| 491 |
|
| 492 |
## Dataset Details
|