layout(matrix(1:6, 2, 3, byrow = TRUE))
XX<-read.csv("L2Mgrid2.csv")
print(names(XX))
attach(XX)
plot(ProbeX, ProbeY, typ='b')
plot(ProbeX, Xo.1.mV, typ='b')
points(ProbeX, Zo.1.mV, typ='b')
points(ProbeX, Zo.1.mV, typ='b', col='red')
points(ProbeX, Zo.2.mV, typ='b', col='green')
points(ProbeX, Zo.3.mV, typ='b', col='blue')
points(ProbeX, Xo.2.mV, typ='b', col='green')
points(ProbeX, Xo.3.mV, typ='b', col='blue')

mVAv<- (Xo.1.mV + Xo.2.mV + Xo.3.mV + Zo.1.mV + Zo.2.mV + Zo.3.mV)/6
plot(mVAv, typ='b')
plot(mVAv-lowess(mVAv, f=0.99)$y, typ='b')
nx<- 11
ny<- 9
XYgrid<-matrix(mVAv,9,11)
XYuvgrid<-matrix(AvgZo.ZuV,9,11)
for (i in seq(2,ny,2)) {
	 ProbeX[(i-1)*nx + 1:nx]<- ProbeX[(i-1)*nx + nx:1]
	 ProbeY[(i-1)*nx + 1:nx]<- ProbeY[(i-1)*nx + nx:1]
	 mVAv[(i-1)*nx + 1:nx]<- mVAv[(i-1)*nx + nx:1]
	 XYgrid[i,]<- mVAv[(i-1)*nx + nx:1]
	 XYuvgrid[i,]<- AvgZo.ZuV[(i-1)*nx + nx:1]
	 }
plot(ProbeX, ProbeY, typ='b')
plot(mVAv-lowess(mVAv, f=0.99)$y, typ='b')
browser()
contour(XYgrid, main = "XY mV", col=heat.colors(10))
persp(XYgrid)
contour(XYuvgrid, main = "XY uv", col=terrain.colors(10))
persp(XYuvgrid, main = "XYuvgrid")
detach(XX)