# Last edited on 2021-07-31 12:33:36 by jstolfi from hann_bell import hann_bell from basis_sample import basis_sample def basis_2d_hann_sample(c, r, s): # Evluates at the sample points {s} the 2d Hann bell basis functions whose # centroids are in {c} and whose radii are in {r}. # # Both the centroid and radius of each basis element must be a 2-tuple of floats. # # Returns a list {B} of {nf} lists, each element being a list of # {ns=len(s)} floats; such that {B[i][k]} is the 2d Hann bell basis # element with centroid {c[i]} and radius {r[i]} evaluated at the point {s[k]}. nb = len(c); def basis_hann(i, p): # Evaluates the 2d Hann bell basis element {i} on sampling point {p}. cxi,cyi = c[i] rxi,ryi = r[i] hx = hann_bell((p[0]-cxi)/rxi) hy = hann_bell((p[1]-cyi)/ryi) Bp = hx*hy return Bp; # ...................................................................... B = basis_sample(nb, basis_hann, s); return B # ----------------------------------------------------------------------