fabiencasenave commited on
Commit
cae7e86
·
verified ·
1 Parent(s): f4c9412

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -25
README.md CHANGED
@@ -1084,44 +1084,32 @@ Mesh objects included in samples follow the [CGNS](https://cgns.github.io/) stan
1084
  Example of commands:
1085
  ```python
1086
  from datasets import load_dataset
1087
- from plaid.containers.sample import Sample
1088
- import pickle
1089
 
1090
- # Load the dataset
1091
  hf_dataset = load_dataset("PLAID-datasets/2D_ElastoPlastoDynamics", split="all_samples")
1092
 
1093
- # Get split ids
1094
- ids_train = hf_dataset.description["split"]['train']
1095
- ids_test = hf_dataset.description["split"]['test']
1096
 
1097
- # Get inputs/outputs names
1098
- in_scalars_names = hf_dataset.description["in_scalars_names"]
1099
- out_fields_names = hf_dataset.description["out_fields_names"]
 
 
1100
 
1101
- # Get samples
1102
- sample = Sample.model_validate(pickle.loads(hf_dataset[ids_train[0]]["sample"]))
1103
- sample_2 = Sample.model_validate(pickle.loads(hf_dataset[ids_test[0]]["sample"]))
1104
 
1105
- # Examples data retrievals
1106
  # time steps
1107
- time_steps = sample.get_all_mesh_times()
1108
 
1109
  # inputs
1110
- nodes = sample.get_nodes()
1111
- elements = sample.get_elements()
1112
 
1113
  # outputs
1114
  for time in time_steps:
1115
- for fn in [`U_x`, `U_y`]:
1116
- field = sample.get_field(fn, time = time)
1117
-
1118
- field = sample.get_field(`EROSION_STATUS`, location="CellCenter", time = time)
1119
 
1120
- # Get the mesh and convert it to Muscat
1121
- from Muscat.Bridges import CGNSBridge
1122
- CGNS_tree = sample.get_mesh(time = 0.)
1123
- mesh = CGNSBridge.CGNSToMesh(CGNS_tree)
1124
- print(mesh)
1125
  ```
1126
 
1127
  ## Dataset Details
 
1084
  Example of commands:
1085
  ```python
1086
  from datasets import load_dataset
1087
+ from plaid.bridges.huggingface_bridge import huggingface_dataset_to_plaid
 
1088
 
 
1089
  hf_dataset = load_dataset("PLAID-datasets/2D_ElastoPlastoDynamics", split="all_samples")
1090
 
1091
+ dataset, problem = huggingface_dataset_to_plaid(hf_dataset, processes_number = 4)
 
 
1092
 
1093
+ ids_train = problem.get_split('train')
1094
+ ids_test = problem.get_split('test')
1095
+
1096
+ sample_train_0 = dataset[ids_train[0]]
1097
+ sample_test_0 = dataset[ids_test[0]]
1098
 
 
 
 
1099
 
 
1100
  # time steps
1101
+ time_steps = sample_train_0.get_all_mesh_times()
1102
 
1103
  # inputs
1104
+ nodes = sample_train_0.get_nodes()
1105
+ elements = sample_train_0.get_elements()
1106
 
1107
  # outputs
1108
  for time in time_steps:
1109
+ for fn in ['U_x', 'U_y']:
1110
+ field = sample_train_0.get_field(fn, time = time)
 
 
1111
 
1112
+ field = sample_train_0.get_field('EROSION_STATUS', location="CellCenter", time = time)
 
 
 
 
1113
  ```
1114
 
1115
  ## Dataset Details