v1 - fluctuating light RG


for fluctuation
var data = json.data_raw;
var output = {};
var sample_cal = MathMEAN(data.slice(2,20));
var baseline;

var sample_cal = json.detector_read1;//es para la luz 940

var shinyness = (sample_cal-json.recall["ir_baseline_yint[5]"])/json.recall["ir_baseline_slope[5]"]; // where 0 is dull black electrical tape, and 1 is shiny aluminum
var baseline = json.recall["ir_baseline_slope[3]"]*shinyness+json.recall["ir_baseline_yint[3]"];

if (!baseline || !json.recall["ir_baseline_yint[5]"] || sample_cal == 65535) {						// if it hasn't been calibrated or there's an error or it's maxed, set baseline == 0
  baseline = 0;
}





var F0 = MathMEAN(data.slice(40,48)) - baseline;
var Fm_sort = data.slice(50,100).sort();
var Fm = MathMEAN(Fm_sort.slice(45,50)) - baseline; // take the 4 largest values and average them
var fvfm = (Fm-F0)/Fm;
var Fs50 = {};
var Fs1000 = {};
var Fmp1000 = {};
var Fmp50 = {};
var Fss = {};
var Fmm = {};
var Phi = {};
var qL = {};
var NPQ = {};


// dark adapted values
var l = 1;
var n = 1;
output ['F0'] = MathROUND(F0,0);
output ["Fm"] = MathROUND(Fm,0);
output["Fv/Fm"] = MathROUND(fvfm,3); // if the top values are greater than 10% of the mean value of midle 20 data points, then the macro shows the mean of the midle group of values \
var x = 200;

for (i=1; i < 9; i ++) {
var frag = data.slice(x,x+100);
var Fs = MathMEAN(frag.slice(45,49)) - baseline;
var Fmsort = frag.slice(51,100).sort();
var Fmp = MathMEAN(Fmsort.slice(45,50)) - baseline;
var Phi2 = (Fmp - Fs) / Fmp;
  var NPQ = (Fm - Fmp) / Fmp;
  Fss[i] = Fs;
  Fmm[i] = Fmp;
  Phi[i] = Phi2;
  NPQ[i] = NPQ;
  
      
  
  x = x +150;
  

  
  }
var h = 1;
for (g=1;  g < 4; g++) {

  output ["Fs 50 -" + g] = MathROUND(Fss[h],0);
     
  h = h +2;
}
var j = 2;
for (g=1;  g < 4; g++) {

  output ["Fs 1000 -" + g] = MathROUND(Fss[j],0);
     
  j = j +2;
}
var h = 1;
for (g=1;  g < 4; g++) {

  output ["Fmp 50 -" + g] = MathROUND(Fmm[h],0);
     
  h = h +2;
}
var j = 2;
for (g=1;  g < 4; g++) {

  output ["Fmp 1000 -" + g] = MathROUND(Fmm[j],0);
     
  j = j +2;
}
var h = 1;
for (g=1;  g < 4; g++) {

  output ["Phi 50 -" + g] = MathROUND(Phi[h],4);
     
  h = h +2;
}
var j = 2;
for (g=1;  g < 4; g++) {

  output ["Phi 1000 -" + g] = MathROUND(Phi[j],4);
     
  j = j +2;
}

  //output ["Phi2 - " + g] = MathROUND(Phi2,3);



