-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calendar #10
Calendar #10
Conversation
Checks have failed - will look into it later. |
Add install_requires =
calmap
fit2gpx
gpxpy
matplotlib
pandas
rich
seaborn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something else, --activities_path
is an optional parameter with no default so this would fail:
$ stravavis tests/gpx
Processing data...
Processing ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
Processing activities...
Traceback (most recent call last):
...
ValueError: Invalid file path or buffer object type: <class 'NoneType'>
Some options:
-
make it a required, positional argument, like
"path"
. But maybe people want to run on GPX only and have noactivities.csv
. -
Add a default or calculate one. Current directory? Same as
args.path
? Hard to know. -
My preference: if the argument is given, skip the relevant bits. For example:
diff --git a/src/stravavis/cli.py b/src/stravavis/cli.py
index c84dc2c..f7fd3f0 100644
--- a/src/stravavis/cli.py
+++ b/src/stravavis/cli.py
@@ -45,8 +45,10 @@ def main():
print("Processing data...")
df = process_data(args.path)
- print("Processing activities...")
- activities = process_activities(activities_path)
+ activities = None
+ if args.activities_path:
+ print("Processing activities...")
+ activities = process_activities(args.activities_path)
print("Plotting facets...")
outfile = f"{args.output_prefix}-facets.png"
@@ -68,10 +70,11 @@ def main():
plot_landscape(df, output_file=outfile)
print(f"Saved to {outfile}")
- print("Plotting calendar...")
- outfile = f"{args.output_prefix}-calendar.png"
- plot_calendar(activities, output_file=outfile)
- print(f"Saved to {outfile}")
+ if activities:
+ print("Plotting calendar...")
+ outfile = f"{args.output_prefix}-calendar.png"
+ plot_calendar(activities, output_file=outfile)
+ print(f"Saved to {outfile}")
if __name__ == "__main__":
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
Many thanks Hugo, if I missed anything let me know! |
Added a calendar heatmap using the calmap package. Will look at tweaking the aesthetics (e.g. color) later.