removing unnecessary code
This commit is contained in:
@@ -554,661 +554,6 @@ def interactive_forcecurve(theworkouts):
|
||||
script, div = get_chart("/forcecurve", chart_data)
|
||||
return script, div
|
||||
|
||||
try:
|
||||
covariancematrix = np.cov(
|
||||
rowdata['peakforceangle'], y=rowdata['peakforce'])
|
||||
eig_vals, eig_vecs = np.linalg.eig(covariancematrix)
|
||||
|
||||
a = rowdata['peakforceangle']-rowdata['peakforceangle'].median()
|
||||
F = rowdata['peakforce']-rowdata['peakforce'].median()
|
||||
|
||||
Rinv = eig_vecs
|
||||
R = np.linalg.inv(Rinv)
|
||||
|
||||
x = R[0, 0]*a+R[0, 1]*F
|
||||
y = R[1, 0]*a+R[1, 1]*F
|
||||
|
||||
x05 = x.quantile(q=0.01)
|
||||
x25 = x.quantile(q=0.15)
|
||||
x75 = x.quantile(q=0.85)
|
||||
x95 = x.quantile(q=0.99)
|
||||
|
||||
y05 = y.quantile(q=0.01)
|
||||
y25 = y.quantile(q=0.15)
|
||||
y75 = y.quantile(q=0.85)
|
||||
y95 = y.quantile(q=0.99)
|
||||
|
||||
a25 = Rinv[0, 0]*x25 + rowdata['peakforceangle'].median()
|
||||
F25 = Rinv[1, 0]*x25 + rowdata['peakforce'].median()
|
||||
|
||||
a25b = Rinv[0, 1]*y25 + rowdata['peakforceangle'].median()
|
||||
F25b = Rinv[1, 1]*y25 + rowdata['peakforce'].median()
|
||||
|
||||
a75 = Rinv[0, 0]*x75 + rowdata['peakforceangle'].median()
|
||||
F75 = Rinv[1, 0]*x75 + rowdata['peakforce'].median()
|
||||
|
||||
a75b = Rinv[0, 1]*y75 + rowdata['peakforceangle'].median()
|
||||
F75b = Rinv[1, 1]*y75 + rowdata['peakforce'].median()
|
||||
|
||||
a05 = Rinv[0, 0]*x05 + rowdata['peakforceangle'].median()
|
||||
F05 = Rinv[1, 0]*x05 + rowdata['peakforce'].median()
|
||||
|
||||
a05b = Rinv[0, 1]*y05 + rowdata['peakforceangle'].median()
|
||||
F05b = Rinv[1, 1]*y05 + rowdata['peakforce'].median()
|
||||
|
||||
a95 = Rinv[0, 0]*x95 + rowdata['peakforceangle'].median()
|
||||
F95 = Rinv[1, 0]*x95 + rowdata['peakforce'].median()
|
||||
|
||||
a95b = Rinv[0, 1]*y95 + rowdata['peakforceangle'].median()
|
||||
F95b = Rinv[1, 1]*y95 + rowdata['peakforce'].median()
|
||||
except KeyError: # pragma: no cover
|
||||
a25 = 0
|
||||
F25 = 0
|
||||
|
||||
a25b = 0
|
||||
F25b = 0
|
||||
|
||||
a75 = 0
|
||||
F75 = 0
|
||||
|
||||
a75b = 0
|
||||
F75b = 0
|
||||
|
||||
a05 = 0
|
||||
F05 = 0
|
||||
|
||||
a05b = 0
|
||||
F05b = 0
|
||||
|
||||
a95 = 0
|
||||
F95 = 0
|
||||
|
||||
a95b = 0
|
||||
F95b = 0
|
||||
|
||||
try:
|
||||
catchav = rowdata['catch'].median()
|
||||
catch25 = rowdata['catch'].quantile(q=0.25)
|
||||
catch75 = rowdata['catch'].quantile(q=0.75)
|
||||
catch05 = rowdata['catch'].quantile(q=0.05)
|
||||
catch95 = rowdata['catch'].quantile(q=0.95)
|
||||
except KeyError: # pragma: no cover
|
||||
catchav = 0
|
||||
catch25 = 0
|
||||
catch75 = 0
|
||||
catch05 = 0
|
||||
catch95 = 0
|
||||
|
||||
try:
|
||||
finishav = rowdata['finish'].median()
|
||||
finish25 = rowdata['finish'].quantile(q=0.25)
|
||||
finish75 = rowdata['finish'].quantile(q=0.75)
|
||||
finish05 = rowdata['finish'].quantile(q=0.05)
|
||||
finish95 = rowdata['finish'].quantile(q=0.95)
|
||||
except KeyError: # pragma: no cover
|
||||
finishav = 0
|
||||
finish25 = 0
|
||||
finish75 = 0
|
||||
finish05 = 0
|
||||
finish95 = 0
|
||||
|
||||
try:
|
||||
washav = (rowdata['finish']-rowdata['wash']).median()
|
||||
wash25 = (rowdata['finish']-rowdata['wash']).quantile(q=0.25)
|
||||
wash75 = (rowdata['finish']-rowdata['wash']).quantile(q=0.75)
|
||||
wash05 = (rowdata['finish']-rowdata['wash']).quantile(q=0.05)
|
||||
wash95 = (rowdata['finish']-rowdata['wash']).quantile(q=0.95)
|
||||
except KeyError: # pragma: no cover
|
||||
washav = 0
|
||||
wash25 = 0
|
||||
wash75 = 0
|
||||
wash05 = 0
|
||||
wash95 = 0
|
||||
|
||||
try:
|
||||
slipav = (rowdata['slip']+rowdata['catch']).median()
|
||||
slip25 = (rowdata['slip']+rowdata['catch']).quantile(q=0.25)
|
||||
slip75 = (rowdata['slip']+rowdata['catch']).quantile(q=0.75)
|
||||
slip05 = (rowdata['slip']+rowdata['catch']).quantile(q=0.05)
|
||||
slip95 = (rowdata['slip']+rowdata['catch']).quantile(q=0.95)
|
||||
except KeyError: # pragma: no cover
|
||||
slipav = 0
|
||||
slip25 = 0
|
||||
slip75 = 0
|
||||
slip05 = 0
|
||||
slip95 = 0
|
||||
|
||||
try:
|
||||
peakforceav = rowdata['peakforce'].median()
|
||||
except KeyError: # pragma: no cover
|
||||
peakforceav = 0
|
||||
|
||||
try:
|
||||
averageforceav = rowdata['averageforce'].median()
|
||||
except KeyError: # pragma: no cover
|
||||
averageforceav = 0
|
||||
|
||||
try:
|
||||
peakforceangleav = rowdata['peakforceangle'].median()
|
||||
except KeyError: # pragma: no cover
|
||||
peakforceangleav = 0
|
||||
|
||||
# thresholdforce /= 4.45 # N to lbs
|
||||
thresholdforce = 100 if 'x' in boattype else 200
|
||||
points2575 = [
|
||||
(catch25, 0), # 0
|
||||
(slip25, thresholdforce), # 1
|
||||
(a75, F75), # 4
|
||||
(a25b, F25b), # 9
|
||||
(a25, F25), # 2
|
||||
(wash75, thresholdforce), # 5
|
||||
(finish75, 0), # 6
|
||||
(finish25, 0), # 7
|
||||
(wash25, thresholdforce), # 8
|
||||
(a75b, F75b), # 3
|
||||
(slip75, thresholdforce), # 10
|
||||
(catch75, 0), # 11
|
||||
]
|
||||
|
||||
points0595 = [
|
||||
(catch05, 0), # 0
|
||||
(slip05, thresholdforce), # 1
|
||||
(a95, F95), # 4
|
||||
(a05b, F05b), # 9
|
||||
(a05, F05), # 2
|
||||
(wash95, thresholdforce), # 5
|
||||
(finish95, 0), # 6
|
||||
(finish05, 0), # 7
|
||||
(wash05, thresholdforce), # 8
|
||||
(a95b, F95b), # 3
|
||||
(slip95, thresholdforce), # 10
|
||||
(catch95, 0), # 11
|
||||
]
|
||||
|
||||
angles2575 = []
|
||||
forces2575 = []
|
||||
|
||||
for x, y in points2575:
|
||||
angles2575.append(x)
|
||||
forces2575.append(y)
|
||||
|
||||
angles0595 = []
|
||||
forces0595 = []
|
||||
|
||||
for x, y in points0595:
|
||||
angles0595.append(x)
|
||||
forces0595.append(y)
|
||||
|
||||
x = [catchav,
|
||||
slipav,
|
||||
peakforceangleav,
|
||||
washav,
|
||||
finishav]
|
||||
|
||||
y = [0, thresholdforce,
|
||||
peakforceav,
|
||||
thresholdforce, 0]
|
||||
|
||||
source = ColumnDataSource(
|
||||
data=dict(
|
||||
x=x,
|
||||
y=y,
|
||||
))
|
||||
|
||||
sourceslipwash = ColumnDataSource(
|
||||
data=dict(
|
||||
xslip=[slipav, washav],
|
||||
yslip=[thresholdforce, thresholdforce]
|
||||
)
|
||||
)
|
||||
|
||||
source2 = ColumnDataSource(
|
||||
rowdata
|
||||
)
|
||||
|
||||
if plottype == 'scatter': # pragma: no cover
|
||||
try:
|
||||
sourcepoints = ColumnDataSource(
|
||||
data=dict(
|
||||
peakforceangle=rowdata['peakforceangle'],
|
||||
peakforce=rowdata['peakforce']
|
||||
)
|
||||
)
|
||||
except KeyError:
|
||||
sourcepoints = ColumnDataSource(
|
||||
data=dict(
|
||||
peakforceangle=[],
|
||||
peakforce=[]
|
||||
)
|
||||
)
|
||||
else:
|
||||
sourcepoints = ColumnDataSource(
|
||||
data=dict(
|
||||
peakforceangle=[],
|
||||
peakforce=[]
|
||||
))
|
||||
|
||||
sourcerange = ColumnDataSource(
|
||||
data=dict(
|
||||
x2575=angles2575,
|
||||
y2575=forces2575,
|
||||
x0595=angles0595,
|
||||
y0595=forces0595,
|
||||
)
|
||||
)
|
||||
|
||||
plot = figure(tools=TOOLS,
|
||||
toolbar_sticky=False, toolbar_location="above", width=800, height=600)
|
||||
#plot.sizing_mode = 'stretch_both'
|
||||
|
||||
# add watermark
|
||||
watermarkurl = "/static/img/logo7.png"
|
||||
|
||||
watermarkrange = Range1d(start=0, end=1)
|
||||
watermarkalpha = 0.6
|
||||
watermarkx = 0.99
|
||||
watermarky = 0.01
|
||||
watermarkw = 184
|
||||
watermarkh = 35
|
||||
watermarkanchor = 'bottom_right'
|
||||
plot.extra_y_ranges = {"watermark": watermarkrange}
|
||||
plot.extra_x_ranges = {"watermark": watermarkrange}
|
||||
|
||||
plot.image_url([watermarkurl], watermarkx, watermarky,
|
||||
watermarkw, watermarkh,
|
||||
global_alpha=watermarkalpha,
|
||||
w_units='screen',
|
||||
h_units='screen',
|
||||
anchor=watermarkanchor,
|
||||
dilate=True,
|
||||
x_range_name="watermark",
|
||||
y_range_name="watermark",
|
||||
)
|
||||
|
||||
avf = Span(location=averageforceav, dimension='width', line_color='blue',
|
||||
line_dash=[6, 6], line_width=2)
|
||||
|
||||
plot.patch('x0595', 'y0595', source=sourcerange, color="red", alpha=0.05)
|
||||
plot.patch('x2575', 'y2575', source=sourcerange, color="red", alpha=0.2)
|
||||
plot.line('x', 'y', source=source, color="red")
|
||||
plot.circle('xslip', 'yslip', source=sourceslipwash, color="red")
|
||||
|
||||
plot.circle('peakforceangle', 'peakforce',
|
||||
source=sourcepoints, color='black', alpha=0.1)
|
||||
|
||||
if plottype == 'line':
|
||||
multilinedatax = []
|
||||
multilinedatay = []
|
||||
for i in range(len(rowdata)):
|
||||
try:
|
||||
x = [
|
||||
rowdata['catch'].values[i],
|
||||
rowdata['slip'].values[i]+rowdata['catch'].values[i],
|
||||
rowdata['peakforceangle'].values[i],
|
||||
rowdata['finish'].values[i]-rowdata['wash'].values[i],
|
||||
rowdata['finish'].values[i]
|
||||
]
|
||||
|
||||
y = [
|
||||
0,
|
||||
thresholdforce,
|
||||
rowdata['peakforce'].values[i],
|
||||
thresholdforce,
|
||||
0]
|
||||
except KeyError: # pragma: no cover
|
||||
x = [0, 0]
|
||||
y = [0, 0]
|
||||
|
||||
multilinedatax.append(x)
|
||||
multilinedatay.append(y)
|
||||
|
||||
sourcemultiline = ColumnDataSource(dict(
|
||||
x=multilinedatax,
|
||||
y=multilinedatay,
|
||||
))
|
||||
|
||||
sourcemultiline2 = ColumnDataSource(dict(
|
||||
x=multilinedatax,
|
||||
y=multilinedatay,
|
||||
))
|
||||
|
||||
glyph = MultiLine(xs='x', ys='y', line_color='black', line_alpha=0.05)
|
||||
plot.add_glyph(sourcemultiline, glyph)
|
||||
else: # pragma: no cover
|
||||
sourcemultiline = ColumnDataSource(dict(
|
||||
x=[], y=[]))
|
||||
|
||||
sourcemultiline2 = ColumnDataSource(dict(
|
||||
x=[], y=[]))
|
||||
|
||||
plot.line('x', 'y', source=source, color="red")
|
||||
|
||||
plot.add_layout(avf)
|
||||
|
||||
peakflabel = Label(x=760, y=460, x_units='screen', y_units='screen',
|
||||
text="Fpeak: {peakforceav:6.2f}".format(
|
||||
peakforceav=peakforceav),
|
||||
background_fill_alpha=.7,
|
||||
background_fill_color='white',
|
||||
text_color='blue',
|
||||
)
|
||||
|
||||
avflabel = Label(x=770, y=430, x_units='screen', y_units='screen',
|
||||
text="Favg: {averageforceav:6.2f}".format(
|
||||
averageforceav=averageforceav),
|
||||
background_fill_alpha=.7,
|
||||
background_fill_color='white',
|
||||
text_color='blue',
|
||||
)
|
||||
|
||||
catchlabel = Label(x=765, y=400, x_units='screen', y_units='screen',
|
||||
text="Catch: {catchav:6.2f}".format(catchav=catchav),
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='red',
|
||||
)
|
||||
|
||||
peakforceanglelabel = Label(x=725, y=370, x_units='screen', y_units='screen',
|
||||
text="Peak angle: {peakforceangleav:6.2f}".format(
|
||||
peakforceangleav=peakforceangleav),
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='red',
|
||||
)
|
||||
|
||||
finishlabel = Label(x=760, y=340, x_units='screen', y_units='screen',
|
||||
text="Finish: {finishav:6.2f}".format(
|
||||
finishav=finishav),
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='red',
|
||||
)
|
||||
|
||||
sliplabel = Label(x=775, y=310, x_units='screen', y_units='screen',
|
||||
text="Slip: {slipav:6.2f}".format(slipav=slipav-catchav),
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='red',
|
||||
)
|
||||
|
||||
washlabel = Label(x=765, y=280, x_units='screen', y_units='screen',
|
||||
text="Wash: {washav:6.2f}".format(
|
||||
washav=finishav-washav),
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='red',
|
||||
)
|
||||
|
||||
lengthlabel = Label(x=755, y=250, x_units='screen', y_units='screen',
|
||||
text="Length: {length:6.2f}".format(
|
||||
length=finishav-catchav),
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='green'
|
||||
)
|
||||
|
||||
efflengthlabel = Label(x=690, y=220, x_units='screen', y_units='screen',
|
||||
text="Effective Length: {length:6.2f}".format(
|
||||
length=washav-slipav),
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='green'
|
||||
)
|
||||
|
||||
annolabel = Label(x=50, y=450, x_units='screen', y_units='screen',
|
||||
text='',
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='black',
|
||||
)
|
||||
|
||||
sliderlabel = Label(x=10, y=470, x_units='screen', y_units='screen',
|
||||
text='',
|
||||
background_fill_alpha=0.7,
|
||||
background_fill_color='white',
|
||||
text_color='black', text_font_size='10pt',
|
||||
)
|
||||
|
||||
plot.add_layout(peakflabel)
|
||||
plot.add_layout(peakforceanglelabel)
|
||||
plot.add_layout(avflabel)
|
||||
plot.add_layout(catchlabel)
|
||||
plot.add_layout(sliplabel)
|
||||
plot.add_layout(washlabel)
|
||||
plot.add_layout(finishlabel)
|
||||
plot.add_layout(annolabel)
|
||||
plot.add_layout(sliderlabel)
|
||||
plot.add_layout(lengthlabel)
|
||||
plot.add_layout(efflengthlabel)
|
||||
|
||||
plot.xaxis.axis_label = "Angle"
|
||||
plot.yaxis.axis_label = "Force (N)"
|
||||
try:
|
||||
plot.title.text = theworkouts[0].name
|
||||
except ValueError: # pragma: no cover
|
||||
plot.title.text = ""
|
||||
plot.title.text_font_size = "1.0em"
|
||||
|
||||
yrange1 = Range1d(start=0, end=900)
|
||||
plot.y_range = yrange1
|
||||
|
||||
xrange1 = Range1d(start=yaxmaxima['catch'], end=yaxmaxima['finish'])
|
||||
plot.x_range = xrange1
|
||||
|
||||
callback = CustomJS(args=dict(
|
||||
source=source,
|
||||
source2=source2,
|
||||
sourceslipwash=sourceslipwash,
|
||||
sourcepoints=sourcepoints,
|
||||
avf=avf,
|
||||
avflabel=avflabel,
|
||||
catchlabel=catchlabel,
|
||||
finishlabel=finishlabel,
|
||||
sliplabel=sliplabel,
|
||||
washlabel=washlabel,
|
||||
peakflabel=peakflabel,
|
||||
peakforceanglelabel=peakforceanglelabel,
|
||||
annolabel=annolabel,
|
||||
sliderlabel=sliderlabel,
|
||||
lengthlabel=lengthlabel,
|
||||
efflengthlabel=efflengthlabel,
|
||||
plottype=plottype,
|
||||
sourcemultiline=sourcemultiline,
|
||||
sourcemultiline2=sourcemultiline2
|
||||
), code="""
|
||||
var data = source.data
|
||||
var data2 = source2.data
|
||||
var dataslipwash = sourceslipwash.data
|
||||
var datapoints = sourcepoints.data
|
||||
var multilines = sourcemultiline.data
|
||||
var multilines2 = sourcemultiline2.data
|
||||
var plottype = plottype
|
||||
|
||||
var multilinesx = multilines2['x']
|
||||
var multilinesy = multilines2['y']
|
||||
|
||||
var x = data['x']
|
||||
var y = data['y']
|
||||
|
||||
var xslip = dataslipwash['xslip']
|
||||
|
||||
var spm1 = data2['spm']
|
||||
var distance1 = data2['distance']
|
||||
var driveenergy1 = data2['driveenergy']
|
||||
|
||||
var thresholdforce = y[1]
|
||||
|
||||
var c = source2.data['catch']
|
||||
var finish = data2['finish']
|
||||
var slip = data2['slip']
|
||||
var wash = data2['wash']
|
||||
var peakforceangle = data2['peakforceangle']
|
||||
var peakforce = data2['peakforce']
|
||||
var averageforce = data2['averageforce']
|
||||
|
||||
var peakforcepoints = datapoints['peakforce']
|
||||
var peakforceanglepoints = datapoints['peakforceangle']
|
||||
|
||||
var annotation = annotation.value
|
||||
var minspm = minspm.value
|
||||
var maxspm = maxspm.value
|
||||
var mindist = mindist.value
|
||||
var maxdist = maxdist.value
|
||||
var minwork = minwork.value
|
||||
var maxwork = maxwork.value
|
||||
|
||||
sliderlabel.text = 'SPM: '+minspm.toFixed(0)+'-'+maxspm.toFixed(0)
|
||||
sliderlabel.text += ', Dist: '+mindist.toFixed(0)+'-'+maxdist.toFixed(0)
|
||||
sliderlabel.text += ', WpS: '+minwork.toFixed(0)+'-'+maxwork.toFixed(0)
|
||||
|
||||
var catchav = 0
|
||||
var finishav = 0
|
||||
var slipav = 0
|
||||
var washav = 0
|
||||
var peakforceangleav = 0
|
||||
var averageforceav = 0
|
||||
var peakforceav = 0
|
||||
var count = 0
|
||||
|
||||
datapoints['peakforceangle'] = []
|
||||
datapoints['peakforce'] = []
|
||||
multilines['x'] = []
|
||||
multilines['y'] = []
|
||||
|
||||
for (var i=0; i<c.length; i++) {
|
||||
if (spm1[i]>=minspm && spm1[i]<=maxspm) {
|
||||
if (distance1[i]>=mindist && distance1[i]<=maxdist) {
|
||||
if (driveenergy1[i]>=minwork && driveenergy1[i]<=maxwork) {
|
||||
if (plottype=='scatter') {
|
||||
datapoints['peakforceangle'].push(peakforceangle[i])
|
||||
datapoints['peakforce'].push(peakforce[i])
|
||||
}
|
||||
if (plottype=='line') {
|
||||
multilines['x'].push(multilinesx[i])
|
||||
multilines['y'].push(multilinesy[i])
|
||||
}
|
||||
catchav += c[i]
|
||||
finishav += finish[i]
|
||||
slipav += slip[i]
|
||||
washav += wash[i]
|
||||
peakforceangleav += peakforceangle[i]
|
||||
averageforceav += averageforce[i]
|
||||
peakforceav += peakforce[i]
|
||||
count += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catchav /= count
|
||||
finishav /= count
|
||||
slipav /= count
|
||||
washav /= count
|
||||
peakforceangleav /= count
|
||||
peakforceav /= count
|
||||
averageforceav /= count
|
||||
|
||||
data['x'] = [catchav,catchav+slipav,peakforceangleav,finishav-washav,finishav]
|
||||
data['y'] = [0,thresholdforce,peakforceav,thresholdforce,0]
|
||||
|
||||
dataslipwash['xslip'] = [catchav+slipav,finishav-washav]
|
||||
dataslipwash['yslip'] = [thresholdforce,thresholdforce]
|
||||
|
||||
var length = finishav-catchav
|
||||
var efflength = length-slipav-washav
|
||||
|
||||
avf.location = averageforceav
|
||||
avflabel.text = 'Favg: '+averageforceav.toFixed(2)
|
||||
catchlabel.text = 'Catch: '+catchav.toFixed(2)
|
||||
finishlabel.text = 'Finish: '+finishav.toFixed(2)
|
||||
sliplabel.text = 'Slip: '+slipav.toFixed(2)
|
||||
washlabel.text = 'Wash: '+washav.toFixed(2)
|
||||
peakflabel.text = 'Fpeak: '+peakforceav.toFixed(2)
|
||||
peakforceanglelabel.text = 'Peak angle: '+peakforceangleav.toFixed(2)
|
||||
annolabel.text = annotation
|
||||
lengthlabel.text = 'Length: '+length.toFixed(2)
|
||||
efflengthlabel.text = 'Effective Length: '+efflength.toFixed(2)
|
||||
|
||||
// console.log(count);
|
||||
// console.log(multilines['x'].length);
|
||||
// console.log(multilines['y'].length);
|
||||
|
||||
// change DOM elements
|
||||
document.getElementById("id_spm_min").value = minspm;
|
||||
document.getElementById("id_spm_max").value = maxspm;
|
||||
document.getElementById("id_dist_min").value = mindist;
|
||||
document.getElementById("id_dist_max").value = maxdist;
|
||||
document.getElementById("id_notes").value = annotation;
|
||||
document.getElementById("id_work_min").value = minwork;
|
||||
document.getElementById("id_work_max").value = maxwork;
|
||||
|
||||
// source.trigger('change');
|
||||
source.change.emit();
|
||||
sourceslipwash.change.emit()
|
||||
sourcepoints.change.emit();
|
||||
sourcemultiline.change.emit();
|
||||
""")
|
||||
|
||||
annotation = TextInput(
|
||||
width=140, title="Type your plot notes here", value="", name="annotation")
|
||||
annotation.js_on_change('value', callback)
|
||||
callback.args["annotation"] = annotation
|
||||
|
||||
slider_spm_min = Slider(width=140, start=15.0, end=55, value=15, step=.1,
|
||||
title="Min SPM", name="min_spm_slider")
|
||||
slider_spm_min.js_on_change('value', callback)
|
||||
callback.args["minspm"] = slider_spm_min
|
||||
|
||||
slider_spm_max = Slider(width=140, start=15.0, end=55, value=55, step=.1,
|
||||
title="Max SPM", name="max_spm_slider")
|
||||
slider_spm_max.js_on_change('value', callback)
|
||||
callback.args["maxspm"] = slider_spm_max
|
||||
|
||||
slider_work_min = Slider(width=140, start=0, end=1500, value=0, step=10,
|
||||
title="Min Work per Stroke", name="min_work_slider")
|
||||
slider_work_min.js_on_change('value', callback)
|
||||
callback.args["minwork"] = slider_work_min
|
||||
|
||||
slider_work_max = Slider(width=140, start=0, end=1500, value=1500, step=10,
|
||||
title="Max Work per Stroke", name="max_work_slider")
|
||||
slider_work_max.js_on_change('value', callback)
|
||||
callback.args["maxwork"] = slider_work_max
|
||||
|
||||
distmax = 100+100*int(rowdata['distance'].max()/100.)
|
||||
|
||||
slider_dist_min = Slider(width=140, start=0, end=distmax, value=0, step=50,
|
||||
title="Min Distance", name="min_dist_slider")
|
||||
slider_dist_min.js_on_change('value', callback)
|
||||
callback.args["mindist"] = slider_dist_min
|
||||
|
||||
if dist_max == 0:
|
||||
dist_max = distmax
|
||||
|
||||
slider_dist_max = Slider(width=140, start=0, end=distmax, value=distmax,
|
||||
step=50,
|
||||
title="Max Distance", name="max_dist_slider")
|
||||
slider_dist_max.js_on_change('value', callback)
|
||||
callback.args["maxdist"] = slider_dist_max
|
||||
|
||||
thesliders = layoutcolumn([annotation,
|
||||
slider_spm_min,
|
||||
slider_spm_max,
|
||||
slider_dist_min,
|
||||
slider_dist_max,
|
||||
slider_work_min,
|
||||
slider_work_max,
|
||||
]
|
||||
)
|
||||
|
||||
mylayout = layoutrow([thesliders, plot])
|
||||
|
||||
#mylayout.sizing_mode = 'stretch_both'
|
||||
|
||||
script, div = components(mylayout)
|
||||
js_resources = INLINE.render_js()
|
||||
css_resources = INLINE.render_css()
|
||||
|
||||
return [script, div, js_resources, css_resources]
|
||||
|
||||
def weightfromrecord(row,metricchoice):
|
||||
vv = row[metricchoice]
|
||||
|
||||
Reference in New Issue
Block a user