working on 3.9
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
from django.apps import AppConfig
|
||||
import os
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
class BoatmoversConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
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
|
||||
import os
|
||||
from django.conf import settings
|
||||
|
||||
# Store metadata for the app
|
||||
|
||||
|
||||
class RowersConfig(AppConfig):
|
||||
name = 'rowers'
|
||||
path = os.path.join(settings.BASE_DIR, 'rowers')
|
||||
|
||||
@@ -1369,6 +1369,7 @@ def read_cols_df_sql(ids, columns, convertnewtons=True):
|
||||
|
||||
extracols = []
|
||||
|
||||
|
||||
columns = list(columns) + ['distance', 'spm', 'workoutid']
|
||||
columns = [x for x in columns if x != 'None']
|
||||
columns = list(set(columns))
|
||||
@@ -1381,27 +1382,35 @@ def read_cols_df_sql(ids, columns, convertnewtons=True):
|
||||
elif len(ids) == 1: # pragma: no cover
|
||||
try:
|
||||
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:
|
||||
rowdata, row = getrowdata(id=ids[0])
|
||||
if rowdata and len(rowdata.df):
|
||||
_ = dataprep(rowdata.df,
|
||||
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:
|
||||
data = []
|
||||
filenames = [
|
||||
'media/strokedata_{id}.parquet.gz'.format(id=id) for id in ids]
|
||||
for id, f in zip(ids, filenames):
|
||||
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)
|
||||
except (OSError, IndexError, ArrowInvalid):
|
||||
rowdata, row = getrowdata(id=id)
|
||||
if rowdata and len(rowdata.df): # pragma: no cover
|
||||
_ = dataprep(rowdata.df, id=id,
|
||||
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)
|
||||
|
||||
try:
|
||||
|
||||
@@ -4853,14 +4853,13 @@ def interactive_multiflex(datadf, xparam, yparam, groupby, extratitle='',
|
||||
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap'
|
||||
|
||||
if groupby != 'date':
|
||||
hover = HoverTool(names=['data'],
|
||||
tooltips=[
|
||||
hover = HoverTool(tooltips=[
|
||||
(groupby, '@groupval{1.1}'),
|
||||
(xparamname, '@x{1.1}'),
|
||||
(yparamname, '@y')
|
||||
])
|
||||
else: # pragma: no cover
|
||||
hover = HoverTool(names=['data'],
|
||||
hover = HoverTool(
|
||||
tooltips=[
|
||||
(groupby, '@groupval'),
|
||||
(xparamname, '@x{1.1}'),
|
||||
@@ -6851,7 +6850,7 @@ def interactive_otw_advanced_pace_chart(id=0, promember=0):
|
||||
)
|
||||
|
||||
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.yaxis.axis_label = "Pace (/500m)"
|
||||
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.line('date', 'hours', source=source2,
|
||||
y_range_name="yax2", color="black", width=5)
|
||||
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)
|
||||
|
||||
# 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",
|
||||
axis_label='Hours'), 'right')
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
{{ js_res | safe }}
|
||||
{{ css_res| safe }}
|
||||
|
||||
<script src="https://cdn.pydata.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-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">
|
||||
Bokeh.set_log_level("info");
|
||||
</script>
|
||||
|
||||
@@ -414,11 +414,26 @@ def trendflexdata(workouts, options, userid=0):
|
||||
groups = datadf.groupby(pd.cut(datadf['days ago'], bins,
|
||||
labels=False))
|
||||
|
||||
xvalues = groups.mean()[xparam]
|
||||
yvalues = groups.mean()[yparam]
|
||||
xerror = groups.std()[xparam]
|
||||
yerror = groups.std()[yparam]
|
||||
groupsize = groups.count()[xparam]
|
||||
xvalues = []
|
||||
yvalues = []
|
||||
xerror = []
|
||||
yerror = []
|
||||
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()])
|
||||
xvalues.loc[mask] = np.nan
|
||||
@@ -458,7 +473,7 @@ def trendflexdata(workouts, options, userid=0):
|
||||
|
||||
if groupby != 'date':
|
||||
try:
|
||||
df['groupval'] = groups.mean()[groupby]
|
||||
df['groupval'] = pd.Series(groupval)
|
||||
df.loc[mask, 'groupval'] = np.nan
|
||||
|
||||
groupcols = df['groupval']
|
||||
|
||||
@@ -3859,6 +3859,8 @@ def workout_stats_view(request, id=0, message="", successmessage=""):
|
||||
except KeyError: # pragma: no cover
|
||||
pass
|
||||
|
||||
datadf = datadf.select_dtypes([np.number])
|
||||
|
||||
# Create a dict with correlation values
|
||||
cor = datadf.corr(method='spearman')
|
||||
cor.fillna(value=0, inplace=True)
|
||||
|
||||
Reference in New Issue
Block a user