예제 #1
0
파일: HRV.php 프로젝트: n0rthface/Runalyze
 /**
  * Init data
  * @param \Runalyze\Model\HRV\Object $hrv
  */
 protected function initHRVData(Model\HRV\Object $hrv)
 {
     if (count($this->XAxisData) == $hrv->num()) {
         $this->XAxis = DataCollector::X_AXIS_TIME;
         $this->Data = array_combine($this->XAxisData, $this->filterData($hrv->data()));
     } else {
         $this->XAxis = DataCollector::X_AXIS_INDEX;
         $this->Data = $this->filterData($hrv->data());
     }
 }
예제 #2
0
 /**
  * Collect plot data
  */
 protected function collectPlotData()
 {
     $data = $this->Object->data();
     $num = $this->Object->num();
     for ($i = 1; $i < $num; ++$i) {
         if (abs($data[$i - 1] - $data[$i]) < $this->Filter) {
             $this->PlotData[(string) $data[$i - 1]] = $data[$i];
         }
     }
 }
예제 #3
0
 /**
  * Calculate sdsd from mean of differences
  * @param float $mean
  */
 protected function calculateSDSDfromMean($mean)
 {
     $last = 0;
     $sum = 0;
     foreach ($this->Object->data() as $ms) {
         if ($last) {
             $x = abs($ms - $last);
             $sum += ($x - $mean) * ($x - $mean);
         }
         $last = $ms;
     }
     $this->SDSD = sqrt($sum / ($this->Object->num() - 1));
 }