Trouble making topographical EEG interpolation

Using GMT and the tip from @joa-quim here, you can produce a contour plot like this (OP’s script has random sampling, so input is different):

# GMT GRIDDING (Smith and Wessel [1990] Splines in tension):
using GMT
data = [electrode_locs_X electrode_locs_Y timepoint_trial_data]
x = y = LinRange(-0.65, 0.65, 100)
G = GMT.surface(data, R=(extrema(x)..., extrema(y)...), inc=(step(x), step(y)), T=0.1)

# GMT PLOTTING
circ0 = reduce(vcat, 0.65*[[cos(θ) sin(θ)] for θ in 0:0.1:2π])    # circle
GMT.contourf(G, clip=circ0, fmt=:png, show=true)

NB:
the spline interpolation method used acts along “flat” x-y support coordinates, but as mentioned it is also possible to use spherical surface splines acting along an ellipsoid

1 Like