File size: 955 Bytes
d095916
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Load one full-field sample; no FEM or AI runtime needed. Apache-2.0."""
import argparse, json
import h5py
from huggingface_hub import hf_hub_download

if __name__=="__main__":
    p=argparse.ArgumentParser(); p.add_argument("--repo",required=True)
    p.add_argument("--split",choices=["train","validation","test"],default="test")
    args=p.parse_args()
    path=hf_hub_download(args.repo,filename=args.split+".h5",repo_type="dataset")
    with h5py.File(path) as f:
        sample_id=sorted(f.keys())[0]; sample=f[sample_id]
        print("Sample",sample_id, json.loads(sample.attrs["parameters_json"]))
        print("Coordinates:",sample["coordinates"].shape,"Connectivity:",sample["connectivity"].shape)
        for location in ["point","cell"]:
            if location in sample:
                for name,field in sample[location].items():
                    print(location,name,field.shape,"range:",float(field[:].min()),float(field[:].max()))