Skip to content
Snippets Groups Projects
Commit 40b16745 authored by Andreas Weissenbrunner's avatar Andreas Weissenbrunner
Browse files

version with k-factor and scaled meter plot

parent c2e29a78
No related branches found
No related tags found
No related merge requests found
......@@ -453,7 +453,7 @@ class Elbow_profile():
def make_kfac_fully(self,flowmeter = None,ret = False):
rfine = np.linspace(0,1,int(1e6))
ufine = self.fully_class.get_u_u_vol(rfine)
self.up_fully = np.trapz(rfine,ufine)
self.up_fully = np.trapz(ufine,rfine)
self.k_fully = 1/self.up_fully
if ret:
return self.up_fully,self.k_fully
......
......@@ -332,7 +332,7 @@ class mainPanel(wx.Panel):
self.xax_dropdown.SetSelection(0)
self.xax_dropdown.Bind(wx.EVT_CHOICE, self.Onxax_dropdown)
# y-axis choices
self.yax_dropdown = wx.Choice(self,choices=["error in %","k","k_dis","k_st"])
self.yax_dropdown = wx.Choice(self,choices=["error in %","k","k_d"])
self.yax_dropdown.SetSelection(0)
self.yax_dropdown.Bind(wx.EVT_CHOICE, self.Onyax_dropdown)
# add the axes choices and labels to a hbox
......@@ -710,25 +710,59 @@ class mainPanel(wx.Panel):
x = 0
y = 0
xlabel = ""
y *= 100
plot_what = self.yax_dropdown.GetSelection()
spreadfac = 1
ylimiter = 0.02
if plot_what == 0:
y *= flow.k_fully*100
y_u *= 100
spreadfac = 100
ylabel = "Error in %"
elif plot_what == 1: # this is k-factor
y = 1/(y + flow.up_fully)
ylabel = "Callibration factor k_p"
elif plot_what == 2: # this is k_st-factor
y = flow.up_fully / (y + flow.up_fully)
ylabel = "Correction factor k_d"
else:
print("no axes selected")
x = 0
y = 0
ylabel = ""
ylimiter *= spreadfac
self.ax_meter.cla()
#
self.ax_meter.set_xlabel(xlabel)
self.ax_meter.set_ylabel("Error in %")
self.ax_meter.set_ylabel(ylabel)
self.ax_meter.plot(x,y,'-')
ymin = self.ax_meter.get_ylim()[0]
ymax = self.ax_meter.get_ylim()[1]
ydiff = ymax-ymin
print(ydiff)
if ydiff < ylimiter:
ymin = self.ax_meter.get_ylim()[0]-(ylimiter-ydiff)/2
ymax = self.ax_meter.get_ylim()[1]+(ylimiter-ydiff)/2
# print("min")
# print(ymin)
# print("max")
# print(ymax)
self.ax_meter.set_ylim(ymin,ymax)
#
# the line-plot of the selected parameter within the x axes
self.ax_meter.plot([x_selected,x_selected],[ymin,ymax],'r-',linewidth=1)
if y_u.any():
self.ax_meter.fill_between(x, y - y_u, y + y_u,
facecolor='green',
alpha = 0.3,
interpolate=True, label="std")
self.ax_meter.text(x_selected, self.ax_meter.get_ylim()[0], " " + str(np.round(np.interp(x_selected,x, y),2)) + " | " + str(np.round(np.interp(x_selected,x, y_u),2)), fontsize=14,color='r')
self.ax_meter.text(x_selected, ymin, " " + str(np.round(np.interp(x_selected,x, y),2)) + " | " + str(np.round(np.interp(x_selected,x, y_u),2)), fontsize=14,color='r')
else:
self.ax_meter.text(x_selected, min(y), " " + str(np.round(np.interp(x_selected,x, y),2)), fontsize=14,color='r')
#
# the line-plot of the selected parameter within the x axes
self.ax_meter.plot([x_selected,x_selected],self.ax_meter.get_ylim(),'r-',linewidth=1)
self.ax_meter.text(x_selected, ymin, " " + str(np.round(np.interp(x_selected,x, y),2)), fontsize=14,color='r')
self.ax_meter.grid("on")
self.fig_meter.tight_layout()
self.canvas_meter.draw()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment