diff --git a/index.html b/index.html index 7d7a3a4442b2ee1b2ec006a33980df3f8fc78cb0..2d8c4eb18c74556192c743c7c11acc60a58d8f20 100755 --- a/index.html +++ b/index.html @@ -462,6 +462,7 @@ mosquitto_sub -h raspberrypi.local -t ohmpi_0001/ctrl // callback function to draw the plot function surveySelectFunc(el) { + let elecSpacing = parseFloat(document.getElementById('elecSpacing').value) let surveyName = el['target'].value let df = data[surveyName] if (df != undefined) { @@ -476,22 +477,44 @@ mosquitto_sub -h raspberrypi.local -t ohmpi_0001/ctrl let ypos = [] let app = [] for (let i = 0; i < a.length; i++) { + let emin = Math.min(...[a[i], b[i], m[i], n[i]]) let emax = Math.max(...[a[i], b[i], m[i], n[i]]) let dist = Math.abs(emax - emin) xpos.push(emin + dist/2) ypos.push(Math.sqrt(2)/2 * dist) - // let ab = (a[i] + b[i])/2 - // let mn = (m[i] + n[i])/2 - // xpos.push(Math.min(ab, mn) + dist/2) - // ypos.push(Math.sqrt(2)/2*dist) let am = Math.abs(a[i] - m[i]) let bm = Math.abs(b[i] - m[i]) let an = Math.abs(a[i] - n[i]) let bn = Math.abs(a[i] - n[i]) let K = (2*Math.PI)/((1/am)-(1/an)-(1/an)+(1/bn)) app.push(df['rho'][i]*K) + + // let a = df['a'][i] + // let b = df['b'][i] + // let m = df['m'][i] + // let n = df['n'][i] + + // // compute geometric factor assuming flat 2D surface + // let am = Math.abs(a - m)*elecSpacing + // let bm = Math.abs(b - m)*elecSpacing + // let an = Math.abs(a - n)*elecSpacing + // let bn = Math.abs(b - n)*elecSpacing + // let K = 2*Math.PI/((1/am)-(1/bm)-(1/an)+(1/bn)) + // app.push(df['rho'][i]*K) + // //console.log(K) // same as resipy for the wenner case + + // // computing pseudo-depth assuming 2D flat array + // // let's sort the electrodes AB are the two left, MN, the two right + // let abmn = [a, b, m, n] + // abmn = abmn.sort((a, b) => a - b) + // let ab = (abmn[0] + abmn[1])/2 + // let mn = (abmn[2] + abmn[3])/2 + // let dist = Math.abs(ab - mn) + // xpos.push((Math.min(ab, mn) + dist/2)*elecSpacing) + // ypos.push((Math.sqrt(2)/2*dist)*elecSpacing) } + console.log('========', app, xpos, ypos) // update the trace and redraw the figure trace['x'] = xpos trace['y'] = ypos