Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Import a FIT file to analyze data from cycling computers, smart watches and other devices
ResourceFunction["FITImport"][source] imports data from a FIT file source as a Dataset. | |
ResourceFunction["FITImport"][source,elements] imports the specified elements from a file. |
| "path" | a string corresponding to a file path or URL |
| File[…] | a File object |
| URL[…] | a URL object |
| LocalObject[…] | a LocalObject |
| CloudObject[…] | a CloudObject |
| HTTPResponse[…] | an HTTPResponse object |
| "Dataset" | gives a Dataset of records |
| "Data" | gives a list of associations for records |
| "MessageCounts" | gives an association of counts of each message type contained in the file |
| "MessageInformation" | gives a Dataset containing meta information about messages |
| "RawData" | gives raw data from the file as a matrix of integers |
| "prop" | a TimeSeries for the specified record property |
| "type" | a Dataset for the specified message type |
| {"prop1","prop2",…} | an association of TimeSeries objects for each "propi" |
| {"type1","type2",…} | a Dataset containing all messages of the specified types |
| All | imports all record properties as an association of TimeSeries objects |
| {"TimeSeries",elem} | specifies that elem should be imported as a record property |
| "PowerZonePlot" | gives a timeline plot of power zone levels over time |
| "AveragePowerPhasePlot" | gives a visualization of left-right pedal power phase balance |
| "CriticalPowerCurvePlot" | gives a plot of the estimated critical power curve |
| "Record" | a timestamped message that's used for many of the default import elements |
| "DeviceInformation" | a message containing information about a device that's generating data for a FIT file |
| "DeviceSettings" | information about hardware settings for a device |
| "Event" | an arbitrary event that's recorded |
| "FileID" | information about the FIT file |
| "Session" | information that typically aggregates record values as a summary |
| "UserProfile" | user preferences that can affect how the FIT value is interpreted |
Import a fit file as a Dataset:
| In[1]:= |
| Out[1]= | ![]() |
Get a summary of the ride:
| In[2]:= |
| Out[2]= | ![]() |
Get a TimeSeries of GPS coordinates:
| In[3]:= |
| Out[3]= | ![]() |
View a map of the route:
| In[4]:= |
| Out[4]= | ![]() |
Plot elevation over time:
| In[5]:= |
| Out[5]= | ![]() |
Visualize a workout:
| In[6]:= |
| Out[6]= | ![]() |
Visualize the power phase of pedal strokes in a bike ride:
| In[7]:= |
| Out[7]= | ![]() |
Get the critical power curve for a bike ride:
| In[8]:= |
| Out[8]= | ![]() |
Import all record values as TimeSeries objects:
| In[9]:= |
| Out[9]= | ![]() |
Get information about devices used to generate the file:
| In[10]:= |
| Out[10]= | ![]() |
Get a summary of an activity:
| In[11]:= |
| Out[11]= | ![]() |
Some values are not available without specifying an FTP value:
| In[12]:= |
| Out[12]= |
Specify an FTP when importing to get power zone data:
| In[13]:= |
| Out[13]= | ![]() |
| In[14]:= |
| Out[14]= | ![]() |
See how the distribution changes with different FTP values:
| In[15]:= | ![]() |
| Out[15]= | ![]() |
Set the FTP persistently:
| In[16]:= |
| Out[16]= |
Specifying the FunctionalThresholdPower option is no longer necessary:
| In[17]:= |
| Out[17]= | ![]() |
Remove the stored value:
| In[18]:= |
Some fit files have a stored FTP value:
| In[19]:= |
| Out[19]= | ![]() |
Override the value stored in the file:
| In[20]:= |
| Out[20]= | ![]() |
Other files may not store this information:
| In[21]:= |
| Out[21]= | ![]() |
Set the FTP manually:
| In[22]:= |
| Out[22]= | ![]() |
Some values are not available without specifying a maximum heart rate:
| In[23]:= |
| Out[23]= |
Specify a max heart rate when importing to get HR zone data:
| In[24]:= |
| Out[24]= | ![]() |
| In[25]:= |
| Out[25]= | ![]() |
Set the max heart rate persistently:
| In[26]:= |
| Out[26]= |
Specifying the MaxHeartRate option is no longer necessary:
| In[27]:= |
| Out[27]= | ![]() |
Remove the stored value:
| In[28]:= |
By default, units are determined by the current value of $UnitSystem:
| In[29]:= |
| Out[29]= |
| In[30]:= |
| Out[30]= |
Override the default unit system:
| In[31]:= |
| Out[31]= |
Some units depend on the activity type:
| In[32]:= |
| Out[32]= |
| In[33]:= |
| Out[33]= |
Get information about the fit protocol messages contained in a file:
| In[34]:= |
| Out[34]= | ![]() |
Check for message types that are not currently importable:
| In[35]:= |
| Out[35]= | ![]() |
Get the number of each message type in a fit file:
| In[36]:= |
| Out[36]= | ![]() |
Import specific message types:
| In[37]:= |
| Out[37]= | ![]() |
Get the raw message data as a matrix of integers:
| In[38]:= |
| Out[38]= | ![]() |
The first number in each row corresponds to the message type:
| In[39]:= |
| Out[39]= |
| In[40]:= |
| Out[40]= | ![]() |
It's much faster to import a time series directly rather than construct it manually:
| In[41]:= |
| Out[41]= | ![]() |
| In[42]:= | ![]() |
| Out[42]= | ![]() |
The "MessageCounts" property can be used to quickly find what kinds of messages are contained in a fit file:
| In[43]:= |
| Out[43]= | ![]() |
| In[44]:= |
| Out[44]= | ![]() |
Compare to counting by importing every message first:
| In[45]:= | ![]() |
| Out[45]= | ![]() |
The type of data available can vary significantly between different fit files:
| In[46]:= |
| Out[46]= | ![]() |
| In[47]:= |
| Out[47]= | ![]() |
| In[48]:= |
| Out[48]= | ![]() |
Some elements are only available for certain activity types:
| In[49]:= |
| Out[49]= |
Some devices may not capture the necessary data for some elements:
| In[50]:= |
| Out[50]= |
| In[51]:= |
| Out[51]= | ![]() |
A power meter is typically required to capture power phase data:
| In[52]:= | ![]() |
| Out[52]= | ![]() |
| In[53]:= |
| Out[53]= | ![]() |
Animate a bike ride:
| In[54]:= | ![]() |
| Out[52]= | ![]() |
Plot all the values found in a fit file:
| In[55]:= |
| Out[55]= | ![]() |
| In[56]:= |
| Out[56]= | ![]() |
Animate a Zwift ride:
| In[57]:= | ![]() |
| Out[51]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License