RF_Env


Macro to process the output of the RF_Env protocol.
//============================================
// Macro for data evaluation on PhotosynQ.org
// created: 9/8/2017
//============================================

//Define the output object here
var output = {};

//Check if the key time exists in json
if (json.time !== undefined){
  //Add key time and value to output
  output.time = json.time;
}


// Calculate Fs and Fm' from the trace
var fs = MathMEAN(json.data_raw.slice(8,18));

// Calculate Fm' and when does it happen during the flash
var flash = json.data_raw.slice(20,100);
var iMax = 0;
var fmp = 0;
for(i = 1; i < flash.length; i++) {
  if(flash[i] > fmp) {
    fmp = flash[i];
    iMax = i;
  }
}

// Calculate Fq'/Fm' (aka Phi2)
var phi2 = (fmp-fs)/fmp;

// Store output
output.Fs = fs;
output.Fmp = fmp;
output.Phi2 = phi2;
output.tFmp = iMax*(1e-2 + 30e-6)*1e3; // Time to reach Fmp in ms since beginning of flash
output.PAR = json.light_intensity;
output.fRed = json.r;
output.fblue = json.b;
output.fgreen = json.g;
output.Tair = json.temperature;
output.Tleaf = json.contactless_temp;
output.RH = json.humidity;
output.thickness = json.thickness;
output.angle = json.angle;
output.orientation = json.angle_direction; // I think this is the orientation of the leaf?


//Return data
return output;
{
  "time_offset": -120,
  "time": 1504859843117,
  "device_name": "MultispeQ",
  "device_version": "1",
  "device_id": "01:12:71:16",
  "device_battery": 87,
  "device_firmware": 1.17,
  "sample": [
    {
      "time": 1504859843124,
      "protocol_id": 1,
      "light_intensity": 155,
      "r": 201,
      "g": 62,
      "b": 45,
      "light_intensity_raw": 288,
      "temperature": 24.84,
      "humidity": 62.112305,
      "pressure": 1000.13092,
      "contactless_temp": 23.59,
      "thickness": 0.69,
      "compass_direction": "N",
      "compass": "nan",
      "angle": 48.73,
      "angle_direction": "SW",
      "pitch": -27.91,
      "roll": -41.71,
      "data_raw": [
        15543,
        15590,
        15614,
        15626,
        15628,
        15632,
        15637,
        15634,
        15632,
        15634,
        15639,
        15637,
        15635,
        15634,
        15632,
        15628,
        15623,
        15623,
        15627,
        15627,
        18982,
        19245,
        19329,
        19345,
        19361,
        19366,
        19362,
        19370,
        19366,
        19375,
        19368,
        19375,
        19366,
        19371,
        19365,
        19369,
        19366,
        19371,
        19365,
        19366,
        19363,
        19353,
        19360,
        19350,
        19355,
        19353,
        19350,
        19344,
        19337,
        19339,
        19334,
        19333,
        19328,
        19318,
        19323,
        19310,
        19311,
        19305,
        19293,
        19297,
        19288,
        19290,
        19284,
        19271,
        19271,
        19261,
        19267,
        19261,
        19247,
        19247,
        19238,
        19237,
        19231,
        19225,
        19223,
        19210,
        19209,
        19207,
        19196,
        19196,
        19182,
        19183,
        19179,
        19164,
        19164,
        19153,
        19157,
        19148,
        19143,
        19137,
        19124,
        19126,
        19118,
        19107,
        19107,
        19098,
        19095,
        19090,
        19079,
        19079,
        17567,
        16888,
        16567,
        16390,
        16267,
        16179,
        16109,
        16038,
        15985,
        15935,
        15889,
        15846,
        15809,
        15777,
        15745,
        15714,
        15689,
        15668,
        15645,
        15625
      ]
    }
  ],
  "app_os": "win",
  "app_name": "PhotosynQ",
  "app_version": "0.3.8",
  "app_device": "x86-64",
  "location": [
    "51.9814374",
    "5.9501820"
  ],
  "ConsoleMacro": "411",
  "notes": "Enhancing protocol and macro. Use RGB for actinic light.\n\nIncrease light during measurement with lamp, to check that it really uses RGB channels."
}
Default avatar
Created by

Alejandro Morales


Protocol connections:
1
Latest Update:
Sep 2017