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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The **rsml** python package provides:

The **rsml** package is an openalea package that can be installed using conda or mamba:

mamba create -n rsml -c conda-forge -c openalea3 rsml
mamba create -n rsml -c conda-forge -c openalea3 openalea.rsml
mamba activate rsml


Expand All @@ -40,7 +40,7 @@ To install it, go to the rsml folder and enter the following command::
### Use

```python
import rsml
import openalea.rsml as rsml

# load rsml
g = rsml.rsml2mtg( filename )
Expand All @@ -53,7 +53,7 @@ To install it, go to the rsml folder and enter the following command::
rsml.mtg2rsml(g, filename)

# export mesurements to tabular file
from rsml import measurements
from openalea.rsml import measurements
measurements.export(g, filename[:-5]+'.csv')
```

Expand Down
8 changes: 3 additions & 5 deletions conda/environment.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: rsml_dev
channels:
- conda-forge
- openalea3/label/dev
- openalea3/label/rc
- openalea3
- conda-forge
dependencies:
- matplotlib-base
- pandas
- xlsxwriter
- path
- numpy
- openalea.mtg
# let pip install the rest using pyproject.toml (if you are okay with conda/pip mix)
- pip:
Expand Down
3 changes: 1 addition & 2 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ build:
noarch: python
number: 0
preserve_egg_dir: True
string: py{{ PY_VER }}
script:
- {{ PYTHON }} -m pip install . --no-deps --ignore-installed --no-build-isolation -vv

Expand All @@ -45,7 +44,7 @@ test:
{% endfor %}

imports:
- rsml
- openalea.rsml

source_files:
- test/**
Expand Down
67 changes: 36 additions & 31 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@

import pydata_sphinx_theme # Pydata theme: https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html

from importlib.metadata import metadata
project='rsml'
meta = metadata('openalea.' + project)
release = meta.get("version")
# for example take major/minor
version = ".".join(release.split('.')[:3])
# author = meta['Author-email'].split(' <')[0]
desc = meta['Summary']
urls = {k:v for k,v in [item.split(',') for item in meta.get_all('Project-URL')]}
author = u'Christophe Pradal'

# Get the project root dir, which is the parent dir of this
cwd = os.getcwd()
project_root = os.path.dirname(cwd)

# Insert the project root dir as the first element in the PYTHONPATH.
# This lets us ensure that the source package is imported, and that its
# version is used.
sys.path.insert(0, os.path.join(project_root, 'src'))
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..')) # to include the root of the package

# -- General configuration ------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
Expand All @@ -30,13 +37,14 @@
'sphinx.ext.todo', # support for todo items
'sphinx.ext.napoleon', # support for numpy and google style docstrings
"sphinx_favicon", # support for favicon
"sphinx_copybutton", # support for copybutton in code blocks
"nbsphinx", # for integrating jupyter notebooks
"myst_parser" # for parsing .md files
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
autosummary_generate = True
exclude_patterns = ['_build', '_templates']
exclude_patterns = ['build', '_build', '_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
source_suffix = {
Expand All @@ -46,22 +54,7 @@
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'rsml'
copyright = u'Cecill-C INRAE / INRIA / CIRAD'
author = u'Christophe Pradal'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
pkgver={}
with open("../src/rsml/version.py") as fp:
exec(fp.read(), pkgver)
# The short X.Y version.
version = str(pkgver["MAJOR"])+'.'+str(pkgver["MINOR"])
# The full version, including alpha/beta/rc tags.
release = pkgver["__version__"]

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
Expand All @@ -81,15 +74,17 @@
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
"show_nav_level": 4,
"header_links_before_dropdown": 6,
"sidebarwidth": 200,
"show_nav_level": 2,
"sticky_navigation": "false",
"collapse_navigation": "false",
"display_version": "true",
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/openalea/openalea.rtfd.io",
"url": "https://github.com/openalea/rsml",
"icon": "fa-brands fa-github",
},
],
Expand All @@ -100,6 +95,7 @@
"**/*": ["page-toc", "edit-this-page", "sourcelink"],
"examples/no-sidebar": [],
},
"use_edit_page_button": True,
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand All @@ -120,21 +116,30 @@
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
html_show_copyright = True
# Output file base name for HTML help builder.
htmlhelp_basename = 'rsml_documentation'
htmlhelp_basename = project + '_documentation'

# Add infomation about github repository
html_context = {
# "github_url": "https://github.com", # or your GitHub Enterprise site
"github_user": "openalea",
"github_repo": "rsml",
"github_version": "main",
"doc_path": "doc",
}

# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
}
latex_documents = [
(master_doc, 'rsml.tex', u'rsml Documentation',
u'INRAE / inria / CIRAD', 'manual'),
u'INRA / inria / CIRAD', 'manual'),
]

# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'rsml', u'rsml Documentation',
(master_doc, project, project + ' Documentation',
[author], 1)
]

