Exemplo n.º 1
0
    [[base_properties[i][j]["length"][0] for i in range(0, len(names))]
     for j in range(0, len(times))])

r0, f0 = es.fit_taproot_r(l[0:1, :], [times[0]], fixed_k)
k0 = fixed_k
print("k fixed, first ", r0, "cm/day", k0, "cm; error", f0)

r1, f1 = es.fit_taproot_r(l, times, fixed_k)
k1 = fixed_k
print("k fixed        ", r1, "cm/day", k1, "cm; error", f1)

r2, k2, f2 = es.fit_taproot_rk(l, times)
print("fit r, k       ", r2, "cm/day", k2, "cm; error", f2)
""" length plot """
t_ = np.linspace(0, times[-1], 200)
y0 = es.negexp_length(t_, r0, k0)
y1 = es.negexp_length(t_, r1, k1)
y2 = es.negexp_length(t_, r2, k2)
plt.plot([0.], [0.], "r*")  # we can add that point
for i in range(0, len(names)):
    for j in range(0, len(times)):
        l = base_properties[i][j]["length"]
        plt.plot([times[j] for k in l], l, "k*")
plt.plot(t_, y0, "b", label="first only, k fixed")
plt.plot(t_, y1, "g", label="k fixed")
plt.plot(t_, y2, "r", label="fit r, k")

plt.legend()
plt.title("Faba")

plt.xlabel("Time [days]")
Exemplo n.º 2
0
# plt.ylabel("Root length at measurement time [cm]")
# plt.title("Maize seminals")

""" root age plot """ 
for j in range(0, len(times)):             
    age_flat, l_flat, c_flat = [], [], []
    for i in range(0, len(names)):    
        for k, l_ in enumerate(l[j, i]):   
            age_flat.append(age[j, i][k])
            l_flat.append(l[j, i][k])   
    plt.plot(age_flat, l_flat, col[j])
   
age_flat = [item for sublist in age for sublist2 in sublist for item in sublist2]
l_flat = [item for sublist in l for sublist2 in sublist for item in sublist2]       
r, k, f = es.fit_taproot_rk(l_flat, age_flat)
k1 = 150.
r1, f1 = es.fit_taproot_r(l_flat, age_flat, k1)
print(r, "cm/day", k, "cm") 
print(r1, "cm/day", k1, "cm")        
t_ = np.linspace(0, times[-1], 200)
y0 = es.negexp_length(t_, r, k)
y1 = es.negexp_length(t_, r1, k1)
plt.plot(t_, y0, "k")            
plt.plot(t_, y1, "k:")            
plt.xlabel("root age [day]")    
plt.ylabel("root length [cm]")

plt.show()  
print("fin.")