Download load_example.py from HaomingLuo/AgentFEM-MultiSource-Heat-2D: direct link, hf CLI and curl.
- Browser
- Download file 955 Bytes
-
https://huggingface.co/datasets/HaomingLuo/AgentFEM-MultiSource-Heat-2D/resolve/main/load_example.py
- Command line
-
hf download hf://datasets/HaomingLuo/AgentFEM-MultiSource-Heat-2D/load_example.py
-
curl -L -o load_example.py https://huggingface.co/datasets/HaomingLuo/AgentFEM-MultiSource-Heat-2D/resolve/main/load_example.py
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())) | |