Expand All @@ -143,9 +148,9 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'rsml', u'rsml Documentation',
author, 'rsml', 'RootSystemML (RSML) is a file format to represent root architectural data.',
(master_doc, project, project + ' Documentation',
author, project, desc,
'Miscellaneous'),
]
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'python': ('https://docs.python.org/', None)}
intersphinx_mapping = {'python': ('https://docs.python.org/', None)}
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ version_scheme = "guess-next-dev"
local_scheme = "no-local-version"

[project]
name = "rsml"
name = "openalea.rsml"
dynamic = ["version"]
description = "RootSystemML (RSML) is a file format to represent root architectural data. This package is an openalea pckage to manage it, import/export between .rsml files and MTG, etc."
readme = "README.md"
Expand Down Expand Up @@ -47,7 +47,7 @@ Homepage = "http://github.com/openalea/rsml"
Discussions = "https://github.com/openalea/rsml/discussions"

[project.entry-points."wralea"]
mtg = "rsml_wralea"
"rsml" = "openalea.rsml_wralea"

[project.optional-dependencies]
test = [
Expand All @@ -58,7 +58,7 @@ doc = [
"sphinx-rtd-theme",
"pydata-sphinx-theme",
"myst-parser",
"sphinx-favicon",
"sphinx-copybutton",
"nbsphinx",
]

Expand Down
2 changes: 2 additions & 0 deletions src/openalea/rsml/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from openalea.rsml.io import rsml2mtg, mtg2rsml
from openalea.rsml.plot import plot2d, plot3d
2 changes: 1 addition & 1 deletion src/rsml/continuous.py → src/openalea/rsml/continuous.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def discrete_to_continuous(g, position='position'):
- convert "discrete" functions (such as diameter)
- convert continuous functions?
"""
from rsml.metadata import add_property_definition
from openalea.rsml.metadata import add_property_definition

# accessor of the segment position property
if isinstance(position, str):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/rsml/hirros.py → src/openalea/rsml/hirros.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
import pandas as pd

import rsml
import openalea.rsml


def walk(dir: str, recursive=True):
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/rsml/matching.py → src/openalea/rsml/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as _np

from rsml.misc import plant_vertices
from openalea.rsml.misc import plant_vertices

def match_plants(t1,t2, max_distance=None):
"""
Expand Down Expand Up @@ -114,7 +114,7 @@ def find_match(axes1, axes2):

def _match_root_axes(t1, axes1, t2, axes2, max_distance=None):
""" return "best" match between axes in `axes1` and in `axes2` """
from rsml.misc import hausdorff_distance
from openalea.rsml.misc import hausdorff_distance

# construct distance matrix
geom1 = t1.property('geometry')
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/rsml/metadata.py → src/openalea/rsml/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Manage rsml metadata attributes

The metadata element in rsml contains some mandatory content and optional ones.
In the IO operation from rsml file to&from mtg, these metadata are looked for
In the IO operation from openalea.rsml file to&from mtg, these metadata are looked for
in the 'metadata' graph property of the mtg::

mtg.graph_properties()['metadata']
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/rsml/plot.py → 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 rsml
import openalea.rsml
import os

def get_file(f):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions src/rsml/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
N = 2

from time import sleep
from rsml.data import data_dir
import rsml
from openalea.rsml.data import data_dir
import openalea.rsml as rsml

img_dir = data_dir
data = data_dir
Expand Down
8 changes: 4 additions & 4 deletions test/test_discrete_mtg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import pickle

def load_discrete():
from rsml.data import data_dir
import rsml
from openalea.rsml.data import data_dir
import openalea.rsml as rsml
filename = data_dir/'discrete.bmtg'
with open(filename, 'rb') as f: # F. Bauget 2022-04-12: needs bytes
g = pickle.load(f, encoding="latin1") # F. Bauget 2022-04-12: Python 2 bytestring data to Python 3
Expand Down Expand Up @@ -38,8 +38,8 @@ def simple_tree():
return g

def test_discrete_to_continuous():
from rsml.continuous import discrete_to_continuous
from rsml.continuous import continuous_to_discrete
from openalea.rsml.continuous import discrete_to_continuous
from openalea.rsml.continuous import continuous_to_discrete

def test_tree(g0):
gc = discrete_to_continuous(g0.copy())
Expand Down
4 changes: 2 additions & 2 deletions test/test_hirros.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
Tests for the measurements module
"""
import rsml
from rsml import hirros
import openalea.rsml as rsml
from openalea.rsml import hirros

def get_mtg():
fn = 'data/61_graph_expertized.rsml'
Expand Down
4 changes: 2 additions & 2 deletions test/test_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def simple_tree():
return g

def test_length():
from rsml.measurements import root_length
from openalea.rsml.measurements import root_length

g = simple_tree()
L = root_length(g)
Expand All @@ -28,7 +28,7 @@ def test_length():
assert sorted(L.values())==[1,3], 'invalid axe length'

def test_RSML_Measurement():
from rsml.measurements import RSML_Measurements
from openalea.rsml.measurements import RSML_Measurements

g = simple_tree()
m = RSML_Measurements()
Expand Down
Loading