# Load a FIT file
= load_fit_file('path/to/your/activity.fit')
fit_loader
# Extract raw power data
= fit_loader.extract_power_data()
power_df print(power_df.head())
# Compute MMP curve
= fit_loader.compute_mmp_curve()
durations, mmp_powers
# Create MMP object directly from FIT file
= mmp_from_fit('path/to/your/activity.fit')
mmp
# Create PDC object directly from FIT file
= pdc_from_fit('path/to/your/activity.fit')
pdc
# Fit the power duration curve
= pdc.fit()
result print(result.best_values)
FIT File Support
Load and process FIT files from Garmin devices
FIT File Loader
The FitLoader
class provides functionality to load and extract power data from Garmin FIT files.
FitLoader
FitLoader (filepath:str)
Load and extract data from Garmin FIT files
Integration with MMP and PDC Classes
Add convenience methods to create MMP and PDC objects from FIT files.
load_fit_file
load_fit_file (filepath:str)
*Load a FIT file and return a FitLoader instance
Args: filepath: Path to the FIT file
Returns: FitLoader instance*
mmp_from_fit
mmp_from_fit (filepath:str, durations:Optional[List[int]]=None)
*Create an MMP object from a FIT file
Args: filepath: Path to the FIT file durations: List of durations in seconds to compute MMP for
Returns: MMP object with data from the FIT file*
pdc_from_fit
pdc_from_fit (filepath:str, durations:Optional[List[int]]=None)
*Create a PDC object from a FIT file
Args: filepath: Path to the FIT file durations: List of durations in seconds to compute MMP for
Returns: PDC object with data from the FIT file*
Example Usage
Here’s how to use the FIT file functionality: