ColCarroll / strava_calendar

Visualizations from Strava data in matplotlib
MIT License
87 stars 7 forks source link

ZeroDivisionError in plot_calendar() #6

Closed len75alt closed 1 year ago

len75alt commented 1 year ago

Output from Jupyter notebook:

`Output exceeds the size limit. Open the full output data in a text editor

ZeroDivisionError Traceback (most recent call last) Cell In[9], line 1 ----> 1 plot_calendar(zip_path=r'C:\Users\lenny\Documents\Sports\StravaVisualizations\export_147165.zip', year=2023)

File c:\Users\lenny\Documents\Sports\StravaVisualizations\strava_calendar-master\strava_calendar\strava_calendar.py:55, in plot_calendar(zip_path, year, plot_size, n_cols, month_gap, col_gap, sport, label) 9 def plot_calendar( 10 *, 11 zip_path, (...) 18 label=None, 19 ): 20 """Plot a year of Strava data in a calendar layout. 21 22 Parameters (...) 53 for further customization. 54 """ ---> 55 data = get_data( 56 zip_path, 57 sport, 58 datetime.datetime(year, 1, 1), 59 datetime.datetime(year + 1, 1, 1), 60 ) 62 plotter = Plotter(data) ... 126 ) 127 return lo < pace < hi 128 return strava_file.session_data["sport"] == sport

ZeroDivisionError: float division by zero`

ColCarroll commented 1 year ago

I think I got a fix -- note that this was happening because there were (probably!) .gpx files that had 0 distance. I'm definitely not an expert at file formats, so please let me know if this helps!

len75alt commented 1 year ago

That worked! It processed the batch of running data as expected. Thanks for the quick turnaround!

On Mon, Jan 2, 2023 at 8:16 PM Colin Carroll @.***> wrote:

I think I got a fix -- note that this was happening because there were (probably!) .gpx files that had 0 distance. I'm definitely not an expert at file formats, so please let me know if this helps!

— Reply to this email directly, view it on GitHub https://github.com/ColCarroll/strava_calendar/issues/6#issuecomment-1369307576, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOJZJPXCJBNO55XR2255JCLWQN4X5ANCNFSM6AAAAAATPFXVCY . You are receiving this because you authored the thread.Message ID: @.***>

-- Life is like a camera. Focus on the important things. Capture the good times. Develop from the negatives. And if things don't work out, just take another shot.