コード例 #1
0
ファイル: faba_taproot.py プロジェクト: mvdcvp/CPlantBox
functions = [[[] for t in times] for i in range(0, len(names))]
for i in range(0, len(names)):
    print(names[i])
    j = len(times) - 1
    p, properties[i][j], functions[i][j] = rsml.read_rsml(
        "RSML/" + names[i])  # read file to final time step
    print(properties[i][j].keys())
    print(functions[i][j].keys())
    p = [[
        np.array([p[i][j][k] / 10 for k in range(0, 3)])
        for j in range(0, len(p[i]))
    ] for i in range(0, len(p))]  # mm -> cm
    polylines[i][j] = p
    for k in range(0, j):  # truncate the others
        polylines[i][k], properties[i][k], functions[i][
            k] = es.measurement_time(polylines[i][j], properties[i][j],
                                     functions[i][j], times[k])
# polylines[i][j] contains i-th plant, j-th measurement time
""" find all base roots """
base_polylines = [[[] for t in times] for i in range(0, len(names))]
base_properties = [[[] for t in times] for i in range(0, len(names))]
for i in range(0, len(names)):
    for j in range(0, len(times)):
        base_polylines[i][j], base_properties[i][j] = es.base_roots(
            polylines[i][j], properties[i][j])

# for Faba this is exactly 1 for all 5 measurements
""" recalculate length (should not alter anything)"""
for i in range(0, len(names)):
    for j in range(0, len(times)):
        es.create_length(base_polylines[i][j], base_properties[i][j])
""" fit data """
コード例 #2
0
for i, p in enumerate(polylines):
    pi.append(es.find_base_index(pp, i))
    pet.append(fet[i][0])
    if pp[i] == -1:
        baseindices.append(i)
        basepolys.append(p)
        basetypes.append(pt[i])  # have type = 0, but there are more

nppt = np.array(pt)
print(len(basepolys), "base roots found, ", np.sum(nppt == 1.),
      " type 1 roots fouond")  # ? genau doppelt soviel, zufall?

# print(baseindices)
# print(pi)  # already sorted by base root
print(pet)
polylines0, properties0 = es.measurement_time(polylines, properties, functions,
                                              times[0])
polylines1, properties1 = es.measurement_time(polylines, properties, functions,
                                              times[1])
polylines2, properties2 = es.measurement_time(polylines, properties, functions,
                                              times[2])
visprop = "type"
pt0 = properties0[visprop]
pt1 = properties1[visprop]
pt2 = properties2[visprop]
rsml.plot_multiple_rsml([polylines0, polylines1, polylines2], [pt0, pt1, pt2],
                        times)  # looks good

# rsml.plot_rsml(basepolys, basetypes)  # looks all right
print("fin.")