reflectanceTwo


two!
var data = json.data_raw;
var output = {};

var wavelengths = [420, 530, 605, 650, 730, 850, 880, 940];
var pulses = 20;
var trans_array = [];
var tester = wavelengths.length;
var outOfRange = 0; // note when a transmittance is out of range (the returned transmittance is greater than the max)

for (i = 0; i < wavelengths.length; i++) {
  var raw = MathROUND(MathMEDIAN(json.data_raw.slice(2 + pulses*i,8 + pulses*i)),0);
  var max = json.recall['userdef['+i+']'];
  if (max - raw > 0) {
    var trans = (max - raw) / max;
    output["trans_"+wavelengths[i]] = MathROUND(trans,2);
    trans_array[i] = trans;
  }
  else {
    outOfRange++;
  }  
 }

output["trans_array"] = trans_array;

if (outOfRange > 0) {
  output["outOfRange"] = outOfRange;
}

//output["tester"] = tester;

return output;
{
  "time_offset": 240,
  "time": 1504108494447,
  "device_name": "MultispeQ",
  "device_version": "1",
  "device_id": "00:00:00:0f",
  "device_battery": 41,
  "device_firmware": 1.2021,
  "sample": [
    {
      "time": 1504108494463,
      "protocol_id": 1,
      "label": "",
      "recall": {
        "time": 1504108494780,
        "userdef[1]": 47901,
        "userdef[2]": 44300,
        "userdef[3]": 48765,
        "userdef[4]": 52159,
        "userdef[5]": 45489,
        "userdef[6]": 41000,
        "userdef[7]": 41637,
        "userdef[8]": 52544
      },
      "data_raw": [
        20224,
        19573,
        19280,
        19033,
        18862,
        18673,
        18543,
        18499,
        18591,
        18651,
        18497,
        18398,
        18343,
        18158,
        18117,
        18149,
        17425,
        16953,
        16863,
        16702,
        20021,
        19983,
        19973,
        19987,
        19972,
        19966,
        19996,
        20009,
        19999,
        20016,
        19994,
        19966,
        19983,
        19989,
        20003,
        19988,
        20017,
        19953,
        20009,
        20001,
        22045,
        22025,
        22026,
        22035,
        22018,
        22023,
        22023,
        22014,
        22030,
        22023,
        22014,
        22035,
        22023,
        22022,
        22023,
        22024,
        22029,
        22019,
        22028,
        22017,
        27811,
        27813,
        27814,
        27805,
        27805,
        27816,
        27804,
        27804,
        27813,
        27809,
        27807,
        27809,
        27807,
        27807,
        27807,
        27810,
        27802,
        27808,
        27813,
        27802,
        31288,
        31255,
        31258,
        31253,
        31254,
        31261,
        31241,
        31255,
        31250,
        31245,
        31251,
        31251,
        31250,
        31245,
        31253,
        31248,
        31247,
        31253,
        31255,
        31243,
        29015,
        28727,
        28712,
        28707,
        28699,
        28710,
        28687,
        28693,
        28688,
        28694,
        28697,
        28692,
        28689,
        28692,
        28691,
        28691,
        28698,
        28702,
        28705,
        28701,
        28336,
        28327,
        28324,
        28327,
        28322,
        28318,
        28323,
        28319,
        28321,
        28314,
        28317,
        28322,
        28310,
        28319,
        28311,
        28315,
        28311,
        28313,
        28315,
        28307,
        28623,
        28423,
        28414,
        28406,
        28412,
        28391,
        28402,
        28405,
        28401,
        28403,
        28399,
        28396,
        28394,
        28400,
        28401,
        28393,
        28401,
        28399,
        28402,
        28397
      ]
    }
  ],
  "app_os": "linux",
  "app_name": "PhotosynQ",
  "app_version": "0.3.8",
  "app_device": "x86-64",
  "location": [
    "42.5951865",
    "-76.6932325"
  ],
  "ConsoleMacro": "382"
}
Default avatar
Created by

Jon S


Protocol connections:
1
Latest Update:
Aug 2017