CoCalc Public FilesLA Sandbox / Tim's Worksheets / EEB162Disc2.sagews
Author: Timothy Hamilton
Views : 61
Compute Environment: Ubuntu 18.04 (Deprecated)
%auto
%hide
@interact
def RelWater_vs_Water_potential(e=slider(0,30, label = "$\epsilon$", default=20.8172917514604),m1= slider(0,5, label = "$\epsilon$-multiplier",default = 1),a=slider(5,100, default = 40, label = "$a_f$"), m2 = slider(0,5,label = "$a_f$-multiplier", default = 1),o=slider(-10,0, label = "$\pi_o$", default = -1.66335814974638), m3= slider(0,5,default = 1, label ="$\pi_o$-multiplier" )):
elas= e*m1
apoint =a*m2
osmot = o*m3
loss_turgor= osmot*elas/(elas + (osmot/(1-apoint/100.0)))
rwc_loss_turgor= 100.0*(1+osmot/elas)
rel_water_content = srange(1,0.73,-0.01)
percent_rel_water_content= [100*i for i in rel_water_content]
inverse_watercontent=[100-i for i in percent_rel_water_content]
pressure_pot= [0 if i< (rwc_loss_turgor)/100.0 else -1*osmot - elas*(1-i) for i in rel_water_content]
solute_pot = [-1/((-1/osmot)-((-1/osmot)/(100-apoint))*i) for i in inverse_watercontent]
leaf_pot = [a+b for a,b in zip(pressure_pot,solute_pot)]
inverse_solute = [-1/i for i in solute_pot]
inverse_leaf = [-1/i for i in leaf_pot[1:]]
RWC_Potentialcurve=list_plot(zip(inverse_watercontent,pressure_pot), axes_labels = ["$100-RWC$","$\psi$" ], plotjoined = true, color = "blue", legend_label = "$\psi_p$", thickness = 2.5 )+list_plot(zip(inverse_watercontent,solute_pot), axes_labels = ["$100-RWC$","$\psi$" ], plotjoined = true, color = "red", legend_label = "$\psi_s$", thickness = 2.5)+list_plot(zip(inverse_watercontent,leaf_pot), axes_labels = ["$100-RWC$","$\psi$" ], plotjoined = true, color = "green", legend_label = "$\psi_{leaf}$", thickness = 2.5 )
Inverted_curve = list_plot(zip(inverse_watercontent, inverse_solute), plotjoined = true, color = "red",legend_label = "$-1/\psi_s$", axes_labels = ["$100-RWC$", "$-1/\psi$"], thickness = 2.5)+list_plot(zip(inverse_watercontent[1:], inverse_leaf), plotjoined = true, color = "green",legend_label = "$-1/\psi_{leaf}$", axes_labels = ["$100-RWC$", "$-1/\psi$"], thickness = 2.5)
show(RWC_Potentialcurve, xmin = 0, xmax = 15)
print "Turgor Loss Point: "+ str(loss_turgor)
print "%Relative Water Content at TLP:" + str(rwc_loss_turgor)