output ["baseline"] = baseline ;
/* 
var i5 = json.recall["ir_baseline_yint[5]"];
var s5 = json.recall["ir_baseline_slope[5]"];
var i3 = json.recall["ir_baseline_yint[3]"];
var s3 = json.recall["ir_baseline_slope[3]"];
output ["int5"] = i5;
output ["slope5"] = s5;
output ["int3"] = i3;

output ["slope3"] = s3;

*/
return output;
{
  "time_offset": 180,
  "time": 1497227120993,
  "device_name": "MultispeQ",
  "device_version": "1",
  "device_id": "01:06:11:88",
  "device_battery": 13,
  "device_firmware": 1.17,
  "sample": [
    {
      "time": 1497227121107,
      "protocol_id": 1,
      "detector_read1": 8566,
      "light_intensity": 2,
      "r": 0,
      "g": 0,
      "b": 0,
      "light_intensity_raw": 0,
      "temperature": 20.6,
      "humidity": 61.969727,
      "pressure": 1016.920105,
      "temperature2": 20.85,
      "humidity2": 60.633789,
      "pressure2": 1017.251892,
      "contactless_temp": 20.25,
      "thickness": 0.25,
      "compass_direction": "E",
      "compass": "90.00",
      "angle": 2.65,
      "angle_direction": "SE",
      "pitch": 1.09,
      "roll": 2.41,
      "recall": {
        "time": 1497227215552,
        "colorcal_blank1[1]": 16511.5,
        "colorcal_blank1[2]": 24324.5,
        "colorcal_blank1[3]": 29277.5,
        "colorcal_blank1[4]": 37138,
        "colorcal_blank1[6]": 33194,
        "colorcal_blank1[8]": 28720.5,
        "colorcal_blank1[9]": 31100,
        "colorcal_blank1[10]": 34614,
        "colorcal_blank2[1]": 21662,
        "colorcal_blank2[2]": 18077,
        "colorcal_blank2[3]": 21188.5,
        "colorcal_blank2[4]": 18162,
        "colorcal_blank2[6]": 16493.5,
        "colorcal_blank2[8]": 17087,
        "colorcal_blank2[9]": 18622,
        "colorcal_blank2[10]": 16523.5,
        "colorcal_blank3[1]": 20515.5,
        "colorcal_blank3[2]": 9866,
        "colorcal_blank3[3]": 19621.5,
        "colorcal_blank3[4]": 13418.5,
        "colorcal_blank3[6]": 5898.5,
        "colorcal_blank3[8]": 6295.5,
        "colorcal_blank3[9]": 5582,
        "colorcal_blank3[10]": 6047,
        "colorcal_intensity1_slope[2]": 2.309,
        "colorcal_intensity1_yint[2]": 1.7,
        "colorcal_intensity2_slope[2]": 2.377,
        "colorcal_intensity2_yint[2]": 3,
        "colorcal_intensity3_slope[2]": 2.554,
        "colorcal_intensity3_yint[2]": -17.299999,
        "ir_baseline_slope[5]": 8895,
        "ir_baseline_yint[5]": 13422.5,
        "ir_baseline_slope[3]": 526.5,
        "ir_baseline_yint[3]": 738.5
      },
      "data_raw": [
        6099,
        6096,
        6091,
        6094,
        6095,
        6094,
        6094,
        6091,
        6094,
        6090,
        6087,
        6095,
        6087,
        6095,
        6088,
        6093,
        6095,
        6093,
        6098,
        6093,
        6095,
        6092,
        6091,
        6085,
        6091,
        1478,
        1493,
        1496,
        1509,
        1513,
        1529,
        1531,
        1547,
        1555,
        1567,
        1574,
        1582,
        1590,
        1594,
        1607,
        1610,
        1623,
        1627,
        1639,
        1645,
        1651,
        1660,
        1660,
        1671,
        1671,
        1681,
        4949,
        5779,
        6110,
        6247,
        6317,
        6369,
        6414,
        6461,
        6501,
        6543,
        6586,
        6634,
        6692,
        6735,
        6784,
        6823,
        6859,
        6891,
        6915,
        6939,
        6957,
        6972,
        6985,
        6991,
        7002,
        7007,
        7011,
        7013,
        7015,
        7015,
        7021,
        7021,
        7019,
        7019,
        7018,
        7017,
        7019,
        7022,
        7022,
        7023,
        7023,
        7025,
        7025,
        7027,
        7029,
        7031,
        7027,
        7029,
        7028,
        6309,
        5930,
        5711,
        5558,
        5448,
        5357,
        5287,
        5222,
        5172,
        5132,
        5089,
        5051,
        5019,
        4983,
        4956,
        4930,
        4903,
        4874,
        4844,
        4815,
        4798,
        4773,
        4747,
        4723,
        4693,
        4669,
        4649,
        4625,
        4596,
        4575,
        4547,
        4522,
        4504,
        4481,
        4455,
        4434,
        4413,
        4387,
        4365,
        4349,
        4326,
        4307,
        4285,
        4265,
        4244,
        4220,
        4201,
        4188,
        4167,
        4150,
        4778,
        5075,
        5206,
        5282,
        5332,
        5387,
        5440,
        5496,
        5545,
        5593,
        5641,
        5684,
        5722,
        5759,
        5795,
        5825,
        5854,
        5882,
        5907,
        5935,
        5959,
        5979,
        5998,
        6017,
        6034,
        6047,
        6063,
        6076,
        6089,
        6097,
        6111,
        6119,
        6127,
        6133,
        6140,
        6153,
        6159,
        6167,
        6171,
        6177,
        6186,
        6192,
        6194,
        6198,
        6201,
        6206,
        6211,
        6212,
        6215,
        6216,
        4801,
        4821,
        4835,
        4839,
        4847,
        4859,
        4860,
        4867,
        4866,
        4871,
        4876,
        4879,
        4879,
        4876,
        4877,
        4886,
        4887,
        4887,
        4886,
        4886,
        4889,
        4892,
        4891,
        4896,
        4891,
        4895,
        4899,
        4898,
        4901,
        4897,
        4898,
        4902,
        4902,
        4903,
        4903,
        4901,
        4901,
        4906,
        4907,
        4906,
        4902,
        4903,
        4911,
        4911,
        4911,
        4912,
        4909,
        4915,
        4915,
        4917,
        6637,
        6785,
        6830,
        6853,
        6862,
        6869,
        6870,
        6871,
        6874,
        6874,
        6875,
        6877,
        6879,
        6882,
        6884,
        6883,
        6885,
        6886,
        6886,
        6885,
        6883,
        6885,
        6883,
        6879,
        6881,
        6881,
        6885,
        6885,
        6886,
        6886,
        6885,
        6885,
        6886,
        6885,
        6885,
        6879,
        6880,
        6878,
        6879,
        6884,
        6882,
        6885,
        6883,
        6882,
        6883,
        6883,
        6881,
        6877,
        6876,
        6876,
        6866,
        6857,
        6855,
        6855,
        6854,
        6857,
        6860,
        6860,
        6866,
        6871,
        6873,
        6872,
        6874,
        6878,
        6877,
        6875,
        6875,
        6878,
        6878,
        6882,
        6883,
        6887,
        6886,
        6887,
        6887,
        6890,
        6890,
        6887,
        6887,
        6887,
        6892,
        6895,
        6895,
        6896,
        6895,
        6896,
        6900,
        6895,
        6893,
        6895,
        6898,
        6899,
        6901,
        6903,
        6902,
        6903,
        6901,
        6904,
        6902,
        6898,
        6628,
        6631,
        6631,
        6631,
        6631,
        6623,
        6629,
        6629,
        6629,
        6629,
        6625,
        6628,
        6627,
        6628,
        6623,
        6621,
        6626,
        6625,
        6626,
        6626,
        6619,
        6622,
        6623,
        6622,
        6620,
        6615,
        6622,
        6618,
        6619,
        6615,
        6613,
        6621,
        6618,
        6618,
        6610,
        6613,
        6617,
        6615,
        6618,
        6607,
        6612,
        6613,
        6613,
        6611,
        6608,
        6611,
        6611,
        6611,
        6605,
        6605,
        6619,
        6623,
        6612,
        6615,
        6613,
        6601,
        6605,
        6605,
        6595,
        6601,
        6598,
        6595,
        6595,
        6587,
        6590,
        6581,
        6587,
        6586,
        6576,
        6579,
        6573,
        6575,
        6575,
        6572,
        6571,
        6564,
        6567,
        6566,
        6565,
        6565,
        6558,
        6560,
        6554,
        6559,
        6556,
        6551,
        6555,
        6547,
        6549,
        6549,
        6550,
        6548,
        6540,
        6545,
        6541,
        6542,
        6540,
        6539,
        6538,
        6533,
        6065,
        5798,
        5630,
        5522,
        5442,
        5379,
        5332,
        5296,
        5266,
        5237,
        5209,
        5195,
        5177,
        5159,
        5142,
        5127,
        5116,
        5104,
        5095,
        5085,
        5070,
        5069,
        5061,
        5053,
        5047,
        5033,
        5031,
        5029,
        5022,
        5018,
        5007,
        5005,
        5002,
        4998,
        4995,
        4988,
        4981,
        4985,
        4980,
        4975,
        4974,
        4967,
        4966,
        4967,
        4964,
        4963,
        4953,
        4951,
        4955,
        4951,
        4953,
        4967,
        4979,
        4983,
        4986,
        4996,
        4997,
        4996,
        5001,
        5005,
        5003,
        5008,
        5005,
        5010,
        5011,
        5007,
        5015,
        5016,
        5011,
        5019,
        5017,
        5019,
        5021,
        5015,
        5021,
        5023,
        5018,
        5021,
        5021,
        5018,
        5024,
        5020,
        5026,
        5026,
        5021,
        5023,
        5027,
        5021,
        5026,
        5025,
        5026,
        5027,
        5020,
        5027,
        5027,
        5021,
        5028,
        5029,
        5026,
        5028,
        6087,
        6173,
        6200,
        6216,
        6217,
        6227,
        6223,
        6229,
        6227,
        6229,
        6225,
        6220,
        6223,
        6217,
        6219,
        6221,
        6214,
        6219,
        6213,
        6216,
        6213,
        6205,
        6211,
        6210,
        6209,
        6207,
        6202,
        6205,
        6207,
        6200,
        6201,
        6196,
        6200,
        6201,
        6193,
        6199,
        6198,
        6194,
        6193,
        6187,
        6191,
        6191,
        6187,
        6189,
        6183,
        6186,
        6183,
        6182,
        6183,
        6186,
        6153,
        6143,
        6133,
        6141,
        6137,
        6141,
        6135,
        6143,
        6139,
        6147,
        6141,
        6149,
        6152,
        6154,
        6156,
        6148,
        6155,
        6152,
        6159,
        6157,
        6163,
        6161,
        6157,
        6165,
        6161,
        6167,
        6165,
        6167,
        6170,
        6165,
        6171,
        6165,
        6171,
        6169,
        6174,
        6175,
        6171,
        6176,
        6170,
        6177,
        6173,
        6179,
        6178,
        6174,
        6180,
        6173,
        6181,
        6177,
        6179,
        6182,
        5879,
        5876,
        5871,
        5877,
        5871,
        5875,
        5874,
        5874,
        5875,
        5868,
        5872,
        5870,
        5873,
        5872,
        5867,
        5871,
        5865,
        5871,
        5871,
        5867,
        5871,
        5863,
        5870,
        5863,
        5867,
        5868,
        5865,
        5865,
        5863,
        5866,
        5865,
        5866,
        5863,
        5863,
        5866,
        5860,
        5865,
        5863,
        5863,
        5863,
        5858,
        5861,
        5860,
        5863,
        5862,
        5859,
        5861,
        5855,
        5863,
        5861,
        5887,
        5886,
        5878,
        5881,
        5878,
        5875,
        5864,
        5869,
        5867,
        5863,
        5859,
        5862,
        5859,
        5857,
        5848,
        5855,
        5855,
        5850,
        5843,
        5839,
        5845,
        5841,
        5837,
        5835,
        5841,
        5836,
        5835,
        5828,
        5836,
        5834,
        5831,
        5826,
        5823,
        5827,
        5828,
        5827,
        5818,
        5825,
        5821,
        5823,
        5815,
        5813,
        5823,
        5821,
        5819,
        5809,
        5817,
        5815,
        5815,
        5807,
        5421,
        5207,
        5069,
        4970,
        4905,
        4854,
        4810,
        4779,
        4749,
        4730,
        4709,
        4695,
        4682,
        4664,
        4658,
        4645,
        4642,
        4629,
        4628,
        4617,
        4609,
        4603,
        4595,
        4595,
        4585,
        4588,
        4583,
        4582,
        4579,
        4571,
        4573,
        4569,
        4571,
        4566,
        4569,
        4566,
        4566,
        4564,
        4555,
        4562,
        4556,
        4562,
        4555,
        4562,
        4561,
        4557,
        4557,
        4556,
        4559,
        4555,
        4583,
        4603,
        4613,
        4615,
        4622,
        4627,
        4624,
        4633,
        4631,
        4628,
        4636,
        4635,
        4631,
        4640,
        4641,
        4637,
        4643,
        4643,
        4641,
        4646,
        4645,
        4642,
        4645,
        4646,
        4643,
        4647,
        4647,
        4643,
        4650,
        4647,
        4644,
        4648,
        4649,
        4644,
        4648,
        4650,
        4645,
        4651,
        4650,
        4646,
        4649,
        4650,
        4646,
        4650,
        4649,
        4646,
        4649,
        4649,
        4646,
        4647,
        5636,
        5692,
        5721,
        5730,
        5734,
        5736,
        5728,
        5733,
        5733,
        5735,
        5733,
        5733,
        5731,
        5730,
        5725,
        5722,
        5723,
        5725,
        5723,
        5725,
        5721,
        5722,
        5719,
        5713,
        5713,
        5710,
        5716,
        5715,
        5714,
        5714,
        5713,
        5711,
        5709,
        5705,
        5701,
        5702,
        5707,
        5707,
        5705,
        5706,
        5703,
        5703,
        5705,
        5699,
        5697,
        5695,
        5700,
        5701,
        5701,
        5700,
        5655,
        5643,
        5632,
        5638,
        5638,
        5639,
        5643,
        5637,
        5647,
        5645,
        5643,
        5648,
        5650,
        5652,
        5649,
        5655,
        5656,
        5657,
        5653,
        5661,
        5662,
        5657,
        5661,
        5665,
        5666,
        5661,
        5669,
        5669,
        5669,
        5663,
        5671,
        5673,
        5669,
        5675,
        5672,
        5675,
        5671,
        5677,
        5677,
        5674,
        5681,
        5677,
        5679,
        5675,
        5682,
        5681,
        5678,
        5680,
        5684,
        5685,
        5558,
        5557,
        5558,
        5561,
        5559,
        5561,
        5556,
        5555,
        5559,
        5557,
        5557,
        5559,
        5553,
        5553,
        5558,
        5557,
        5555,
        5553,
        5553,
        5555,
        5555,
        5553,
        5555,
        5551,
        5548,
        5557,
        5554,
        5554,
        5554,
        5550,
        5548,
        5556,
        5554,
        5554,
        5550,
        5546,
        5550,
        5551,
        5551,
        5551,
        5547,
        5547,
        5552,
        5551,
        5551,
        5553,
        5545,
        5545,
        5551,
        5550,
        5591,
        5590,
        5583,
        5581,
        5576,
        5574,
        5573,
        5573,
        5569,
        5567,
        5566,
        5563,
        5559,
        5557,
        5561,
        5556,
        5552,
        5549,
        5552,
        5551,
        5546,
        5545,
        5543,
        5542,
        5542,
        5542,
        5542,
        5535,
        5536,
        5535,
        5533,
        5535,
        5531,
        5531,
        5528,
        5531,
        5529,
        5529,
        5527,
        5525,
        5529,
        5525,
        5525,
        5523,
        5519,
        5519,
        5521,
        5518,
        5519,
        5518,
        5147,
        4927,
        4788,
        4695,
        4625,
        4568,
        4523,
        4493,
        4462,
        4439,
        4427,
        4412,
        4397,
        4381,
        4372,
        4367,
        4359,
        4351,
        4341,
        4339,
        4335,
        4329,
        4325,
        4317,
        4317,
        4315,
        4311,
        4309,
        4303,
        4306,
        4304,
        4299,
        4298,
        4292,
        4297,
        4295,
        4293,
        4293,
        4287,
        4291,
        4293,
        4291,
        4288,
        4285,
        4291,
        4290,
        4289,
        4285,
        4283,
        4290,
        4269,
        4285,
        4292,
        4296,
        4301,
        4299,
        4300,
        4306,
        4309,
        4311,
        4311,
        4314,
        4315,
        4311,
        4313,
        4319,
        4318,
        4318,
        4319,
        4319,
        4316,
        4316,
        4313,
        4319,
        4321,
        4319,
        4319,
        4318,
        4319,
        4315,
        4314,
        4320,
        4320,
        4321,
        4321,
        4319,
        4319,
        4315,
        4313,
        4318,
        4319,
        4319,
        4319,
        4319,
        4314,
        4316,
        4316,
        4320,
        4318,
        4318,
        5431,
        5506,
        5529,
        5538,
        5543,
        5543,
        5546,
        5546,
        5546,
        5543,
        5541,
        5538,
        5539,
        5537,
        5536,
        5539,
        5539,
        5537,
        5538,
        5536,
        5536,
        5534,
        5528,
        5526,
        5525,
        5527,
        5531,
        5531,
        5528,
        5525,
        5527,
        5526,
        5525,
        5520,
        5517,
        5519,
        5520,
        5524,
        5520,
        5519,
        5521,
        5521,
        5519,
        5514,
        5513,
        5514,
        5515,
        5517,
        5518,
        5515,
        5462,
        5446,
        5442,
        5441,
        5442,
        5441,
        5445,
        5442,
        5444,
        5446,
        5447,
        5447,
        5451,
        5451,
        5446,
        5447,
        5453,
        5453,
        5458,
        5462,
        5459,
        5461,
        5462,
        5463,
        5464,
        5466,
        5467,
        5463,
        5463,
        5463,
        5466,
        5468,
        5475,
        5472,
        5475,
        5474,
        5473,
        5477,
        5476,
        5477,
        5472,
        5473,
        5476,
        5476,
        5475,
        5478,
        5482,
        5481,
        5482,
        5481,
        5414,
        5413,
        5413,
        5413,
        5413,
        5413,
        5414,
        5412,
        5408,
        5409,
        5408,
        5406,
        5407,
        5407,
        5406,
        5406,
        5405,
        5405,
        5404,
        5405,
        5406,
        5404,
        5404,
        5403,
        5403,
        5405,
        5403,
        5402,
        5403,
        5401,
        5403,
        5402,
        5402,
        5401,
        5401,
        5401,
        5402,
        5400,
        5401,
        5401,
        5401,
        5401,
        5399,
        5402,
        5401,
        5399,
        5401,
        5399,
        5399,
        5400,
        5460,
        5463,
        5459,
        5460,
        5460,
        5459,
        5457,
        5455,
        5446,
        5447,
        5446,
        5447,
        5444,
        5445,
        5438,
        5437,
        5437,
        5438,
        5436,
        5430,
        5428,
        5431,
        5429,
        5430,
        5430,
        5422,
        5420,
        5426,
        5422,
        5424,
        5423,
        5419,
        5421,
        5420,
        5419,
        5419,
        5412,
        5415,
        5415,
        5414,
        5413,
        5407,
        5407,
        5413,
        5411,
        5411,
        5405,
        5403,
        5409,
        5407,
        4886,
        4518,
        4239,
        4019,
        3857,
        3731,
        3638,
        3564,
        3509,
        3466,
        3431,
        3404,
        3383,
        3363,
        3349,
        3336,
        3326,
        3319,
        3312,
        3303,
        3301,
        3299,
        3297,
        3293,
        3291,
        3287,
        3287,
        3287,
        3285,
        3284,
        3283,
        3282,
        3281,
        3281,
        3279,
        3281,
        3279,
        3279,
        3279,
        3279,
        3278,
        3279,
        3279,
        3277,
        3279,
        3277,
        3276,
        3279,
        3279,
        3277,
        3277,
        3277,
        3275,
        3275,
        3271,
        3270,
        3270,
        3271,
        3271,
        3270,
        3268,
        3269,
        3268,
        3270,
        3270,
        3270,
        3270,
        3270,
        3269,
        3271,
        3270,
        3269,
        3270,
        3269,
        3269,
        3270,
        3268,
        3267,
        3269,
        3269,
        3267,
        3266,
        3267,
        3266,
        3265,
        3263,
        3265,
        3263,
        3264,
        3263,
        3263,
        3261,
        3265,
        3260,
        3261,
        3261,
        3261,
        3259,
        3259,
        3259
      ]
    }
  ],
  "app_os": "win",
  "app_name": "PhotosynQ",
  "app_version": "0.3.8",
  "app_device": "x86-32",
  "location": [
    "-32.9685480",
    "-60.6568024"
  ],
  "ConsoleMacro": "347"
}
Default avatar
Created by

Rodrigo Gomez


Protocol connections:
2
Latest Update:
Jun 2017