Skip to content

Commit

Permalink
Add JOSS paper template, github actions and update openalea dependenc…
Browse files Browse the repository at this point in the history
…ies (#10)
  • Loading branch information
jvail committed Sep 3, 2023
1 parent 05e3c63 commit 07f9105
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 92 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/draft-pdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Draft JOOS PDF

on:
push:
branches:
- master
- main

jobs:
paper:
runs-on: ubuntu-latest
name: Paper Draft
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build draft PDF
uses: openjournals/openjournals-draft-action@master
with:
journal: joss
paper-path: paper/paper.md
- name: Upload
uses: actions/upload-artifact@v1
with:
name: paper
path: paper/paper.pdf
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test

on:
push:
branches:
- master
- main

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
uses: mamba-org/setup-micromamba@v1
with:
generate-run-shell: true
environment-file: binder/environment.yml
- name: Test with pytest
run: |
pytest --disable-pytest-warnings
shell: micromamba-shell {0}
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 0.1.0

Major changes compared to the original `MAppleT`:
Major changes compared to the original `MAppleT/StocaTree`:

- support Python 3 and updated dependencies
- support Jupyter notebooks
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# VMAppleT

A refactored implementation and maintenance release of MAppleT. Original sources copied and modified from [openalea/incubator](https://github.com/openalea-incubator/MAppleT).
A refactored and enhanced implementation of MAppleT/StocaTree. Original sources copied and modified from [openalea/incubator](https://github.com/openalea-incubator/MAppleT).

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jvail/vmapplet/master?urlpath=lab/tree/notebooks/simple_simulation.ipynb)


## Major changes compared to MAppleT
## Major changes compared to MAppleT/StocaTree

* Build system and dependencies: All outdated and unmaintained dependencies have been removed or replaced
* Modularization: The L-Py file has been splitted up into several smaller modules
Expand Down
21 changes: 11 additions & 10 deletions binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@ channels:
- fredboudon
- conda-forge
dependencies:
- python=3.9
- python=3.10
- jupyterlab=4.0
- jupyterlab_widgets=3.0
- ipywidgets=8.0
- toml=0.10
- matplotlib=3.7
- scipy=1.10
- boost=1.74
- boost-cpp=1.74
- toml
- matplotlib
- scipy
- boost
- boost-cpp
- cppyy=2.4
- openalea.lpy
- openalea.plantgl=3.14
- openalea.mtg=2.0
- xlrd=2.0
- pip=23.0
- openalea.plantgl=3.20.1
- openalea.mtg
- xlrd
- pip
- numpy>=1.22
- flake8
- mypy
- black
Expand Down
87 changes: 10 additions & 77 deletions notebooks/simple_simulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "c53a8105-14b5-437b-91ce-604152bb9c61",
"metadata": {
"tags": []
Expand All @@ -17,36 +17,20 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "b74cb80a-cac4-4d6f-ae18-165a52517072",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ddfba628792b452a9dd2cceff6ee0224",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"SceneWidget(scenes=[{'id': 'dQ6u5Pg13qMfGtHHPX8NPxVF2', 'data': b'x\\xdaSLrw\\xf5\\xf7e`Pp\\xe0\\xe5RPVVd\\x00\\x020\\"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"widget = SceneWidget()\n",
"widget"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "f4e4ddad-ba3d-40c8-9ecc-28740c010452",
"metadata": {
"tags": []
Expand All @@ -60,7 +44,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "89991d0d-2539-478d-8bb5-fe63a9a8095a",
"metadata": {
"tags": []
Expand All @@ -73,7 +57,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "8f50dd49",
"metadata": {
"tags": []
Expand All @@ -86,7 +70,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"id": "b243f0f4-cf7c-4c35-8fa3-a6e894c36e8b",
"metadata": {
"tags": []
Expand All @@ -100,65 +84,14 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"id": "64f4118d-93ff-4d43-99ed-f919d820003c",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"['edge_type',\n",
" 'label',\n",
" '_axial_id',\n",
" 'growth_units',\n",
" 'year',\n",
" 'inflorescence',\n",
" 'number',\n",
" 'closest_apex',\n",
" 'farthest_apex',\n",
" 'sons_nb',\n",
" 'observation',\n",
" 'parent_observation',\n",
" 'parent_unit_id',\n",
" 'parent_fbr_id',\n",
" 'parent_tree_id',\n",
" 'zone',\n",
" 'cumulated_mass',\n",
" 'radius',\n",
" 'offset',\n",
" 'developped',\n",
" 'phyllotactic_angle',\n",
" 'branching_angle',\n",
" 'rigidity',\n",
" 'age',\n",
" 'length',\n",
" 'trunk',\n",
" 'fruit_age',\n",
" 'fruit_mass',\n",
" 'leaf_age',\n",
" 'leaf_mass',\n",
" 'leaf_area']"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tree.property_names()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1d1b6f74-217b-4ef9-adee-6c4452458970",
"metadata": {},
"outputs": [],
"source": [
"tree.display()"
"tree.property_names()"
]
},
{
Expand Down Expand Up @@ -186,7 +119,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.15"
"version": "3.10.12"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
18 changes: 18 additions & 0 deletions paper/paper.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@Article{Costes:2008,
author={Costes, Evelyne
and Smith, Colin
and Renton, Michael
and Gu{\'e}don, Yann
and Prusinkiewicz, Przemyslaw
and Godin, Christophe},
title={MAppleT: simulation of apple tree development using mixed stochastic and biomechanical models},
journal={Functional Plant Biology},
year={2008},
volume={35},
number={10},
pages={936-950},
keywords={biomechanics, functional--structural plant model, Malus{\thinspace}{\texttimes}{\thinspace}domestica, Markov model, tree simulation.},
abstract={Construction of tree architectural databases over years is time consuming and cannot easily capture event dynamics, especially when both tree topology and geometry are considered. The present project aimed to bring together models of topology and geometry in a single simulation such that the architecture of an apple tree may emerge from process interactions. This integration was performed using L-systems. A mixed approach was developed based on stochastic models to simulate plant topology and mechanistic model for the geometry. The succession of growth units (GUs) along axes and their branching structure were jointly modelled by a hierarchical hidden Markov model. A biomechanical model, derived from previous studies, was used to calculate stem form at the metamer scale, taking into account the intra-year dynamics of primary, secondary and fruit growth. Outputs consist of 3-D mock-ups -- geometric models representing the progression of tree form over time. To asses these models, a sensitivity analysis was performed and descriptors were compared between simulated and digitised trees, including the total number of GUs in the entire tree, descriptors of shoot geometry (basal diameter, length), and descriptors of axis geometry (inclination, curvature). In conclusion, despite some limitations, MAppleT constitutes a useful tool for simulating development of apple trees in interaction with gravity.},
doi={10.1071/FP08081},
url={https://doi.org/10.1071/FP08081}
}
34 changes: 34 additions & 0 deletions paper/paper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: 'VMAppleT: Apple Tree simulations based on StocaTree'
tags:
- Python
- biology
- FSPM
authors:
- name: Frédéric Boudon
affiliation: 1
- name: Jan Vaillant
affiliation: 3
- name: Evelyne Costes
affiliation: 2
affiliations:
- name: CIRAD, UMR AGAP Institut, F-34398 Montpellier, France
index: 1
- name: French National Institute for Agriculture, Food, and Environment (INRAE)
index: 2
- name: Independent Researcher, France
index: 3
date: 2 September 2023
bibliography: paper.bib
---

# Summary

VMAppleT is a greatly refactored, modernized and updated implementation of StocaTree/MappleT [@Costes:2008] with
support for running simulations in Jupyter notebooks to improve accessibility, extensibility and customization of the model.


# Acknowledgements


# References
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ authors = [
]
description = "Apple Tree simulation using Markov Chains based on MAppleT"
readme = "README.md"
requires-python = "~=3.9.0"
requires-python = "~=3.10.0"

[tool.setuptools]
packages = ["vmapplet"]
9 changes: 8 additions & 1 deletion vmapplet/optimisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@

from .frame import Frame

rotate = cppyy.gbl.optimization.rotate
second_moment_of_area_annular_section = (
cppyy.gbl.optimization.second_moment_of_area_annular_section
)
second_moment_of_area_circle = cppyy.gbl.optimization.second_moment_of_area_circle
get_new_radius = cppyy.gbl.optimization.get_new_radius
# _reaction_wood_target = cppyy.gbl.optimization.reaction_wood_target


def rotate(
v3x: float, v3y: float, v3z: float, angle: float, vx: float, vy: float, vz: float
):
# pgl can not handle the vector: wrap in list
return list(cppyy.gbl.optimization.rotate(v3x, v3y, v3z, angle, vx, vy, vz))


import openalea.plantgl.all as pgl


Expand Down

0 comments on commit 07f9105

Please sign in to comment.