AgentFEM-MultiSource-Heat-2D / load_example.py
HaomingLuo's picture
Publish 256 verified AgentFEM heat-conduction cases
d095916 verified
Raw History Blame Contribute Delete
955 Bytes
"""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()))