diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f5e549a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -language: cpp - -os: - - linux - - osx - -sudo: required - -services: - - docker - -env: - - CONDA_RECIPE=conda - CONDA_VERSION=3 - -install: - - git clone https://github.com/openalea/travis-ci.git - - cd travis-ci - - source install.sh - - conda config --prepend channels conda-forge - -before_script: - - source before_script.sh - -script: - - source script.sh - -after_success: - - source after_success.sh - -after_failure: - - source after_failure.sh - -before_deploy: - - source before_deploy.sh - -deploy: - skip_cleanup: true - provider: script - script: bash deploy_script.sh - -after_deploy: - - source after_deploy.sh - -after_script: - - source after_script.sh diff --git a/appveyor.yml b/appveyor.yml deleted file mode 120000 index 8c7bf93..0000000 --- a/appveyor.yml +++ /dev/null @@ -1 +0,0 @@ -.appveyor.yml \ No newline at end of file diff --git a/conda/meta.yaml b/conda/meta.yaml index eae505e..4cf1c8f 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -10,7 +10,7 @@ source: build: noarch: python preserve_egg_dir: True - number: 3 + number: 0 script: {{PYTHON}} setup.py install requirements: diff --git a/setup.py b/setup.py index e098860..b9dbdae 100644 --- a/setup.py +++ b/setup.py @@ -4,10 +4,10 @@ import sys import os -from setuptools import setup, find_packages +from setuptools import setup, find_namespace_packages name = 'OpenAlea.Strawberry' -version = '1.1.0' +version = '1.1.1' description = "Strawberry is a package for architecture analysis and 2D/3D reconstruction." long_description = open('README.md').read() @@ -22,7 +22,7 @@ setup_requires = ['openalea.deploy'] # find packages -packages = find_packages('src') +packages=find_namespace_packages(where='src', include=['openalea.*']) package_dir={'': 'src'} setup( diff --git a/src/openalea/__init__.py b/src/openalea/__init__.py deleted file mode 100644 index de40ea7..0000000 --- a/src/openalea/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/src/openalea/strawberry/application/misc.py b/src/openalea/strawberry/application/misc.py index 229eea4..23ebff4 100644 --- a/src/openalea/strawberry/application/misc.py +++ b/src/openalea/strawberry/application/misc.py @@ -3,18 +3,18 @@ from io import StringIO import pandas as pd import base64 + from ipywidgets import HTML import ipywidgets as widgets + from oawidgets.plantgl import PlantGL import openalea.strawberry from openalea.mtg.io import write_mtg from openalea.mtg import MTG -from openalea.strawberry.application.layout import layout_dataframe, layout_output_wgt, layout_visu3d -from openalea.deploy.shared_data import shared_data - -data_directory = shared_data(openalea.strawberry.__path__) +from openalea.strawberry.data import data_directory +from openalea.strawberry.application.layout import layout_dataframe, layout_output_wgt, layout_visu3d if layout_dataframe == "qgrid": diff --git a/src/openalea/strawberry/data.py b/src/openalea/strawberry/data.py new file mode 100644 index 0000000..7183763 --- /dev/null +++ b/src/openalea/strawberry/data.py @@ -0,0 +1,16 @@ +""" Module providing shared data access +""" +from pathlib import Path + +from openalea.deploy.shared_data import shared_data +import openalea.strawberry + + +data_directory = shared_data(openalea.strawberry.__path__) +count = 0 +d = Path(openalea.strawberry.__path__[0]) +while data_directory is None and count <=3: + d = d/'..' + data_directory = shared_data(d) + count+=1 + diff --git a/src/openalea/strawberry/import_mtgfile.py b/src/openalea/strawberry/import_mtgfile.py index 54caa76..70d99a8 100644 --- a/src/openalea/strawberry/import_mtgfile.py +++ b/src/openalea/strawberry/import_mtgfile.py @@ -4,6 +4,7 @@ import pandas as pd import numpy as np from openpyxl import load_workbook + from openalea.plantgl.all import* from openalea.mtg import io from openalea.mtg import algo @@ -11,7 +12,7 @@ import openalea.strawberry from openalea.mtg import MTG, algo -from openalea.deploy.shared_data import shared_data +from openalea.strawberry.data import data_directory def name(f): @@ -34,7 +35,7 @@ def import_mtgfile(filename): :rtype: MTG """ filenames = filename - files = shared_data(openalea.strawberry).glob('*.mtg') + files = data_directory.glob('*.mtg') mtg_path = dict((name(f), f) for f in files) mtgfile = dict((k,f) for k,f in mtg_path.items() if k in filenames) if len(filenames) == 1: diff --git a/test/test_analysis.py b/test/test_analysis.py index 3019677..7ef176c 100644 --- a/test/test_analysis.py +++ b/test/test_analysis.py @@ -1,15 +1,18 @@ +import pandas as pd +from openalea.mtg.io import read_mtg_file + from openalea.strawberry.analysis import extract_at_module_scale, extract_at_node_scale from openalea.strawberry.analysis import occurence_module_order_along_time, prob_axillary_production -from openalea.deploy.shared_data import shared_data import openalea.strawberry -from openalea.mtg.io import read_mtg_file +from openalea.strawberry.data import data_directory + def name(f): return f.basename().splitext()[0] def test_extract_at_module_scale(): - files = shared_data(openalea.strawberry).glob('*.mtg') + files = data_directory.glob('*.mtg') mtg_path = dict((name(f), f) for f in files) gariguette = read_mtg_file(mtg_path['Gariguette']) gariguette_extraction_at_module_scale = extract_at_module_scale(gariguette) @@ -18,13 +21,19 @@ def test_extract_at_module_scale(): gariguette_frequency = occurence_module_order_along_time(data= gariguette_extraction_at_module_scale,frequency_type= "cdf") assert len(gariguette_frequency) == 6 - mean= gariguette_extraction_at_module_scale.groupby(["Genotype", "order"]).mean() - sd= gariguette_extraction_at_module_scale.groupby(["Genotype", "order"]).std() + + # remove object value from mean & std + fd = gariguette_extraction_at_module_scale + fd.date = pd.to_datetime(fd.date) + props = [x for x in fd if x in ["Genotype", "order"] or fd[x].dtype!=object] + + mean= fd.filter(props).groupby(["Genotype", "order"]).mean() + sd= fd.filter(props).groupby(["Genotype", "order"]).std() assert len(mean) == 6 assert len(sd) == 6 def test_extraction_at_node_scale(): - files = shared_data(openalea.strawberry).glob('*.mtg') + files = data_directory.glob('*.mtg') mtg_path = dict((name(f), f) for f in files) gariguette = read_mtg_file(mtg_path['Gariguette']) gariguette_extraction_at_node_scale = extract_at_node_scale(gariguette) diff --git a/test/test_extraction.py b/test/test_extraction.py index 1445bfa..df39b2b 100644 --- a/test/test_extraction.py +++ b/test/test_extraction.py @@ -1,4 +1,3 @@ -from openalea.deploy.shared_data import shared_data import openalea.strawberry from openalea.mtg.io import read_mtg_file from openalea.mtg.algo import union @@ -6,12 +5,13 @@ from openalea.strawberry.analysis import extract_at_module_scale, extract_at_node_scale, extract_at_plant_scale +from openalea.strawberry.data import data_directory def name(f): return f.basename().splitext()[0] def test_extract_at_module_scale(): - files = shared_data(openalea.strawberry).glob('*.mtg') + files = data_directory.glob('*.mtg') mtg_path = dict((name(f), f) for f in files) mtg = MTG() @@ -32,7 +32,7 @@ def test_extract_at_module_scale(): def test_extract_at_node_scale(): - files = shared_data(openalea.strawberry).glob('*.mtg') + files = data_directory.glob('*.mtg') mtg_path = dict((name(f), f) for f in files) mtg = MTG() @@ -53,7 +53,7 @@ def test_extract_at_node_scale(): def test_extract_at_plant_scale(): - files = shared_data(openalea.strawberry).glob('*.mtg') + files = data_directory.glob('*.mtg') mtg_path = dict((name(f), f) for f in files) mtg = MTG() diff --git a/test/test_import_data.py b/test/test_import_data.py index 594a27d..98240ab 100644 --- a/test/test_import_data.py +++ b/test/test_import_data.py @@ -1,23 +1,23 @@ -from openalea.deploy.shared_data import shared_data +import os import openalea.strawberry from openalea.strawberry.import_mtgfile import import_mtgfile, import_mtg_from_csv, strawberry_reader_csv +from openalea.strawberry.data import data_directory - +data_dir = data_directory def name(f): return f.basename().splitext()[0] -mtg_files = shared_data(openalea.strawberry).glob('*.mtg') +mtg_files = data_dir.glob('*.mtg') -excel_files = shared_data(openalea.strawberry).glob('*.xlsx') -import os +excel_files = data_dir.glob('*.xlsx') def test_import_mtgfile(): """test import_mtgfile function by filename or list of filename """ - mtg_files = shared_data(openalea.strawberry).glob('*.mtg') + mtg_files = data_dir.glob('*.mtg') mtg_path= dict((name(f), f) for f in mtg_files) genotypes= list(mtg_path.keys()) @@ -31,14 +31,14 @@ def test_import_mtgfile(): def test_import_mtg_from_csv(): """test import of mtg from excel files """ - excel_files = shared_data(openalea.strawberry).glob('*/*.xlsx') + excel_files = data_dir.glob('*/*.xlsx') g= import_mtg_from_csv(files=excel_files,first_property="experimental_names",symbol_at_scale=dict(P=1,T=2, F=3, f=3, b=3, HT=3, bt=3, ht=3,s=3)) assert (isinstance(g, openalea.mtg.mtg.MTG),"data not exist or data not respect the formalism") def test_strawberry_reader_csv(): """ test one excel files """ - excel_files = shared_data(openalea.strawberry).glob('*/*.xlsx') + excel_files = data_dir.glob('*/*.xlsx') for file in excel_files: g=strawberry_reader_csv(file=file) assert (isinstance(g, openalea.mtg.mtg.MTG), "data not exist or data in"+ file + "not respect the formalism") \ No newline at end of file diff --git a/test/test_visualization.py b/test/test_visualization.py index cc22955..a6e7b73 100644 --- a/test/test_visualization.py +++ b/test/test_visualization.py @@ -1,17 +1,18 @@ -from openalea.deploy.shared_data import shared_data -import openalea.strawberry +import openalea from openalea.mtg.io import read_mtg_file from openalea.mtg.algo import orders, split -import openalea + from oawidgets.plantgl import PlantGL +import openalea.strawberry from openalea.strawberry import visu2d, visu3d +from openalea.strawberry.data import data_directory def name(f): return f.basename().splitext()[0] def test_import_mtg(): - files = shared_data(openalea.strawberry).glob('*.mtg') + files = data_directory.glob('*.mtg') mtg_path = dict((name(f), f) for f in files) gariguette = read_mtg_file(mtg_path['Gariguette']) straws = split(gariguette) @@ -19,7 +20,7 @@ def test_import_mtg(): def test_3D(): - files = shared_data(openalea.strawberry).glob('*.mtg') + files = data_directory.glob('*.mtg') mtg_path = dict((name(f), f) for f in files) gariguette = read_mtg_file(mtg_path['Gariguette']) gariguette.properties()['order'] = orders(gariguette) @@ -34,7 +35,7 @@ def test_3D(): def __test_2D(): - files = shared_data(openalea.strawberry).glob('*.mtg') + files = data_directory.glob('*.mtg') mtg_path = dict((name(f), f) for f in files) gariguette = read_mtg_file(mtg_path['Gariguette']) gariguette.properties()['order'] = orders(gariguette) diff --git a/test/test_waffle.py b/test/test_waffle.py index b459366..fae5851 100644 --- a/test/test_waffle.py +++ b/test/test_waffle.py @@ -1,17 +1,18 @@ -from pathlib import Path import os +from pathlib import Path from openalea.mtg.io import read_mtg_file, write_mtg -from openalea.strawberry.analysis import extract_at_node_scale, extract_at_module_scale -from openalea.deploy.shared_data import shared_data -import openalea.strawberry +import openalea.strawberry +from openalea.strawberry.analysis import extract_at_node_scale, extract_at_module_scale from openalea.strawberry.analysis import df2waffle +from openalea.strawberry.data import data_directory + def name(f): return f.basename().splitext()[0] def test_df2waffle(): - files = shared_data(openalea.strawberry).glob('*.mtg') + files = data_directory.glob('*.mtg') mtg_path = dict((name(f), f) for f in files) mtg = read_mtg_file(mtg_path['Capriss'])