Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Commit 59e12a5

Browse files
committed
updated README.md
1 parent 36f398e commit 59e12a5

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

README.md

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ There are three optional parameters that can be passed as an associative array w
120120
- pace
121121

122122
For example:
123-
````php
123+
```php
124124
$options = [
125125
'fix_data' => ['cadence', 'distance'],
126126
'units' => 'statute',
127127
'pace' => true
128128
];
129129
$pFFA = new adriangibbons\phpFITFileAnalysis('my_fit_file.fit', $options);
130-
````
130+
```
131131
The optional parameters are described in more detail below.
132132
####"Fix" the Data
133133
FIT files have been observed where some data points are missing for one sensor (e.g. cadence/foot pod), where information has been collected for other sensors (e.g. heart rate) at the same instant. The cause is unknown and typically only a relatively small number of data points are missing. Fixing the issue is probably unnecessary, as each datum is indexed using a timestamp. However, it may be important for your project to have the exact same number of data points for each type of data.
@@ -265,27 +265,27 @@ Note that if 'raw' units are requested then this parameter has no effect on the
265265
##Analysis
266266
The following functions return arrays of that could be used to create tables/charts:
267267
```php
268-
$pFFA->hrPartionedHRmaximum(195); // Input: HRmaximum
269-
$pFFA->hrPartionedHRreserve(48, 195); // Inputs: HRmaximum and HRresting
270-
$pFFA->powerPartioned(312); // Input: Functional Threshold Power
271-
$pFFA->powerHistogram(); // Input: bucket width (optional; default=25w)
268+
array $pFFA->hrPartionedHRmaximum(int $hr_maximum);
269+
array $pFFA->hrPartionedHRreserve(int $hr_resting, int $hr_maximum);
270+
array $pFFA->powerPartioned(int $functional_threshold_power);
271+
array $pFFA->powerHistogram(int $bucket_width = 25);
272272
```
273273
For advanced control over these functions, or use with other sensor data (e.g. cadence or speed), use the underlying functions:
274274
```php
275-
$pFFA->partitionData($record_field='', $thresholds=null, $percentages=true, $labels_for_keys=true);
276-
$pFFA->histogram($bucket_width=25, $record_field='');
275+
array $pFFA->partitionData(string $record_field='', $thresholds=null, bool $percentages = true, bool $labels_for_keys = true);
276+
array $pFFA->histogram(int $bucket_width=25, string $record_field='');
277277
```
278278
Functions exist to determine thresholds based on percentages of user-supplied data:
279279
```php
280-
$pFFA->hrZonesMax($hr_maximum, $percentages_array=[0.60, 0.75, 0.85, 0.95]);
281-
$pFFA->hrZonesReserve($hr_resting, $hr_maximum, $percentages_array=[0.60, 0.65, 0.75, 0.82, 0.89, 0.94 ]) {
282-
$pFFA->powerZones($functional_threshold_power, $percentages_array=[0.55, 0.75, 0.90, 1.05, 1.20, 1.50]);
280+
array $pFFA->hrZonesMax(int $hr_maximum, array $percentages_array=[0.60, 0.75, 0.85, 0.95]);
281+
array $pFFA->hrZonesReserve(int $hr_resting, int $hr_maximum, array $percentages_array=[0.60, 0.65, 0.75, 0.82, 0.89, 0.94 ]) {
282+
array $pFFA->powerZones(int $functional_threshold_power, array $percentages_array=[0.55, 0.75, 0.90, 1.05, 1.20, 1.50]);
283283
```
284284
###Heart Rate
285285
A function exists for analysing heart rate data:
286286
```php
287287
// hr_FT is heart rate at Functional Threshold, or Lactate Threshold Heart Rate
288-
$pFFA->hrMetrics($hr_resting, $hr_maximum, $hr_FT, $gender);
288+
array $pFFA->hrMetrics(int $hr_resting, int $hr_maximum, string $hr_FT, $gender);
289289
// e.g. $pFFA->hrMetrics(52, 189, 172, 'male');
290290
```
291291
**Heart Rate metrics:**
@@ -295,9 +295,9 @@ $pFFA->hrMetrics($hr_resting, $hr_maximum, $hr_FT, $gender);
295295
###Power
296296
Three functions exist for analysing power data:
297297
```php
298-
$pFFA->powerMetrics($functional_threshold_power); // e.g. 312
299-
$pFFA->criticalPower($time_periods); // e.g. 300 or [300, 600, 900, 1200]
300-
$pFFA->quadrantAnalysis($crank_length, $ftp, $selected_cadence); // Crank length in metres; cadence defaults to 90rpm if not supplied
298+
array $pFFA->powerMetrics(int $functional_threshold_power);
299+
array $pFFA->criticalPower(int or array $time_periods); // e.g. 300 or [600, 900]
300+
array $pFFA->quadrantAnalysis(float $crank_length, int $ftp, int $selected_cadence = 90, bool $use_timestamps = false); // Crank length in metres
301301
```
302302
**Power metrics:**
303303
* Average Power
@@ -309,14 +309,25 @@ $pFFA->quadrantAnalysis($crank_length, $ftp, $selected_cadence); // Crank lengt
309309

310310
**Critical Power** (or Best Effort) is the highest average power sustained for a specified period of time within the activity. You can supply a single time period (in seconds), or an array or time periods.
311311

312-
Note that ```$pFFA->criticalPower``` and some power metrics (Normalised Power, Variability Index, Intensity Factor, Training Stress Score) will use the [PHP Trader](http://php.net/manual/en/book.trader.php) extension if it is loaded on the server. If the extension is not loaded then it will use the built-in Simple Moving Average algorithm, which is far less performant particularly for larger files!
313-
314312
**Quadrant Analysis** provides insight into the neuromuscular demands of a bike ride through comparing pedal velocity with force by looking at cadence and power.
315313

314+
Note that ```$pFFA->criticalPower``` and some power metrics (Normalised Power, Variability Index, Intensity Factor, Training Stress Score) will use the [PHP Trader](http://php.net/manual/en/book.trader.php) extension if it is loaded on the server. If the extension is not loaded then it will use the built-in Simple Moving Average algorithm, which is far less performant particularly for larger files!
315+
316316
A demo of power analysis is available [here](http://adriangibbons.com/php-fit-file-analysis/demo/power-analysis.php).
317317

318318
##Other methods
319-
```isPaused()``` - Returns array of booleans using timestamp as key. true == timer paused (e.g. autopause).
319+
Returns array of booleans using timestamp as key. true == timer paused (e.g. autopause):
320+
```php
321+
array isPaused()
322+
```
323+
Returns a JSON object with requested ride data:
324+
```php
325+
array getJSON(float $crank_length = null, int $ftp = null, array $data_required = ['all'], int $selected_cadence = 90)
326+
/**
327+
* $data_required can be ['all'] or a combination of:
328+
* ['timestamp', 'paused', 'temperature', 'lap', 'position_lat', 'position_long', 'distance', 'altitude', 'speed', 'heart_rate', 'cadence', 'power', 'quadrant-analysis']
329+
*/
330+
```
320331

321332
##Acknowledgement
322333
This class has been created using information available in a Software Development Kit (SDK) made available by ANT ([thisisant.com](http://www.thisisant.com/resources/fit)).

0 commit comments

Comments
 (0)