V1 ECSt / ESCst EN PROCESO


PARA ecs
// The measures DIRK ECS using on-off-on actinic, with actinic pulled from the PAR sensor.  This measurement smooths out the dark period by using a 2 layer smoothing.
// should I calibrate this to a 940 signal, to estimate thickness?

var output = {};
var spad;

var vhplus;
var tau;
var ECSt;
var quality_flag = 0;
var i = 0;
var j = 0;
var h = 0;
var k = 0;
var dark = MathMEAN(json.data_raw.slice(3,9));
var min = MathMEAN(json.data_raw.slice(11,15));
var delta = MathLOG(dark/min);
output ["ABS ST"] = MathROUND(delta, 6);


// This is the area which needs to be smoothed out,  the _abs version will be absorbance values
var smooth1 = json.data_raw.slice(320,620);
var smooth1_abs = [];

// points 300 and 301 can be affected by electronic blips, so we set them == to the average of the previous 'on' values
var fixit = MathMEAN(json.data_raw.slice(250,310));
smooth1[0] = fixit;
smooth1[1] = fixit;

// create an rolling average for every 2 measurements.  Then repeat with ever 3.  Then 4, etc.  Then repeat that process 5 times.

var tbsmooth = 0;

///*
// first just smooth out the big bumps
for (k=0;k<15;k++) {
  for (h=2;h<3;h++) {
    for (j=1;j<296;j++) {
      tbsmooth = 0;
      for (i=0;i<h;i++) {
        tbsmooth += smooth1[i+j];  // sum current point + next point
      }
      smooth1[j] = MathROUND(tbsmooth/h,0);
    }
  }
}

// then roll out the kinks
for (k=0;k<7;k++) {
  for (h=2;h<5;h++) {
    for (j=1;j<296;j++) {
      tbsmooth = 0;
      for (i=0;i<h;i++) {
        tbsmooth += smooth1[i-1+j];  // sum previous 1 point + next h-1 point(s)
      }
      smooth1[j] = MathROUND(tbsmooth/h,0);
    }
  }
}
//*/

// now convert smooth1 into absorbance ( abs = log(Is / I0) )
for (var x=0;x<300;x++) {
  smooth1_abs[x] = MathLOG(smooth1[x]/smooth1[0]);
}


// calculate ECSt
max = MathMEAN(smooth1_abs.sort().slice(10,299));
var min = smooth1_abs[0];
ECSt = max - min;

// Calculate GH+ by finding the 1/e point in the dark period
var tmpval;
var howclose_e = 1;
var tmpslope = 0;
var close_e = [];
var slope_e = [];
for (k=0;k<299;k++) {
  tmpval = (smooth1_abs[k]-min)/(max-min);
  howclose_e = (1/Math.E - tmpval);
  close_e[k] = MathROUND((1/Math.E - tmpval),3);
  // if slope is largest, then choose it for vhplus up to tau
  if (((smooth1_abs[k+1]-min)/(max-min) - tmpval) > tmpslope) {
    vhplus = (smooth1_abs[k+1]-min)/(max-min) - tmpval;
  }
  tmpslope = (smooth1_abs[k+1]-min)/(max-min) - tmpval;
  slope_e[k] = MathROUND((smooth1_abs[k+1]-min)/(max-min) - tmpval,4);
  // once you hit tau, then stop iterating
  if (howclose_e < 0) {
    tau = (smooth1_abs[k]-min)/(max-min);
    break;
  }
}

// Check for quality issues
// issue 1: large standard deviation in the first 'on' period
var st_dev_on = MathSTDEV(json.data_raw.slice(20,290));
if (st_dev_on > 50) {
  quality_flag++;
}

if (quality_flag > 0) {
  output ["quality flag"] = quality_flag;
  output ["st_dev_on"] = MathROUND(st_dev_on,0);
}

output ["log out"] = smooth1_abs;
var ECStst = ECSt/delta;
output ["ECSt/ECSst"] = MathROUND(ECStst,4);
output ["ECSt"] = MathROUND(ECSt,4);
output ["vhplus"] = MathROUND(vhplus,4);
output ["ghplus"] = 1/MathROUND(tau,4);
//output ["close_e"] = close_e;
//output ["slope_e"] = slope_e;
//output ["smooth1"] = smooth1;


