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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ target/

# sphinx autogen file
doc/_dvlpt/
doc/_build/


# #}
Expand Down
265 changes: 163 additions & 102 deletions example/RSML_Readme_tutorial.ipynb

Large diffs are not rendered by default.

111 changes: 111 additions & 0 deletions example/RSML_Readme_tutorial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#!/usr/bin/env python
# coding: utf-8

# # RSML Tutorial in Python

# First, we activate matplotlib and qt in the Notebook

# In[2]:


# get_ipython().run_line_magic('matplotlib', 'inline')
# get_ipython().run_line_magic('gui', 'qt')
#
#
# # In[3]:
#
#
# import sys; print('Python %s on %s' % (sys.version, sys.platform))
# sys.path.extend(['../src'])


# Then, we import main modules and function to work with RSML format in Python

# In[4]:


import os
from pprint import pprint
from openalea.core.path import path
import openalea.rsml as rsml
from openalea.rsml.plot import multiple_plot
from openalea.rsml.data import data_dir


# In[5]:


arabido = data_dir/'AR570'
_generator = arabido.glob('*.rsml')
files = []
for f in _generator:
files.append(os.path.normpath(f))
pprint(files)


# # In[6]:
#
#
# multiple_plot(files, image=False)
#
#
# # In[7]:
#
#
# multiple_plot(files, image=True)
#
#
# # In[8]:
#
#
# get_ipython().run_line_magic('run', 'demo_plot_rsml.py')
#
#
# # In[9]:
#
#
g = rsml.rsml2mtg('data/lupin_aero.rsml')
from hydroroot.hydro_io import import_rsml_to_discrete_mtg
g=import_rsml_to_discrete_mtg(g)

#
#
# # In[10]:
#
#
# from openalea.rsml.plot import plot2d, plot3d
# plot2d(g) # requires matplotlib
# plot3d(g) # requires openalea.plantgl


# In[11]:


# export mesurements to tabular file
from openalea.rsml.measurements import RSML_Measurements
results = RSML_Measurements()
results.add(g)
RSML_Measurements.export_csv(g, 'results.csv')


# In[12]:


labels = g.property('label')
print(labels)
for rsml_file in files:
g = rsml.rsml2mtg(rsml_file)
print(g)

for v in g.vertices(scale=2):
labels[v]='Axis'
g.properties()['label']=labels

g.display(display_id=True, display_scale=True)


# In[ ]:




178 changes: 118 additions & 60 deletions example/RSML_tutorial_in_Python.ipynb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions example/demo_plot_rsml.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import rsml
from rsml import misc
from rsml import measurements
from rsml.data import data_dir as rsml_dir
import openalea.rsml as rsml
from openalea.rsml import misc
from openalea.rsml import measurements
from openalea.rsml.data import data_dir as rsml_dir

import numpy as np
from matplotlib import pyplot as plt
Expand Down
2 changes: 1 addition & 1 deletion example/testing_rsml.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import numpy as np
import rsml
from rsml.continuous import *
from openalea.rsml.continuous import *
from openalea.mtg import MTG, traversal


Expand Down
2 changes: 1 addition & 1 deletion src/openalea/rsml/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def multiple_plot(files, image=True):
'''
from openalea.core.path import path
from matplotlib import pyplot as plt
import openalea.rsml
import openalea.rsml as rsml
import os

def get_file(f):
Expand Down
Loading