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
4 changes: 2 additions & 2 deletions .github/workflows/conda-package-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ jobs:
anaconda_token: ${{ secrets.ANACONDA_TOKEN }}

with:
python-minor-version: '[10, 11, 12]'
operating-system: '["ubuntu-latest", "macos-13", "windows-latest"]'
force-channel-priority: conda-forge, openalea3/label/dev, openalea3
operating-system: '["ubuntu-latest", "macos-13", "windows-latest"]' # because of plantgl
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,8 @@ nosetests.xml
.DS_Store

# Doc build
doc/_build
doc/_build

# hydroroot
example/test.rsml
tmp*.*
92 changes: 92 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# HydroRoot

[![CI status](https://github.com/openalea/hydroroot/actions/workflows/conda-package-build.yml/badge.svg)](https://github.com/openalea/hydroroot/actions/workflows/conda-package-build.yml)
[![Documentation Status](https://readthedocs.org/projects/hydroroot/badge/?version=latest)](https://hydroroot.readthedocs.io/en/latest/?badge=latest)
[![image](https://anaconda.org/openalea3/openalea.hydroroot/badges/version.svg)](https://anaconda.org/openalea3/openalea.hydroroot)

## Software

### Authors

> - Christophe Pradal
> - Yann Boursiac
> - Mikael Lucas
> - Fabrice Bauget
> - Christophe Godin
> - Christophe Maurel

### Institutes

CIRAD / INRAE / inria / CNRS

### Status

Python package

### License

CecILL-C

**URL** : <https://hydroroot.rtfd.io>

## About

### Description

OpenAlea.HydroRoot is a hydraulic root architecture modelling and a root
architecture system generator package.

### Content

The OpenAlea.HydroRoot package contains a root architecture simulation
model coupled with a water and solute transport solver. It contains a
pure hydraulic solver that is solved using resistance network analogy.
It also contains a water and solute transport solver that is more
complex and see the root as a continuous medium.

### Example

Heat map representation of the incoming local radial flows on an
arabidopsis root.

![Alt Text](example/data/fig-6E.png)

### Installation

#### Conda Installation

conda create -n hydroroot -c conda-forge -c openalea3 openalea.hydroroot

#### Requirements

> - openalea.mtg
> - openalea.plantgl
> - RSML
> - pandas \> 0.17
> - numpy
> - scipy

#### Usage

See notebook in example directory.

## Documentation

<https://hydroroot.rtfd.io>

## Citations

If you use Hydroroot for your research, please cite:

1. Yann Boursiac, Christophe Pradal, Fabrice Bauget, Mikaël Lucas,
Stathis Delivorias, Christophe Godin, Christophe Maurel, Phenotyping
and modeling of root hydraulic architecture reveal critical
determinants of axial water transport, Plant Physiology, Volume 190,
Issue 2, October 2022, Pages 1289--1306,
<https://doi.org/10.1093/plphys/kiac281>
2. Fabrice Bauget, Virginia Protto, Christophe Pradal, Yann Boursiac,
Christophe Maurel, A root functional--structural model allows
assessment of the effects of water deficit on water and solute
transport parameters, Journal of Experimental Botany, Volume 74,
Issue 5, 13 March 2023, Pages 1594--1608,
<https://doi.org/10.1093/jxb/erac471>
103 changes: 0 additions & 103 deletions README.rst

This file was deleted.

53 changes: 35 additions & 18 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,69 @@
{% set pyproject = load_file_data('../pyproject.toml', from_recipe_dir=True) %}
{% set name = pyproject.get('project').get('name') %}
{% set description = pyproject.get('project').get('description') %}
{% set version = environ.get('SETUPTOOLS_SCM_PRETEND_VERSION', "0.0.0.dev") %}
{% set license = pyproject.get('project').get('license') %}
{% set home = pyproject.get('project', {}).get('urls', {}).get('Homepage', '') %}
{% set build_deps = pyproject.get("build-system", {}).get("requires", []) %}
{% set deps = pyproject.get('project', {}).get('dependencies', []) %}
{% set conda_deps = pyproject.get('tool', {}).get('conda', {}).get('environment', {}).get('dependencies',[]) %}
{% set test_deps = pyproject.get('project', {}).get('optional-dependencies', {}).get('test',[]) %}

package:
name: {{ pyproject["project"]["name"] }}
name: {{ name }}
version: {{ version }}

source:
path: ..

build:
noarch: python
string: py{{ PY_VER }}
preserve_egg_dir: True
number: 0
script: {{PYTHON}} -m pip install . -vv
preserve_egg_dir: True
string: py{{ PY_VER }}
script:
- {{ PYTHON }} -m pip install . --no-deps --ignore-installed --no-build-isolation -vv

requirements:
host:
- python
{% for dep in build_deps %}
- {{ dep }}
{% endfor %}

build:
- python {{ pyproject["project"]["requires-python"] }}
{% for dep in pyproject["build-system"]["requires"] %}
- {{ dep.lower() }}
{% endfor %}
- {{ compiler("cxx") }}

run:
- python {{ pyproject["project"]["requires-python"] }}
{% for dep in pyproject["project"]["dependencies"] %}
- {{ dep.lower() }}
{% endfor %}
{% for dep in pyproject["tool"]["conda"]["environment"]["dependencies"] %}
- {{ dep.lower() }}
- python
{% for dep in deps + conda_deps %}
- {{ dep }}
{% endfor %}


test:
requires:
- pytest
{% for dep in test_deps %}
- {{ dep }}
{% endfor %}

imports:
- openalea.hydroroot

source_files:
- test/**
- test/data/**

commands:
- cd test
- pytest -v

about:
summary: {{ pyproject["project"]["description"] }}
license: {{ pyproject["project"]["license"] }}
home: {{ pyproject["project"]["urls"]["Homepage"] }}
home: {{ home }}
summary: {{ description }}
license: {{ license }}

extra:
recipe-maintainers:
- baugetfa
- pradal
4 changes: 2 additions & 2 deletions example/Boursiac2022/boursiac2022.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"# to display inline plots in the notebook\n",
"%matplotlib inline\n",
"# to be able to use the plantGL viewer in 3D\n",
"%gui qt"
"# %gui qt"
]
},
{
Expand Down Expand Up @@ -1718,7 +1718,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.12.11"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
21 changes: 6 additions & 15 deletions example/Boursiac2022/simulation_fig-1B-3C-6E-7B.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@

import glob
import argparse
import tempfile, os

from openalea.plantgl.algo.view import view
import openalea.plantgl.all as pgl
from openalea.mtg import turtle as turt
from IPython.display import Image, display

from openalea.hydroroot.main import hydroroot_flow
from openalea.hydroroot.init_parameter import Parameters
from openalea.hydroroot.display import get_root_visitor, plot
from openalea.hydroroot.display import get_root_visitor, mtg_scene
from openalea.hydroroot import radius
from openalea.hydroroot.generator.markov import my_seed,generate_g
from openalea.hydroroot.generator.measured_root import mtg_from_aqua_data
Expand Down Expand Up @@ -102,9 +101,7 @@ def plot_order(g1, has_radius=True, r_base=1.e-4, r_tip=5e-5, prune=None, name=N
sh.appearance =pgl.Material(colors[vid])
scene = pgl.Scene([sh for shid in shapes.values() for sh in shid ])

pgl.Viewer.display(scene)
if name is not None:
pgl.Viewer.frameGL.saveImage(name)
return scene

if __name__ == '__main__':

Expand Down Expand Up @@ -161,15 +158,9 @@ def plot_order(g1, has_radius=True, r_base=1.e-4, r_tip=5e-5, prune=None, name=N
alpha = 0.2 # radius in millimeter identical for all orders
gcopy = g.copy() # copy because we change the radius property in plot below
if prop != 'order':
plot(gcopy, has_radius=False, r_base = alpha * 1.e-3, r_tip = alpha * 9.9e-4, prop_cmap = prop)
s = mtg_scene(gcopy, has_radius=False, r_base = alpha * 1.e-3, r_tip = alpha * 9.9e-4, prop_cmap = prop)
else:
plot_order(gcopy, has_radius=False, r_base = alpha * 1.e-3, r_tip = alpha * 9.9e-4)
s = plot_order(gcopy, has_radius=False, r_base = alpha * 1.e-3, r_tip = alpha * 9.9e-4)

## for display in the notebook, comment to display in the 3D viewer
pgl.Viewer.widgetGeometry.setSize(800, 800) # set the picture size in px
fn = tempfile.mktemp(suffix='.png')
pgl.Viewer.saveSnapshot(fn)
pgl.Viewer.stop()
img = Image(fn)
os.unlink(fn)
display(img)
view(s)
2 changes: 1 addition & 1 deletion example/Boursiac2022/simulation_fig-5_sup-fig-8.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def hydro_calculation(g, axfold = 1., radfold = 1., axial_data = None, k_radial
count = 0
# sensibility analyse using multiplying factor on K and k
for id in dseeds.index:
seed = dseeds.seed[id]
seed = int(dseeds.seed[id]) # otherwise this a numpy.int64 and the function random.seed does not like it
primary_length = dseeds.primary_length[id]
delta = dseeds.delta[id]
nude_length = dseeds.nude_length[id]
Expand Down
4 changes: 2 additions & 2 deletions example/Boursiac2022/simulation_fig-6-B-C.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def hydro_calculation(g, axfold = 1., radfold = 1., axial_data = None, k_radial
count = 0
nb_steps = len(dseeds) * len(parameter.output['axfold'])
for id in dseeds.index:
seed = dseeds.seed[id]
seed = int(dseeds.seed[id]) # otherwise this a numpy.int64 and the function random.seed does not like it
primary_length = dseeds.primary_length[id]
delta = dseeds.delta[id]
nude_length = dseeds.nude_length[id]
Expand Down Expand Up @@ -124,7 +124,7 @@ def hydro_calculation(g, axfold = 1., radfold = 1., axial_data = None, k_radial
axfold = 1.0
nb_steps = len(dseeds) * len(parameter.output['radfold'])
for id in dseeds.index:
seed = dseeds.seed[id]
seed = int(dseeds.seed[id]) # otherwise this a numpy.int64 and the function random.seed does not like it
primary_length = dseeds.primary_length[id]
delta = dseeds.delta[id]
nude_length = dseeds.nude_length[id]
Expand Down
Loading
Loading