fabiencasenave commited on
Commit
bac06c0
·
verified ·
1 Parent(s): 6a4e7d6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -25
README.md CHANGED
@@ -2274,47 +2274,34 @@ Mesh objects included in samples follow the [CGNS](https://cgns.github.io/) stan
2274
  Example of commands:
2275
  ```python
2276
  from datasets import load_dataset
2277
- from plaid.containers.sample import Sample
2278
- import pickle
2279
 
2280
- # Load the dataset
2281
  hf_dataset = load_dataset("PLAID-datasets/Rotor37", split="all_samples")
2282
 
2283
- # Get split ids
2284
- ids_train = hf_dataset.description["split"]['train_1000']
2285
- ids_test = hf_dataset.description["split"]['test']
2286
 
2287
- # Get inputs/outputs names
2288
- in_scalars_names = hf_dataset.description["in_scalars_names"]
2289
- out_fields_names = hf_dataset.description["out_fields_names"]
2290
 
2291
- # Get samples
2292
- sample = Sample.model_validate(pickle.loads(hf_dataset[ids_train[0]]["sample"]))
2293
- sample_2 = Sample.model_validate(pickle.loads(hf_dataset[ids_test[0]]["sample"]))
2294
 
2295
- # Examples data retrievals
2296
  # inputs
2297
- nodes = sample.get_nodes()
2298
- elements = sample.get_elements()
2299
 
2300
  for fn in ['NormalsX', 'NormalsY', 'NormalsZ']:
2301
- field = sample.get_field(fn)
2302
 
2303
  for sn in ['Omega', 'P']:
2304
- scalar = sample.get_scalar(sn)
2305
 
2306
  # outputs
2307
  for fn in ['Density', 'Pressure', 'Temperature']:
2308
- field = sample.get_field(fn)
2309
 
2310
  for sn in ['Massflow', 'Compression_ratio', 'Efficiency']:
2311
- scalar = sample.get_scalar(sn)
2312
-
2313
- # Get the mesh and convert it to Muscat
2314
- from Muscat.Bridges import CGNSBridge
2315
- CGNS_tree = sample.get_mesh()
2316
- mesh = CGNSBridge.CGNSToMesh(CGNS_tree)
2317
- print(mesh)
2318
  ```
2319
 
2320
  ## Dataset Details
 
2274
  Example of commands:
2275
  ```python
2276
  from datasets import load_dataset
2277
+ from plaid.bridges.huggingface_bridge import huggingface_dataset_to_plaid
 
2278
 
 
2279
  hf_dataset = load_dataset("PLAID-datasets/Rotor37", split="all_samples")
2280
 
2281
+ dataset, problem = huggingface_dataset_to_plaid(hf_dataset, processes_number = 4)
 
 
2282
 
2283
+ ids_train = problem.get_split('train_1000')
2284
+ ids_test = problem.get_split('test')
 
2285
 
2286
+ sample_train_0 = dataset[ids_train[0]]
2287
+ sample_test_0 = dataset[ids_test[0]]
 
2288
 
 
2289
  # inputs
2290
+ nodes = sample_train_0.get_nodes()
2291
+ elements = sample_train_0.get_elements()
2292
 
2293
  for fn in ['NormalsX', 'NormalsY', 'NormalsZ']:
2294
+ field = sample_train_0.get_field(fn)
2295
 
2296
  for sn in ['Omega', 'P']:
2297
+ scalar = sample_train_0.get_scalar(sn)
2298
 
2299
  # outputs
2300
  for fn in ['Density', 'Pressure', 'Temperature']:
2301
+ field = sample_train_0.get_field(fn)
2302
 
2303
  for sn in ['Massflow', 'Compression_ratio', 'Efficiency']:
2304
+ scalar = sample_train_0.get_scalar(sn)
 
 
 
 
 
 
2305
  ```
2306
 
2307
  ## Dataset Details