return output;
{
  "time_offset": 180,
  "time": 1497208914858,
  "device_name": "MultispeQ",
  "device_version": "1",
  "device_id": "01:06:11:88",
  "device_battery": 17,
  "device_firmware": 1.17,
  "sample": [
    {
      "time": 1497208914873,
      "protocol_id": 1,
      "data_raw": [
        31311,
        38871,
        38947,
        38967,
        38970,
        38967,
        38964,
        38981,
        38975,
        38955,
        37138,
        38808,
        38808,
        38816,
        38795,
        38817,
        38815,
        38809,
        38809,
        38818,
        38975,
        38936,
        38916,
        38894,
        38877,
        38869,
        38845,
        38819,
        38806,
        38783,
        38766,
        38751,
        38744,
        38723,
        38734,
        38737,
        38719,
        38722,
        38716,
        38716,
        38719,
        38731,
        38711,
        38731,
        38737,
        38725,
        38731,
        38733,
        38729,
        38737,
        38745,
        38749,
        38745,
        38754,
        38755,
        38765,
        38771,
        38767,
        38764,
        38775,
        38775,
        38775,
        38789,
        38789,
        38785,
        38787,
        38779,
        38786,
        38805,
        38799,
        38805,
        38790,
        38804,
        38815,
        38797,
        38799,
        38811,
        38800,
        38811,
        38809,
        38800,
        38819,
        38813,
        38821,
        38810,
        38810,
        38817,
        38822,
        38814,
        38829,
        38826,
        38822,
        38834,
        38835,
        38822,
        38831,
        38831,
        38826,
        38847,
        38837,
        38829,
        38845,
        38831,
        38839,
        38855,
        38841,
        38841,
        38847,
        38844,
        38843,
        38859,
        38845,
        38844,
        38855,
        38845,
        38851,
        38847,
        38837,
        38855,
        38847,
        38853,
        38847,
        38855,
        38847,
        38846,
        38853,
        38855,
        38843,
        38855,
        38865,
        38850,
        38855,
        38865,
        38853,
        38847,
        38852,
        38855,
        38855,
        38861,
        38862,
        38853,
        38857,
        38862,
        38849,
        38849,
        38854,
        38870,
        38858,
        38868,
        38866,
        38871,
        38858,
        38861,
        38867,
        38870,
        38863,
        38874,
        38869,
        38859,
        38867,
        38867,
        38857,
        38859,
        38859,
        38862,
        38850,
        38863,
        38871,
        38854,
        38864,
        38866,
        38869,
        38861,
        38869,
        38870,
        38875,
        38874,
        38871,
        38867,
        38853,
        38859,
        38866,
        38858,
        38855,
        38869,
        38867,
        38861,
        38859,
        38855,
        38860,
        38862,
        38869,
        38872,
        38865,
        38863,
        38861,
        38854,
        38863,
        38866,
        38863,
        38879,
        38875,
        38880,
        38875,
        38877,
        38865,
        38859,
        38869,
        38863,
        38854,
        38854,
        38874,
        38863,
        38862,
        38855,
        38854,
        38846,
        38858,
        38855,
        38851,
        38855,
        38863,
        38855,
        38861,
        38857,
        38851,
        38849,
        38845,
        38851,
        38839,
        38861,
        38863,
        38859,
        38858,
        38855,
        38846,
        38845,
        38851,
        38841,
        38847,
        38854,
        38858,
        38845,
        38841,
        38854,
        38847,
        38850,
        38853,
        38854,
        38841,
        38850,
        38849,
        38839,
        38845,
        38845,
        38833,
        38843,
        38845,
        38836,
        38836,
        38839,
        38830,
        38835,
        38848,
        38837,
        38831,
        38846,
        38829,
        38827,
        38833,
        38839,
        38823,
        38835,
        38826,
        38826,
        38838,
        38831,
        38827,
        38834,
        38823,
        38823,
        38815,
        38815,
        38821,
        38819,
        38819,
        38823,
        38799,
        38813,
        38814,
        38806,
        38815,
        38817,
        38803,
        38813,
        38816,
        38813,
        38799,
        38810,
        38810,
        38803,
        38807,
        38810,
        38799,
        38795,
        38810,
        38797,
        38799,
        38799,
        38796,
        38791,
        38799,
        38801,
        38798,
        38787,
        38795,
        38786,
        38790,
        38790,
        38793,
        38780,
        38787,
        38798,
        38806,
        38794,
        38799,
        38809,
        38798,
        38819,
        38818,
        38811,
        38829,
        38839,
        38820,
        38829,
        38839,
        38829,
        38832,
        38845,
        38839,
        38850,
        38858,
        38853,
        38841,
        38845,
        38845,
        38831,
        38841,
        38851,
        38855,
        38861,
        38857,
        38852,
        38857,
        38850,
        38853,
        38863,
        38857,
        38859,
        38869,
        38862,
        38861,
        38861,
        38861,
        38857,
        38862,
        38859,
        38863,
        38873,
        38870,
        38868,
        38874,
        38863,
        38877,
        38875,
        38881,
        38889,
        38885,
        38885,
        38865,
        38870,
        38869,
        38879,
        38871,
        38874,
        38887,
        38886,
        38890,
        38887,
        38885,
        38882,
        38880,
        38894,
        38890,
        38879,
        38887,
        38885,
        38885,
        38887,
        38887,
        38874,
        38881,
        38889,
        38883,
        38889,
        38890,
        38885,
        38889,
        38895,
        38903,
        38887,
        38899,
        38901,
        38891,
        38890,
        38895,
        38874,
        38883,
        38888,
        38892,
        38883,
        38891,
        38897,
        38887,
        38903,
        38914,
        38903,
        38895,
        38895,
        38903,
        38887,
        38886,
        38893,
        38898,
        38887,
        38894,
        38901,
        38887,
        38889,
        38895,
        38893,
        38897,
        38905,
        38906,
        38899,
        38898,
        38901,
        38895,
        38892,
        38899,
        38905,
        38899,
        38893,
        38893,
        38895,
        38887,
        38898,
        38891,
        38896,
        38902,
        38900,
        38895,
        38891,
        38901,
        38903,
        38892,
        38901,
        38901,
        38901,
        38901,
        38908,
        38901,
        38899,
        38900,
        38891,
        38899,
        38895,
        38905,
        38898,
        38894,
        38905,
        38918,
        38893,
        38905,
        38908,
        38899,
        38899,
        38907,
        38901,
        38894,
        38887,
        38900,
        38888,
        38891,
        38905,
        38903,
        38898,
        38895,
        38899,
        38898,
        38889,
        38901,
        38907,
        38903,
        38897,
        38899,
        38901,
        38902,
        38905,
        38906,
        38894,
        38899,
        38903,
        38903,
        38900,
        38895,
        38901,
        38905,
        38908,
        38906,
        38893,
        38902,
        38907,
        38891,
        38907,
        38911,
        38900,
        38891,
        38899,
        38903,
        38893,
        38892,
        38901,
        38907,
        38897,
        38899,
        38887,
        38887,
        38895,
        38896,
        38895,
        38891,
        38902,
        38900,
        38887,
        38895,
        38893,
        38891,
        38893,
        38903,
        38892,
        38899,
        38900,
        38895,
        38901,
        38906,
        38905,
        38891,
        38898,
        38909,
        38896,
        38895,
        38901,
        38917,
        38903,
        38895,
        38902,
        38903,
        38895,
        38893,
        38903,
        38903,
        38896,
        38901,
        38903,
        38900,
        38901,
        38912,
        38902,
        38893,
        38901,
        38895,
        38891,
        38902,
        38903,
        38884,
        38897,
        38899,
        38893,
        38903,
        38899,
        38899,
        38908,
        38899,
        38907,
        38899,
        38901,
        38905,
        38911,
        38899,
        38897,
        38895,
        38887,
        38893,
        38903,
        38891,
        38887,
        38900,
        38885,
        38895,
        38895,
        38887,
        38917,
        38908,
        38900,
        38905,
        38895,
        38899,
        38901,
        38898,
        38895,
        38883,
        38875,
        38851,
        38845,
        38832,
        38811,
        38800,
        38798,
        38783,
        38773,
        38770,
        38763,
        38750,
        38727,
        38749,
        38742,
        38723,
        38727,
        38729,
        38713,
        38713,
        38717,
        38715,
        38712,
        38719,
        38723,
        38707,
        38722,
        38722,
        38713,
        38715,
        38707,
        38715,
        38719,
        38707,
        38715,
        38721,
        38707,
        38722,
        38717,
        38709,
        38716,
        38719,
        38715,
        38714,
        38721,
        38713,
        38720,
        38725,
        38716,
        38727,
        38719,
        38726,
        38729,
        38719,
        38719,
        38725,
        38710,
        38723,
        38720,
        38731,
        38734,
        38714,
        38729,
        38726,
        38722,
        38729,
        38723,
        38727,
        38728,
        38729,
        38714,
        38723,
        38727,
        38722,
        38725,
        38730,
        38727,
        38727,
        38732,
        38719,
        38733,
        38733,
        38724,
        38731,
        38732,
        38727,
        38735,
        38735,
        38727,
        38727,
        38723,
        38725,
        38734,
        38719,
        38733,
        38740,
        38727,
        38730,
        38730,
        38729,
        38727,
        38735,
        38727,
        38731,
        38735,
        38731,
        38742,
        38727,
        38723,
        38733,
        38734,
        38729,
        38727,
        38724,
        38719,
        38726,
        38722,
        38725,
        38725,
        38725,
        38721,
        38727,
        38721,
        38722,
        38730,
        38726,
        38717,
        38727,
        38728,
        38723,
        38727,
        38725,
        38724,
        38739,
        38719,
        38719,
        38722,
        38716,
        38711,
        38725,
        38721,
        38709,
        38716,
        38711,
        38709,
        38711,
        38718,
        38714,
        38719,
        38716,
        38716,
        38710,
        38716,
        38719,
        38710,
        38716,
        38713,
        38711,
        38706,
        38718,
        38703,
        38711,
        38711,
        38716,
        38703,
        38711,
        38713,
        38703,
        38709,
        38715,
        38703,
        38720,
        38719,
        38711,
        38701,
        38716,
        38703,
        38701,
        38717,
        38709,
        38714,
        38715,
        38709,
        38707,
        38722,
        38724,
        38703,
        38717,
        38721,
        38715,
        38715,
        38711,
        38719,
        38715,
        38725,
        38711,
        38709,
        38711,
        38710,
        38705,
        38710,
        38719,
        38712,
        38711,
        38716,
        38711,
        38706,
        38713,
        38710,
        38710,
        38707,
        38723,
        38705,
        38707,
        38705,
        38710,
        38699,
        38706,
        38726,
        38714,
        38715,
        38718,
        38710,
        38703,
        38715,
        38711,
        38706,
        38707,
        38718,
        38717,
        38703,
        38724,
        38719,
        38709,
        38719,
        38717,
        38719,
        38708,
        38709,
        38721,
        38705,
        38711,
        38715,
        38718,
        38719,
        38719,
        38721,
        38716,
        38707,
        38707,
        38717,
        38715,
        38709,
        38719,
        38711,
        38711,
        38721,
        38725,
        38705,
        38726,
        38721,
        38716,
        38726,
        38725,
        38716,
        38723,
        38727,
        38721,
        38724,
        38716,
        38718,
        38722,
        38715,
        38719,
        38727,
        38708,
        38722,
        38722,
        38707,
        38717,
        38712,
        38705,
        38711,
        38717,
        38706,
        38716,
        38727,
        38717,
        38714,
        38721,
        38723,
        38723,
        38722,
        38711,
        38722,
        38730,
        38735,
        38723
      ]
    }
  ],
  "app_os": "win",
  "app_name": "PhotosynQ",
  "app_version": "0.3.8",
  "app_device": "x86-32",
  "location": [
    "-32.9685385",
    "-60.6568252"
  ],
  "ConsoleMacro": "209"
}
Img 20171030 190259
Created by

Rodrigo Gomez


Protocol connections:
1
Latest Update:
Jun 2017