This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A script to fetch and analyze running activities from Strava for the current year's March. | |
This script uses the Strava API to: | |
1. Authenticate using OAuth 2.0 | |
2. Retrieve all activities for March of the current year | |
3. Filter for running activities only | |
4. Calculate daily running distances in miles | |
5. Generate a table showing miles run each day in March | |
6. Export the results to 'march_running_activities.csv' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import numpy as np | |
import numpy.linalg as la | |
def orthogonalize(U, eps=1e-15): | |
""" | |
Orthogonalizes the matrix U (d x n) using Gram-Schmidt Orthogonalization. | |
If the columns of U are linearly dependent with rank(U) = r, the last n-r columns | |
will be 0. | |