Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -1919,59 +1919,33 @@ Mesh objects included in samples follow the [CGNS](https://cgns.github.io/) stan
|
|
| 1919 |
Example of commands:
|
| 1920 |
```python
|
| 1921 |
from datasets import load_dataset
|
| 1922 |
-
from plaid.
|
| 1923 |
-
import pickle
|
| 1924 |
|
| 1925 |
-
# Load the dataset
|
| 1926 |
hf_dataset = load_dataset("PLAID-datasets/VKI-LS59", split="all_samples")
|
| 1927 |
|
| 1928 |
-
|
| 1929 |
-
ids_train = hf_dataset.description["split"]['train']
|
| 1930 |
-
ids_test = hf_dataset.description["split"]['test']
|
| 1931 |
|
| 1932 |
-
|
| 1933 |
-
|
| 1934 |
-
out_fields_names = hf_dataset.description["out_fields_names"]
|
| 1935 |
|
| 1936 |
-
|
| 1937 |
-
|
| 1938 |
-
sample_2 = Sample.model_validate(pickle.loads(hf_dataset[ids_test[0]]["sample"]))
|
| 1939 |
|
| 1940 |
-
# Examples data retrievals
|
| 1941 |
-
for fn in ["sdf", "ro", "rou", "rov", "roe", "nut", "mach"]:
|
| 1942 |
-
field = sample.get_field(fn, base_name="Base_2_2")
|
| 1943 |
-
M_iso = sample.get_field("M_iso", base_name="Base_1_2")
|
| 1944 |
-
for sn in sample.get_scalar_names():
|
| 1945 |
-
scalar = sample.get_scalar(sn)
|
| 1946 |
-
|
| 1947 |
-
print("nodes 2D (flow) =", sample.get_nodes(base_name="Base_2_2"))
|
| 1948 |
-
print("nodes 1D (blade surface) =", sample.get_nodes(base_name="Base_1_2"))
|
| 1949 |
-
print("elements 2D (flow) =", sample.get_elements(base_name="Base_2_2"))
|
| 1950 |
-
print("elements 1D (blade surface) =", sample.get_elements(base_name="Base_1_2"))
|
| 1951 |
-
print("nodal_tags 2D (flow) =", sample.get_nodal_tags(base_name="Base_2_2"))
|
| 1952 |
|
| 1953 |
# inputs
|
| 1954 |
-
nodes =
|
| 1955 |
-
elements =
|
| 1956 |
-
nodal_tags =
|
| 1957 |
-
sdf =
|
| 1958 |
-
angle_in =
|
| 1959 |
-
mach_out =
|
| 1960 |
|
| 1961 |
# outputs
|
| 1962 |
-
mach =
|
| 1963 |
-
nut =
|
| 1964 |
|
| 1965 |
for sn in ["Q", "power", "Pr", "Tr", "eth_is", "angle_out"]:
|
| 1966 |
-
outscalar =
|
| 1967 |
-
|
| 1968 |
-
# Get the mesh and convert it to Muscat
|
| 1969 |
-
from Muscat.Bridges import CGNSBridge
|
| 1970 |
-
CGNS_tree = sample.get_mesh()
|
| 1971 |
-
mesh_fluid = CGNSBridge.CGNSToMesh(CGNS_tree, baseNames=["Base_2_2"])
|
| 1972 |
-
print(mesh_fluid)
|
| 1973 |
-
mesh_blade = CGNSBridge.CGNSToMesh(CGNS_tree, baseNames=["Base_1_2"])
|
| 1974 |
-
print(mesh_blade)
|
| 1975 |
```
|
| 1976 |
|
| 1977 |
## Dataset Details
|
|
|
|
| 1919 |
Example of commands:
|
| 1920 |
```python
|
| 1921 |
from datasets import load_dataset
|
| 1922 |
+
from plaid.bridges.huggingface_bridge import huggingface_dataset_to_plaid
|
|
|
|
| 1923 |
|
|
|
|
| 1924 |
hf_dataset = load_dataset("PLAID-datasets/VKI-LS59", split="all_samples")
|
| 1925 |
|
| 1926 |
+
dataset, problem = huggingface_dataset_to_plaid(hf_dataset, processes_number = 4)
|
|
|
|
|
|
|
| 1927 |
|
| 1928 |
+
ids_train = problem.get_split('train')
|
| 1929 |
+
ids_test = problem.get_split('test')
|
|
|
|
| 1930 |
|
| 1931 |
+
sample_train_0 = dataset[ids_train[0]]
|
| 1932 |
+
sample_test_0 = dataset[ids_test[0]]
|
|
|
|
| 1933 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1934 |
|
| 1935 |
# inputs
|
| 1936 |
+
nodes = sample_train_0.get_nodes(base_name="Base_2_2")
|
| 1937 |
+
elements = sample_train_0.get_elements(base_name="Base_2_2")
|
| 1938 |
+
nodal_tags = sample_train_0.get_nodal_tags(base_name="Base_2_2")
|
| 1939 |
+
sdf = sample_train_0.get_field("sdf", base_name="Base_2_2")
|
| 1940 |
+
angle_in = sample_train_0.get_scalar("angle_in")
|
| 1941 |
+
mach_out = sample_train_0.get_scalar("mach_out")
|
| 1942 |
|
| 1943 |
# outputs
|
| 1944 |
+
mach = sample_train_0.get_field("mach", base_name="Base_2_2")
|
| 1945 |
+
nut = sample_train_0.get_field("nut", base_name="Base_2_2")
|
| 1946 |
|
| 1947 |
for sn in ["Q", "power", "Pr", "Tr", "eth_is", "angle_out"]:
|
| 1948 |
+
outscalar = sample_train_0.get_scalar(sn)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1949 |
```
|
| 1950 |
|
| 1951 |
## Dataset Details
|