fabiencasenave commited on
Commit
17ff1fa
·
verified ·
1 Parent(s): f6dc5b9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -23
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.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"]
481
- out_fields_names = hf_dataset.description["out_fields_names"]
482
 
483
- # Get samples
484
- sample = Sample.model_validate(pickle.loads(hf_dataset[ids_train[0]]["sample"]))
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
- 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
  ```
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