Download plot_small_clone_frames.py from think-right/pde-discover: direct link, hf CLI and curl.
- Browser
- Download file 1.2 kB
-
https://huggingface.co/datasets/think-right/pde-discover/resolve/main/plot_small_clone_frames.py
- Command line
-
hf download hf://datasets/think-right/pde-discover/plot_small_clone_frames.py
-
curl -L -o plot_small_clone_frames.py https://huggingface.co/datasets/think-right/pde-discover/resolve/main/plot_small_clone_frames.py
1.2 kB
| from pathlib import Path | |
| import h5py | |
| import numpy as np | |
| import matplotlib | |
| matplotlib.use('Agg') | |
| import matplotlib.pyplot as plt | |
| ROOT=Path(__file__).resolve().parents[2] | |
| DATA=ROOT/'outputs/eqgpt-research/stage2-corpus-2026-11-15/realpde-small-clone-final' | |
| OUT=DATA/'plots'; OUT.mkdir(exist_ok=True) | |
| for case,title in [('heat_equation','Heat equation'),('burgers_equation','2D Burgers equation')]: | |
| with h5py.File(DATA/case/'numerical'/'0000.h5','r') as f: | |
| u=f['measured_data/u'][:] | |
| t=f['t'][:] | |
| x=f['x'][:]; y=f['y'][:] | |
| idx=[0,99,199,299,399] | |
| v=float(np.max(np.abs(u[idx]))) | |
| fig,axes=plt.subplots(1,5,figsize=(18,4),constrained_layout=True) | |
| for ax,i in zip(axes,idx): | |
| im=ax.imshow(u[i],origin='lower',extent=(float(x.min()),float(x.max()),float(y.min()),float(y.max())),cmap='viridis',vmin=-v,vmax=v,interpolation='nearest',aspect='auto') | |
| ax.set_title(f't={t[i]:.3f}') | |
| ax.set_xlabel('x'); ax.set_ylabel('y') | |
| fig.colorbar(im,ax=axes,shrink=.8,label='u') | |
| fig.suptitle(f'{title}: trajectory 0000, five complete frames',fontsize=15) | |
| fig.savefig(OUT/f'{case}_five_frames.png',dpi=220,bbox_inches='tight') | |
| plt.close(fig) | |