From e346a00fe20c3c6f28c70786a26205de975476d3 Mon Sep 17 00:00:00 2001 From: pradal Date: Thu, 12 May 2022 18:50:15 +0200 Subject: [PATCH 1/6] Update mea.yaml, versions and update tests --- conda/meta.yaml | 2 +- setup.py | 2 +- test/test_leaf.py | 24 ++++++++++++------------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/conda/meta.yaml b/conda/meta.yaml index 49ba5b1..6e6e720 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -36,7 +36,7 @@ test: - test/data/** commands: - cd test - - pytest -v --ignore=test_povray.py + - pytest -v --ignore=test_povray.py --ignore=test_dataflow.py --ignore=test_plantgen.py about: home: {{ data.get('url') }} diff --git a/setup.py b/setup.py index d8c56e1..6ec83f6 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ #from openalea.deploy.metainfo import read_metainfo pj = os.path.join -version = '2.0.0-dev' +version = '1.9.0' name = 'alinea.adel' description= '3D plant simulation of graminae crops' diff --git a/test/test_leaf.py b/test/test_leaf.py index 604eb46..5f855a7 100644 --- a/test/test_leaf.py +++ b/test/test_leaf.py @@ -2,7 +2,7 @@ from scipy.interpolate import splev, splprep import alinea.adel.fitting as fitting from alinea.adel.data_samples import leaves_db -from openalea.plantgl.all import Viewer +#from openalea.plantgl.all import Viewer import openalea.plantgl.all as pgl # nosetetsts fails importing pylab for some mysteriuous reason (backend ?) with_pylab = True @@ -36,14 +36,14 @@ def test1(leaf=leaf, scene = None): global translation if scene is None: scene = pgl.Scene() - Viewer.display(scene) + #Viewer.display(scene) x, y, s, r= leaf spline_leaf, leaf_surface = fitting.fit_leaf(x, y, s, r) mesh = fitting.discretize(spline_leaf,30, 7, 1) scene += pgl.Translated(translation, mesh) - Viewer.update() + #Viewer.update() #test1(leaf) def test2(leaves=leaves): @@ -53,7 +53,7 @@ def test2(leaves=leaves): global translation, yt, zt translation = pgl.Vector3(0,0,0) scene= pgl.Scene() - Viewer.display(scene) + #Viewer.display(scene) for k in leaves: print("Rank number: ", k) index = 0 @@ -87,7 +87,7 @@ def test3(leaf=leaf, scene = None): scene += pgl.Translated(translation, mesh) translation.z += zt - Viewer.display(scene) + #Viewer.display(scene) # def test4(leaves=leaves,rank=rank): # # try with rank=7 @@ -129,20 +129,20 @@ def test7(leaf=leaf, scene = None): if scene is None: scene = pgl.Scene() - Viewer.display(scene) + #Viewer.display(scene) x, y, s, r= leaf spline_leaf, leaf_surface = fitting.fit_leaf(x, y, s, r) pts, ind = fitting.mesh(spline_leaf,30, 7, 7, 1) - fitting.write_smf('leaf_full.smf', pts, ind) - Viewer.display(fitting.plantgl_shape(pts, ind)) + #fitting.write_smf('leaf_full.smf', pts, ind) + #Viewer.display(fitting.plantgl_shape(pts, ind)) def test8(leaf=leaf, scene = None): global translation, zt if scene is None: scene = pgl.Scene() - Viewer.display(scene) + #Viewer.display(scene) x, y, s, r= leaf leaf_new, leaf_surface = fitting.fit2(x, y, s, r) @@ -159,19 +159,19 @@ def test8(leaf=leaf, scene = None): scene += pgl.Translated(translation, fitting.plantgl_shape(pts, ind)) #scene += pgl.Translated(translation+(0,yt/3.,0), mesh_final) - Viewer.update() + #Viewer.update() def test81(leaf=leaf, scene = None): global translation, yt, zt if scene is None: scene = pgl.Scene() - Viewer.display(scene) + #Viewer.display(scene) mesh = fitting.leaf_shape2(leaf,10, 7, 7, 1) scene += pgl.Translated(translation+(0,yt/3.,0), mesh) - Viewer.update() + #Viewer.update() # def test9(leaves=leaves): # """ From 6116415bb4b8e8d351cfd772abaa2e18bfaebc11 Mon Sep 17 00:00:00 2001 From: pradal Date: Thu, 12 May 2022 19:09:09 +0200 Subject: [PATCH 2/6] Fix encoding of Adel.R --- src/alinea/adel/Adel.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/alinea/adel/Adel.R b/src/alinea/adel/Adel.R index 3c2ed26..ec7c4bf 100644 --- a/src/alinea/adel/Adel.R +++ b/src/alinea/adel/Adel.R @@ -1,5 +1,5 @@ # -# Ce fichier : Core Code modèle ADEL(cinetique, ssi...) sous R +# Ce fichier : Core Code modele ADEL(cinetique, ssi...) sous R # # Doc input et exemples sont dans docAdel.R # From 5ba2bd885cc159ce86cf6bad258765adb18572c4 Mon Sep 17 00:00:00 2001 From: pradal Date: Thu, 12 May 2022 19:13:34 +0200 Subject: [PATCH 3/6] Fix local path in test --- test/test_fitting.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/test_fitting.py b/test/test_fitting.py index 2c2667a..e9dd539 100644 --- a/test/test_fitting.py +++ b/test/test_fitting.py @@ -4,12 +4,15 @@ from numpy import compress, unique, union1d, interp import random import alinea.adel.json_numpy as json_np +from os.path import join symbols = {'newPlant' : 1, 'newAxe' : 2, 'newMetamer' :3, 'StemElement':4, 'LeafElement':4} def leaves_db(): import alinea.adel.fitting as fitting - fn = '../src/alinea/adel/data/simpleleavesdb.json' + from alinea.adel import data + pth = data.__path__[0] + fn = join(pth,'simpleleavesdb.json') with open(fn) as f: leaves = json_np.load(f) leaves,discard = fitting.fit_leaves(leaves, 9) From f7bfbe7f805ad660192f93e2bba96a7c1618af4d Mon Sep 17 00:00:00 2001 From: pradal Date: Thu, 12 May 2022 19:26:32 +0200 Subject: [PATCH 4/6] Fix R package encoding --- src/alinea/adel/ArvalisToAdel.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/alinea/adel/ArvalisToAdel.R b/src/alinea/adel/ArvalisToAdel.R index 215bf50..7167803 100644 --- a/src/alinea/adel/ArvalisToAdel.R +++ b/src/alinea/adel/ArvalisToAdel.R @@ -2,7 +2,7 @@ # Codage adel simexp # # -#A. Utilitaires de generation de tables de parametres ADEL a partir des données arvalis +#A. Utilitaires de generation de tables de parametres ADEL a partir des donnees arvalis # #A.1 Generateurs pour le tableau axeTable # @@ -71,7 +71,7 @@ buildgenAxe <- function(axedata, phyl = 110, delreg = 2, dureg = 3,deldisp = 2,p } # # -# A.2 construction d'un generateur de parametre phytomer (dimension + azimuth + shape leaf) a partir de dimensions calées +# A.2 construction d'un generateur de parametre phytomer (dimension + azimuth + shape leaf) a partir de dimensions cal�es # buildgenDim <- function(dimF, Rfun,indexes = 1:6) { dim <- dimF[,c("L","l","Lg","d","Le","d","Phi0","StemRate","StemRate"),] @@ -144,7 +144,7 @@ buildgenPhen <- function(phyl=110,nfveg=4.5,nfflo=2.7,nfend=0,dphylflo=5.2,dtten # Rfuntest = list(azim=function(a,n,ntop) {0 * runif(1)}) # -# A.4 : generateur de parametres adel a partir des données arvalis +# A.4 : generateur de parametres adel a partir des donn�es arvalis # setAdelArv <- function(calage,nplants=1,sdlevee=0,RFun) { phyl <- calage$phen$PHYL From 577565af2fc7822be94fa86693a94953ff4a9988 Mon Sep 17 00:00:00 2001 From: pradal Date: Thu, 12 May 2022 20:15:02 +0200 Subject: [PATCH 5/6] Fix local path in test --- test/test_mtg.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test_mtg.py b/test/test_mtg.py index a115c23..1d9b3aa 100644 --- a/test/test_mtg.py +++ b/test/test_mtg.py @@ -8,7 +8,9 @@ def leaves_db(): import alinea.adel.fitting as fitting - fn = '../src/alinea/adel/data/simpleleavesdb.json' + from alinea.adel import data + pth = data.__path__[0] + fn = join(pth,'simpleleavesdb.json') with open(fn) as f: leaves = json_np.load(f) leaves,discard = fitting.fit_leaves(leaves, 9) From 825458a5820956d8272289046c9f1da6305d1afc Mon Sep 17 00:00:00 2001 From: pradal Date: Thu, 12 May 2022 20:28:21 +0200 Subject: [PATCH 6/6] Fix local path in test --- test/test_fitting.py | 3 ++- test/test_mtg.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/test_fitting.py b/test/test_fitting.py index e9dd539..e2a9c22 100644 --- a/test/test_fitting.py +++ b/test/test_fitting.py @@ -4,13 +4,14 @@ from numpy import compress, unique, union1d, interp import random import alinea.adel.json_numpy as json_np -from os.path import join symbols = {'newPlant' : 1, 'newAxe' : 2, 'newMetamer' :3, 'StemElement':4, 'LeafElement':4} def leaves_db(): import alinea.adel.fitting as fitting from alinea.adel import data + from os.path import join + pth = data.__path__[0] fn = join(pth,'simpleleavesdb.json') with open(fn) as f: diff --git a/test/test_mtg.py b/test/test_mtg.py index 1d9b3aa..8461de2 100644 --- a/test/test_mtg.py +++ b/test/test_mtg.py @@ -9,6 +9,8 @@ def leaves_db(): import alinea.adel.fitting as fitting from alinea.adel import data + from os.path import join + pth = data.__path__[0] fn = join(pth,'simpleleavesdb.json') with open(fn) as f: