/** * 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]; } } }
/** * Init data * @param \Runalyze\Model\HRV\Entity $hrv */ protected function initHRVData(Model\HRV\Entity $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()); } }
/** * 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)); }