Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test:
- test/data/**
commands:
- cd test
- pytest -v --ignore=test_povray.py --ignore=test_dataflow.py --ignore=test_plantgen.py
- pytest -v --ignore=test_povray.py --ignore=test_dataflow.py

about:
home: {{ home }}
Expand Down
2 changes: 1 addition & 1 deletion src/openalea/adel/AdelR.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def _devCsv(axeTfn, dimTfn, phenTfn, earTfn=None, ssi2senTfn=None):
def devCsv(axeTfn, dimTfn, phenTfn, earTfn=None, ssi2senTfn=None):
"""Import development parameters for adel from csv files and/or pandas dataframes"""
return RdflistAsdicts(
_devCsv(axeTfn, dimTfn, phenTfn, earTfn=None, ssi2senTfn=None)
_devCsv(axeTfn, dimTfn, phenTfn, earTfn=earTfn, ssi2senTfn=ssi2senTfn)
)


Expand Down
55 changes: 32 additions & 23 deletions src/openalea/adel/plantgen/plantgen_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,15 @@ def organs_dimensions(
force=False,
)
)
dimT_tmp = _create_dimT_tmp(axeT_tmp, force=False)

dimT_tmp = _create_dimT_tmp(axeT_)

# 3. merge dimT_tmp and dimT_user
dimT_tmp_merged = _merge_dimT_tmp_and_dimT_user(
dynT_, dimT_user, dimT_user_completeness, dimT_tmp
)
# 2. create dimT
dimT_ = _create_dimT(axeT_, dimT_tmp, dynT_, decimal_elongated_internode_number)
dimT_ = _create_dimT(axeT_, dimT_tmp_merged, dynT_, decimal_elongated_internode_number)

return dimT_

Expand Down Expand Up @@ -830,12 +835,21 @@ def _gen_id_dim_list(id_cohort_series, N_phytomer_series, id_ear_series):
"""Generate the *id_dim* column."""
is_ear = pd.Series(0, index=id_ear_series.index)
is_ear[id_ear_series.dropna().index] = 1
zfilled_array = np.core.defchararray.zfill(np.char.mod("%d", N_phytomer_series), 2)

zfilled_array = np.char.zfill(
np.char.mod("%d", N_phytomer_series), 2
)

id_cohort_str_array = np.char.mod("%d", id_cohort_series)
id_dim_array = np.core.defchararray.add(id_cohort_str_array, zfilled_array)
id_dim_array = np.core.defchararray.add(

id_dim_array = np.char.add(
id_cohort_str_array, zfilled_array
)

id_dim_array = np.char.add(
id_dim_array, np.char.mod("%d", is_ear)
).astype(int)

return id_dim_array.tolist()


Expand Down Expand Up @@ -2769,7 +2783,7 @@ def __call__(self, axeT_, dynT_, decimal_elongated_internode_number, force=True)
for (id_cohort, N_phytomer_potential, id_phen), axeT_group in axeT_.groupby(
["id_cohort", "N_phytomer_potential", "id_phen"]
):
phenT_tmp_group = phenT_tmp_grouped.get_group(id_phen)
phenT_tmp_group = phenT_tmp_grouped.get_group(id_phen).copy()
dynT_group = dynT_grouped.get_group((id_cohort, N_phytomer_potential))
dynT_row = dynT_group.loc[
dynT_group[
Expand Down Expand Up @@ -2867,9 +2881,7 @@ def __call__(self, axeT_, dynT_, decimal_elongated_internode_number, force=True)
# ) # TODO: useful ?

# compute TT_col_phytomer
self.phenT_tmp.loc[
phenT_tmp_group.index, "TT_col_phytomer"
] = phenT_tmp_group.loc[:, "TT_col_phytomer"].values[:] = (
phenT_tmp_group["TT_col_phytomer"] = (
phenT_tmp_group["index_phytomer"].apply(
_calculate_TT_col_phytomer,
args=(
Expand All @@ -2890,11 +2902,8 @@ def __call__(self, axeT_, dynT_, decimal_elongated_internode_number, force=True)

# compute TT_em_phytomer
first_leaf_indexes = phenT_tmp_group.index[0:2]
self.phenT_tmp.loc[
first_leaf_indexes, "TT_em_phytomer"
] = phenT_tmp_group.loc[first_leaf_indexes, "TT_em_phytomer"].values[
:
] = phenT_tmp_group.loc[
phenT_tmp_group.loc[first_leaf_indexes, "TT_em_phytomer"] = \
phenT_tmp_group.loc[
first_leaf_indexes, ["index_phytomer", "TT_col_phytomer"]
].apply(
_calculate_TT_em_phytomer,
Expand All @@ -2920,11 +2929,9 @@ def __call__(self, axeT_, dynT_, decimal_elongated_internode_number, force=True)
phenT_tmp_group.index - phenT_tmp_group.index[0:2]
)
if len(other_leaves_indexes) != 0:
self.phenT_tmp.loc[
phenT_tmp_group.loc[
other_leaves_indexes, "TT_em_phytomer"
] = phenT_tmp_group.loc[
other_leaves_indexes, "TT_em_phytomer"
].values[:] = phenT_tmp_group.loc[
other_leaves_indexes, ["index_phytomer", "TT_col_phytomer"]
].apply(
_calculate_TT_em_phytomer,
Expand Down Expand Up @@ -2962,9 +2969,7 @@ def __call__(self, axeT_, dynT_, decimal_elongated_internode_number, force=True)
a_cohort_before_start_MS_elongation_2,
)

self.phenT_tmp.loc[
phenT_tmp_group.index, "TT_sen_phytomer"
] = phenT_tmp_group.loc[:, "TT_sen_phytomer"].values[:] = (
phenT_tmp_group["TT_sen_phytomer"] = (
phenT_tmp_group["index_phytomer"].apply(
_calculate_TT_sen_phytomer,
args=(
Expand All @@ -2984,14 +2989,18 @@ def __call__(self, axeT_, dynT_, decimal_elongated_internode_number, force=True)
)

# compute TT_del_phytomer
self.phenT_tmp.loc[
phenT_tmp_group.index, "TT_del_phytomer"
] = phenT_tmp_group.loc[:, "TT_del_phytomer"].values[:] = (
phenT_tmp_group["TT_del_phytomer"] = (
_calculate_TT_del_phytomer(
a_cohort_before_start_MS_elongation_1,
phenT_tmp_group["TT_sen_phytomer"],
)
)

# update phenT
self.phenT_tmp.loc[
phenT_tmp_group.index,
phenT_tmp_group.columns
] = phenT_tmp_group
return self.phenT_tmp


Expand Down
2 changes: 1 addition & 1 deletion src/openalea/adel/plantgen/plantgen_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def gen_adel_input_data(
)
)

if sum(MS_leaves_number_probabilities.values()) != 1.0:
if not np.isclose(sum(MS_leaves_number_probabilities.values()), 1.0):
raise tools.InputError(
"the sum of the probabilities defined in MS_leaves_number_probabilities is not equal to 1.0"
)
Expand Down
6 changes: 3 additions & 3 deletions src/openalea/adel/plantgen_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ def fit_a(self, HS_since_flag, GL):
return a, rmse

def hs_t1(self, nff=None):
return self.hsfit.HSflag(nff) - self.n_elongated_internode
return float(self.hsfit.HSflag(nff)) - self.n_elongated_internode

def dn_nff(self, nff=None):
return 0.5 * (self.hs_t2(nff) - self.hs_t2())
Expand All @@ -647,7 +647,7 @@ def n1(self, nff=None):
return self.GL_bolting + self.dn_nff(nff)

def hs_t2(self, nff=None):
return self.hsfit.HSflag(nff)
return float(self.hsfit.HSflag(nff))

def n2(self, nff=None):
return self.GL_flag + self.dn_nff(nff)
Expand Down Expand Up @@ -1116,7 +1116,7 @@ def _dfc(x, y):
for c in cardnff.loc[int(nff)].index:
d[int(c)] = cardinalities(
cohort_nff_modalities[int(nff)][int(c)],
int(cardnff.loc[int(nff), c]),
int(cardnff.loc[int(nff), c].values),
)
cohort_nff_cardinalities[int(nff)] = d
cohort_nff = {
Expand Down
Loading
Loading