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.


source

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.


source

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*


source

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*


source

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:

# Load a FIT file
fit_loader = load_fit_file('path/to/your/activity.fit')

# Extract raw power data
power_df = fit_loader.extract_power_data()
print(power_df.head())

# Compute MMP curve
durations, mmp_powers = fit_loader.compute_mmp_curve()

# Create MMP object directly from FIT file
mmp = mmp_from_fit('path/to/your/activity.fit')

# Create PDC object directly from FIT file
pdc = pdc_from_fit('path/to/your/activity.fit')

# Fit the power duration curve
result = pdc.fit()
print(result.best_values)