working on 3.9
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
import os
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
class BoatmoversConfig(AppConfig):
|
class BoatmoversConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
name = 'boatmovers'
|
name = 'boatmovers'
|
||||||
|
path = os.path.join(settings.BASE_DIR, 'boatmovers')
|
||||||
|
|||||||
8
django_extensions/apps.py
Normal file
8
django_extensions/apps.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
import os
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
|
class DjangoExtensionsConfig(AppConfig):
|
||||||
|
name = 'django_extensions'
|
||||||
|
path = os.path.join(settings.BASE_DIR, 'django_extensions')
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
import os
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
# Store metadata for the app
|
# Store metadata for the app
|
||||||
|
|
||||||
|
|
||||||
class RowersConfig(AppConfig):
|
class RowersConfig(AppConfig):
|
||||||
name = 'rowers'
|
name = 'rowers'
|
||||||
|
path = os.path.join(settings.BASE_DIR, 'rowers')
|
||||||
|
|||||||
@@ -1369,6 +1369,7 @@ def read_cols_df_sql(ids, columns, convertnewtons=True):
|
|||||||
|
|
||||||
extracols = []
|
extracols = []
|
||||||
|
|
||||||
|
|
||||||
columns = list(columns) + ['distance', 'spm', 'workoutid']
|
columns = list(columns) + ['distance', 'spm', 'workoutid']
|
||||||
columns = [x for x in columns if x != 'None']
|
columns = [x for x in columns if x != 'None']
|
||||||
columns = list(set(columns))
|
columns = list(set(columns))
|
||||||
@@ -1381,27 +1382,35 @@ def read_cols_df_sql(ids, columns, convertnewtons=True):
|
|||||||
elif len(ids) == 1: # pragma: no cover
|
elif len(ids) == 1: # pragma: no cover
|
||||||
try:
|
try:
|
||||||
filename = 'media/strokedata_{id}.parquet.gz'.format(id=ids[0])
|
filename = 'media/strokedata_{id}.parquet.gz'.format(id=ids[0])
|
||||||
df = pd.read_parquet(filename, columns=columns)
|
pq_file = pq.ParquetDataset(filename)
|
||||||
|
columns_in_file = [c for c in columns if c in pq_file.schema.names]
|
||||||
|
df = pd.read_parquet(filename, columns=columns_in_file)
|
||||||
except OSError:
|
except OSError:
|
||||||
rowdata, row = getrowdata(id=ids[0])
|
rowdata, row = getrowdata(id=ids[0])
|
||||||
if rowdata and len(rowdata.df):
|
if rowdata and len(rowdata.df):
|
||||||
_ = dataprep(rowdata.df,
|
_ = dataprep(rowdata.df,
|
||||||
id=ids[0], bands=True, otwpower=True, barchart=True)
|
id=ids[0], bands=True, otwpower=True, barchart=True)
|
||||||
df = pd.read_parquet(filename, columns=columns)
|
pq_file = pq.ParquetDataset(filename)
|
||||||
|
columns_in_file = [c for c in columns if c in pq_file.schema.names]
|
||||||
|
df = pd.read_parquet(filename, columns=columns_in_file)
|
||||||
else:
|
else:
|
||||||
data = []
|
data = []
|
||||||
filenames = [
|
filenames = [
|
||||||
'media/strokedata_{id}.parquet.gz'.format(id=id) for id in ids]
|
'media/strokedata_{id}.parquet.gz'.format(id=id) for id in ids]
|
||||||
for id, f in zip(ids, filenames):
|
for id, f in zip(ids, filenames):
|
||||||
try:
|
try:
|
||||||
df = pd.read_parquet(f, columns=columns)
|
pq_file = pq.ParquetDataset(f)
|
||||||
|
columns_in_file = [c for c in columns if c in pq_file.schema.names]
|
||||||
|
df = pd.read_parquet(f, columns=columns_in_file)
|
||||||
data.append(df)
|
data.append(df)
|
||||||
except (OSError, IndexError, ArrowInvalid):
|
except (OSError, IndexError, ArrowInvalid):
|
||||||
rowdata, row = getrowdata(id=id)
|
rowdata, row = getrowdata(id=id)
|
||||||
if rowdata and len(rowdata.df): # pragma: no cover
|
if rowdata and len(rowdata.df): # pragma: no cover
|
||||||
_ = dataprep(rowdata.df, id=id,
|
_ = dataprep(rowdata.df, id=id,
|
||||||
bands=True, otwpower=True, barchart=True)
|
bands=True, otwpower=True, barchart=True)
|
||||||
df = pd.read_parquet(f, columns=columns)
|
pq_file = pq.ParquetDataset(f)
|
||||||
|
columns_in_file = [c for c in columns if c in pq_file.schema.names]
|
||||||
|
df = pd.read_parquet(f, columns=columns_in_file)
|
||||||
data.append(df)
|
data.append(df)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -4853,18 +4853,17 @@ def interactive_multiflex(datadf, xparam, yparam, groupby, extratitle='',
|
|||||||
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap'
|
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap'
|
||||||
|
|
||||||
if groupby != 'date':
|
if groupby != 'date':
|
||||||
hover = HoverTool(names=['data'],
|
hover = HoverTool(tooltips=[
|
||||||
tooltips=[
|
(groupby, '@groupval{1.1}'),
|
||||||
(groupby, '@groupval{1.1}'),
|
(xparamname, '@x{1.1}'),
|
||||||
(xparamname, '@x{1.1}'),
|
(yparamname, '@y')
|
||||||
(yparamname, '@y')
|
|
||||||
])
|
])
|
||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
hover = HoverTool(names=['data'],
|
hover = HoverTool(
|
||||||
tooltips=[
|
tooltips=[
|
||||||
(groupby, '@groupval'),
|
(groupby, '@groupval'),
|
||||||
(xparamname, '@x{1.1}'),
|
(xparamname, '@x{1.1}'),
|
||||||
(yparamname, '@y'),
|
(yparamname, '@y'),
|
||||||
])
|
])
|
||||||
|
|
||||||
hover.mode = 'mouse'
|
hover.mode = 'mouse'
|
||||||
@@ -6851,7 +6850,7 @@ def interactive_otw_advanced_pace_chart(id=0, promember=0):
|
|||||||
)
|
)
|
||||||
|
|
||||||
plot.title.text = row.name
|
plot.title.text = row.name
|
||||||
plot.title.text_font_size = value("1.2em")
|
#plot.title.text_font_size = value("1.2em")
|
||||||
plot.xaxis.axis_label = "Time"
|
plot.xaxis.axis_label = "Time"
|
||||||
plot.yaxis.axis_label = "Pace (/500m)"
|
plot.yaxis.axis_label = "Pace (/500m)"
|
||||||
plot.xaxis[0].formatter = DatetimeTickFormatter(
|
plot.xaxis[0].formatter = DatetimeTickFormatter(
|
||||||
@@ -7236,8 +7235,10 @@ def interactive_zoneschart(rower, data, startdate, enddate, trainingzones='hr',
|
|||||||
p.extra_y_ranges["yax2"] = Range1d(start=0, end=y2rangemax)
|
p.extra_y_ranges["yax2"] = Range1d(start=0, end=y2rangemax)
|
||||||
p.line('date', 'hours', source=source2,
|
p.line('date', 'hours', source=source2,
|
||||||
y_range_name="yax2", color="black", width=5)
|
y_range_name="yax2", color="black", width=5)
|
||||||
p.circle('date', 'hours', source=source2, y_range_name="yax2", color="black", size=10,
|
p.circle('date', 'hours', source=source2, y_range_name="yax2", color="black", size=10)
|
||||||
legend_label='Hours')
|
|
||||||
|
# p.circle('date', 'hours', source=source2, y_range_name="yax2", color="black", size=10,
|
||||||
|
# legend_label='Hours')
|
||||||
p.add_layout(LinearAxis(y_range_name="yax2",
|
p.add_layout(LinearAxis(y_range_name="yax2",
|
||||||
axis_label='Hours'), 'right')
|
axis_label='Hours'), 'right')
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
{{ js_res | safe }}
|
{{ js_res | safe }}
|
||||||
{{ css_res| safe }}
|
{{ css_res| safe }}
|
||||||
|
|
||||||
<script src="https://cdn.pydata.org/bokeh/release/bokeh-3.1.1.min.js"></script>
|
<script src="https://cdn.bokeh.org/bokeh/release/bokeh-3.1.1.min.js"></script>
|
||||||
<script src="https://cdn.pydata.org/bokeh/release/bokeh-widgets-3.1.1.min.js"></script>
|
<script src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.1.1.min.js"></script>
|
||||||
<script async="true" type="text/javascript">
|
<script async="true" type="text/javascript">
|
||||||
Bokeh.set_log_level("info");
|
Bokeh.set_log_level("info");
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -414,11 +414,26 @@ def trendflexdata(workouts, options, userid=0):
|
|||||||
groups = datadf.groupby(pd.cut(datadf['days ago'], bins,
|
groups = datadf.groupby(pd.cut(datadf['days ago'], bins,
|
||||||
labels=False))
|
labels=False))
|
||||||
|
|
||||||
xvalues = groups.mean()[xparam]
|
xvalues = []
|
||||||
yvalues = groups.mean()[yparam]
|
yvalues = []
|
||||||
xerror = groups.std()[xparam]
|
xerror = []
|
||||||
yerror = groups.std()[yparam]
|
yerror = []
|
||||||
groupsize = groups.count()[xparam]
|
groupsize = []
|
||||||
|
groupval = []
|
||||||
|
for key, item in groups:
|
||||||
|
xvalues.append(groups.get_group(key)[xparam].mean())
|
||||||
|
yvalues.append(groups.get_group(key)[yparam].mean())
|
||||||
|
xerror.append(groups.get_group(key)[xparam].std())
|
||||||
|
yerror.append(groups.get_group(key)[yparam].std())
|
||||||
|
groupsize.append(len(groups.get_group(key)[xparam]))
|
||||||
|
groupval.append(groups.get_group(key)[groupby].mean())
|
||||||
|
|
||||||
|
|
||||||
|
xvalues = pd.Series(xvalues)
|
||||||
|
yvalues = pd.Series(yvalues)
|
||||||
|
xerror = pd.Series(xerror)
|
||||||
|
yerror = pd.Series(yerror)
|
||||||
|
groupsize = pd.Series(groupsize)
|
||||||
|
|
||||||
mask = groupsize <= min([0.01*groupsize.sum(), 0.2*groupsize.mean()])
|
mask = groupsize <= min([0.01*groupsize.sum(), 0.2*groupsize.mean()])
|
||||||
xvalues.loc[mask] = np.nan
|
xvalues.loc[mask] = np.nan
|
||||||
@@ -458,7 +473,7 @@ def trendflexdata(workouts, options, userid=0):
|
|||||||
|
|
||||||
if groupby != 'date':
|
if groupby != 'date':
|
||||||
try:
|
try:
|
||||||
df['groupval'] = groups.mean()[groupby]
|
df['groupval'] = pd.Series(groupval)
|
||||||
df.loc[mask, 'groupval'] = np.nan
|
df.loc[mask, 'groupval'] = np.nan
|
||||||
|
|
||||||
groupcols = df['groupval']
|
groupcols = df['groupval']
|
||||||
|
|||||||
@@ -3859,6 +3859,8 @@ def workout_stats_view(request, id=0, message="", successmessage=""):
|
|||||||
except KeyError: # pragma: no cover
|
except KeyError: # pragma: no cover
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
datadf = datadf.select_dtypes([np.number])
|
||||||
|
|
||||||
# Create a dict with correlation values
|
# Create a dict with correlation values
|
||||||
cor = datadf.corr(method='spearman')
|
cor = datadf.corr(method='spearman')
|
||||||
cor.fillna(value=0, inplace=True)
|
cor.fillna(value=0, inplace=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user