diff --git a/rowers/dataroutines.py b/rowers/dataroutines.py index 74d82a9b..43807ca9 100644 --- a/rowers/dataroutines.py +++ b/rowers/dataroutines.py @@ -385,8 +385,10 @@ def filter_df(datadf, fieldname, value, largerthan=True): def df_resample(datadf): # time stamps must be in seconds timestamps = datadf['TimeStamp (sec)'].astype('int') + datadf['timestamps'] = timestamps - newdf = datadf.groupby(['timestamps']).mean() + # newdf = datadf.groupby(['timestamps']).mean() + newdf = datadf[~datadf.duplicated(['timestamps'])] return newdf diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index c8da52f2..b4e4a6ed 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -365,7 +365,7 @@ def interactive_boxchart(datadf, fieldname, extratitle='', yrange1 = Range1d(start=yaxminima[fieldname], end=yaxmaxima[fieldname]) plot.y_range = yrange1 - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' if extratitle: plot.title.text = extratitle @@ -431,7 +431,7 @@ def interactive_planchart(data, startdate, enddate): p.height = 350 p.y_range = yrange1 p.toolbar_location = 'above' - p.sizing_mode = 'stretch_both' + #p.sizing_mode = 'stretch_both' script, div = components(p) @@ -597,7 +597,7 @@ def interactive_activitychart(workouts, startdate, enddate, stack='type', toolba p.height = 350 p.toolbar_location = toolbar_location p.y_range.start = 0 - p.sizing_mode = 'stretch_both' + #p.sizing_mode = 'stretch_both' taptool = p.select(type=TapTool) callback = CustomJS(args={'links': df.link}, code=""" @@ -797,7 +797,7 @@ def interactive_activitychart2(workouts, startdate, enddate, stack='type', toolb p.width = 550 p.height = 350 p.toolbar_location = toolbar_location - p.sizing_mode = 'stretch_both' + #p.sizing_mode = 'stretch_both' p.y_range.start = 0 taptool = p.select(type=TapTool) @@ -1092,7 +1092,7 @@ def interactive_forcecurve(theworkouts, workstrokesonly=True, plottype='scatter' plot = figure(tools=TOOLS, toolbar_sticky=False, toolbar_location="above", width=800, height=600) - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' # add watermark watermarkurl = "/static/img/logo7.png" @@ -1492,7 +1492,7 @@ def interactive_forcecurve(theworkouts, workstrokesonly=True, plottype='scatter' mylayout = layoutrow([thesliders, plot]) - mylayout.sizing_mode = 'stretch_both' + #mylayout.sizing_mode = 'stretch_both' script, div = components(mylayout) js_resources = INLINE.render_js() @@ -2016,7 +2016,7 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue= plot2.add_tools(linked_crosshair) mylayout = layoutcolumn([plot, plot2]) - mylayout.sizing_mode = 'stretch_both' + #mylayout.sizing_mode = 'stretch_both' try: script, div = components(mylayout) @@ -2148,7 +2148,7 @@ def interactive_histoall(theworkouts, histoparam, includereststrokes, plot.add_layout(LinearAxis(y_range_name="fraction", axis_label="Cumulative % of strokes"), 'right') - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' annolabel = Label(x=50, y=450, x_units='screen', y_units='screen', text='', @@ -3418,7 +3418,7 @@ def interactive_agegroupcpchart(age, normalized=False): plot = figure(width=900, x_axis_type=x_axis_type, tools=TOOLS) - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' plot.line('duration', 'fitpowerfh', source=sourcefit, legend_label='Female HW', color='blue') @@ -3456,7 +3456,8 @@ def interactive_agegroupcpchart(age, normalized=False): return script, div -def interactive_otwcpchart(powerdf, promember=0, rowername="", r=None, cpfit='data', +def interactive_otwcpchart(powerdf, promember=0, rowername="", r=None, + cpfit='data', title='', type='water', wcpower=[], wcdurations=[], cpoverlay=False): @@ -3697,7 +3698,7 @@ def interactive_agegroup_plot(df, distance=2000, duration=None, TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair' plot = figure(tools=TOOLS, width=900) - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' plot.circle('age', 'power', source=source, fill_color='red', size=15, legend_label='World Record') @@ -4075,7 +4076,7 @@ def interactive_windchart(id=0, promember=0): plot.xaxis.axis_label = "Distance (m)" plot.yaxis.axis_label = "Wind Speed (m/s)" plot.y_range = Range1d(-7, 7) - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' plot.extra_y_ranges = {"winddirection": Range1d(start=0, end=360)} plot.line('dist', 'winddirection', source=source, @@ -4141,7 +4142,7 @@ def interactive_streamchart(id=0, promember=0): plot.xaxis.axis_label = "Distance (m)" plot.yaxis.axis_label = "River Current (m/s)" plot.y_range = Range1d(-2, 2) - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' script, div = components(plot) @@ -4205,7 +4206,7 @@ def forcecurve_multi_interactive_chart(selected): toolbar_location='above', toolbar_sticky=False) - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' # add watermark watermarkurl = "/static/img/logo7.png" @@ -4307,7 +4308,7 @@ def instroke_multi_interactive_chart(selected, *args, **kwargs): toolbar_location='above', toolbar_sticky=False) - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' # add watermark watermarkurl = "/static/img/logo7.png" @@ -4405,7 +4406,7 @@ def instroke_interactive_chart(df,metric, workout, spm_min, spm_max, toolbar_location='above', toolbar_sticky=False) - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' plot.title.text = str(workout) + ' - ' + metric @@ -4592,7 +4593,7 @@ def interactive_chart(id=0, promember=0, intervaldata={}): plot.line('time', 'pace', source=source, legend_label="Pace", name="pace") plot.title.text = row.name plot.title.text_font_size = "1.0em" - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' plot.xaxis.axis_label = "Time" plot.yaxis.axis_label = "Pace (/500m)" plot.xaxis[0].formatter = DatetimeTickFormatter( @@ -4890,7 +4891,7 @@ def interactive_multiflex(datadf, xparam, yparam, groupby, extratitle='', plot.title.text = title plot.title.text_font_size = "1.0em" - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' plot.image_url([watermarkurl], watermarkx, watermarky, watermarkw, watermarkh, @@ -5124,7 +5125,7 @@ def interactive_cum_flex_chart2(theworkouts, promember=0, watermarkanchor = 'bottom_right' plot.extra_y_ranges = {"watermark": watermarkrange} plot.extra_x_ranges = {"watermark": watermarkrange} - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' if extratitle: plot.title.text = extratitle @@ -5378,7 +5379,7 @@ def interactive_cum_flex_chart2(theworkouts, promember=0, mylayout = layoutrow([thesliders, plot]) - mylayout.sizing_mode = 'stretch_both' + #mylayout.sizing_mode = 'stretch_both' script, div = components(mylayout) js_resources = INLINE.render_js() @@ -5537,10 +5538,10 @@ def interactive_flexchart_stacked(id, r, xparam='time', plot2.xaxis.visible = False plot3.xaxis.visible = False - plot1.sizing_mode = 'stretch_both' - plot2.sizing_mode = 'stretch_both' - plot3.sizing_mode = 'stretch_both' - plot4.sizing_mode = 'stretch_both' + #plot1.sizing_mode = 'stretch_both' + #plot2.sizing_mode = 'stretch_both' + #plot3.sizing_mode = 'stretch_both' + #plot4.sizing_mode = 'stretch_both' linked_crosshair = CrosshairTool(dimensions="height") plot1.add_tools(linked_crosshair) @@ -5735,7 +5736,7 @@ def interactive_flexchart_stacked(id, r, xparam='time', plot4, ]) - mylayout.sizing_mode = 'stretch_both' + #mylayout.sizing_mode = 'stretch_both' script, div = components(mylayout) js_resources = INLINE.render_js() @@ -5944,7 +5945,7 @@ def interactive_flex_chart2(id, r, promember=0, tools=TOOLS, toolbar_location='above', toolbar_sticky=False, width=800, height=600, ) - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' # add watermark watermarkurl = "/static/img/logo7.png" @@ -5957,7 +5958,7 @@ def interactive_flex_chart2(id, r, promember=0, watermarkanchor = 'bottom_right' plot.extra_y_ranges = {"watermark": watermarkrange} plot.extra_x_ranges = {"watermark": watermarkrange} - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' plot.image_url([watermarkurl], watermarkx, watermarky, watermarkw, watermarkh, @@ -6052,7 +6053,7 @@ def interactive_flex_chart2(id, r, promember=0, plot.title.text = row.name plot.title.text_font_size = "1.0em" - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' plot.xaxis.axis_label = xaxlabel plot.yaxis.axis_label = yaxlabel @@ -6327,7 +6328,7 @@ def interactive_flex_chart2(id, r, promember=0, mylayout = layoutrow([thesliders, plot]) # layout.sizing_mode = 'stretch_both' - mylayout.sizing_mode = 'stretch_both' + #mylayout.sizing_mode = 'stretch_both' script, div = components(mylayout) js_resources = INLINE.render_js() @@ -6382,7 +6383,7 @@ def thumbnails_set(r, id, favorites): rowdata['time'].max(), maxlength) groups = rowdata.groupby(np.digitize(rowdata['time'], bins)) rowdata = groups.mean() - except KeyError: # pragma: no cover + except (KeyError, TypeError): # pragma: no cover pass for f in favorites: @@ -6654,7 +6655,7 @@ def interactive_multiple_compare_chart(ids, xparam, yparam, plottype='line', watermarkh = 35 plot.extra_y_ranges = {"watermark": watermarkrange} plot.extra_x_ranges = {"watermark": watermarkrange} - plot.sizing_mode = 'stretch_both' + #plot.sizing_mode = 'stretch_both' plot.image_url([watermarkurl], 0.05, 0.9, watermarkw, watermarkh, @@ -7226,7 +7227,7 @@ def interactive_zoneschart(rower, data, startdate, enddate, trainingzones='hr', p.height = 350 p.toolbar_location = 'right' p.y_range.start = 0 - p.sizing_mode = 'stretch_both' + #p.sizing_mode = 'stretch_both' if yaxis == 'percentage': tidy_df = df2.groupby(['date']).sum() diff --git a/rowers/tests/testdata/testdata.tcx.gz b/rowers/tests/testdata/testdata.tcx.gz deleted file mode 100644 index e69de29b..00000000