File size: 603 Bytes
483c6e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import numpy as np

INSTANTS = (11.20, 13.38, 14.70)
FIELDS = ("dkappa", "dWp", "D")


def load(path, field, instants=INSTANTS):
    f = np.load(path)
    t = f["time"]
    frames = [int(np.argmin(np.abs(t - s))) for s in instants]
    x = f["x"].astype(float)
    y = f["y"].astype(float)
    true = f[field][frames].astype(float)
    cap = float(true.max())
    return dict(x=x, y=y, true=true, times=t[frames].astype(float),
                scale=float(np.abs(x).max()), cap=cap, band_thr=0.5 * cap)


def normalised_coords(fd):
    return np.stack([fd["x"] / fd["scale"], fd["y"] / fd["scale"]], 1)