From e55900b055725426df833760b97cfdae14fdcd0c Mon Sep 17 00:00:00 2001 From: Carlos Sevilla Salcedo <22427519+sevisal@users.noreply.github.com> Date: Fri, 8 Dec 2023 11:45:59 +0100 Subject: [PATCH] Temporary fix of User Interaction data passing (#120) * Temporary fix of GUI output * DOC: fix wrong Python version, warnings when building docs * FIX: replace basic_usage with loop_demo in user_guide.rst --------- Co-authored-by: Teemu Ruokolainen --- docs/source/development.md | 2 +- docs/source/index.rst | 1 - docs/source/installation.md | 4 +- docs/source/user_guide.rst | 4 +- src/vai_lab/Core/vai_lab_core.py | 7 +- src/vai_lab/GUI/GUI_core.py | 3 +- src/vai_lab/examples/xml_files/loop_demo.xml | 58 ++++++++++++++ .../xml_files/ridge_regression_demo.xml | 76 +++++++++++++++++++ 8 files changed, 146 insertions(+), 9 deletions(-) create mode 100644 src/vai_lab/examples/xml_files/loop_demo.xml create mode 100644 src/vai_lab/examples/xml_files/ridge_regression_demo.xml diff --git a/docs/source/development.md b/docs/source/development.md index f24263e2..3b8db130 100644 --- a/docs/source/development.md +++ b/docs/source/development.md @@ -3,7 +3,7 @@ ## Clone repository To get started with development, clone the VAI-lab repository and change directory -```bash, +```bash git clone https://github.com/AaltoPML/VAI-lab.git && cd VAI-lab ``` diff --git a/docs/source/index.rst b/docs/source/index.rst index b5cfc753..9ee150a4 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -19,7 +19,6 @@ Contents Installation User Guide Development - Documentation Contributing diff --git a/docs/source/installation.md b/docs/source/installation.md index 34c5e986..0fc2a64d 100644 --- a/docs/source/installation.md +++ b/docs/source/installation.md @@ -2,7 +2,7 @@ ## Requirements -- Python 3.10+ +- Python 3.11+ ## Install from PyPi @@ -18,7 +18,7 @@ conda env create --name vai-lab python=3.10 pip && conda activate vai-lab && pyt ## Install from source Clone this repository and change directory -```bash, +```bash git clone https://github.com/AaltoPML/VAI-lab.git && cd VAI-lab ``` Install into a [virtual environment](https://docs.python.org/3/library/venv.html) diff --git a/docs/source/user_guide.rst b/docs/source/user_guide.rst index 18d862c1..953e0529 100644 --- a/docs/source/user_guide.rst +++ b/docs/source/user_guide.rst @@ -55,7 +55,7 @@ Pre-made `examples `_ Demonstrates manual image classification of chest X-rays - `canvas_demo.xml `_ Launches the canvas state-action pair visualiser and editor - - `regression_demo.xml `_ Demonstrates simple linear regression on a small set of sample data + - `regression_demo.xml `_ Demonstrates simple linear regression on a small set of sample data Launching examples: ^^^^^^^^^^^^^^^^^^^ @@ -197,7 +197,7 @@ Loops Loop tags are used to iterate over a given set of modules until a condition is met. Loops can be nested and named. -See `basic_operation.xml `_ for full example. +See `loop_demo.xml `_ for full example. Current options: - ``type``: what variety of loop will this be: ``for``, ``while``, ``manual`` (user defined stopping condition on-the-fly) diff --git a/src/vai_lab/Core/vai_lab_core.py b/src/vai_lab/Core/vai_lab_core.py index 6edb6114..1395798f 100644 --- a/src/vai_lab/Core/vai_lab_core.py +++ b/src/vai_lab/Core/vai_lab_core.py @@ -69,7 +69,6 @@ def _execute_module(self, specs): self._load_data(specs, specs["name"]) mod.set_options(specs) if specs["name"] == 'User Interaction': - mod._load_plugin(specs["plugin"]["plugin_name"]) mod.set_data_in(self.data[specs["name"]]) else: mod._load_plugin(self.data[specs["name"]]) @@ -79,7 +78,11 @@ def _execute_module(self, specs): + "processing..." ) mod.launch() - self.data[specs["name"]] = mod.get_result() + + if type(mod.get_result()) is Data: + self.data[specs["name"]] = mod.get_result() + else: + self.data[specs["name"]].import_existing_data(specs["name"], self.data) def _execute_loop(self, specs): if hasattr(self,"_execute_{}_loop".format(specs["type"])): diff --git a/src/vai_lab/GUI/GUI_core.py b/src/vai_lab/GUI/GUI_core.py index bb3f3c3b..be55f46e 100644 --- a/src/vai_lab/GUI/GUI_core.py +++ b/src/vai_lab/GUI/GUI_core.py @@ -1,6 +1,7 @@ from vai_lab.Data.xml_handler import XML_handler from vai_lab._import_helper import import_plugin_absolute from vai_lab._types import DataInterface, PluginSpecsInterface, DictT +from vai_lab.Data.Data_core import Data from typing import Any import tkinter as tk @@ -165,4 +166,4 @@ def get_result(self): This is due to the way this module is constructed, it cycles through plugins, which is useful for the startpage, but complicates things when running UserInterface plugins""" - return self.output_data \ No newline at end of file + return self.output_data[-1] #self.output_data[-1][0] \ No newline at end of file diff --git a/src/vai_lab/examples/xml_files/loop_demo.xml b/src/vai_lab/examples/xml_files/loop_demo.xml new file mode 100644 index 00000000..0c19d934 --- /dev/null +++ b/src/vai_lab/examples/xml_files/loop_demo.xml @@ -0,0 +1,58 @@ + + + + + + + [(350.0, 50), 0, {}] + + + + + + + + + + + (129.0, 193.0, 547.0, 514.0) + + + + + + + + + + + + [(350.0, 350.0), 2, {0: 'd0-u2'}] + + + + + + + + + + + + + + + [(350.0, 650), 1, {2: 'd2-u1'}] + + + + + User Interaction + + + .\examples\results\output.pkl + + + + + diff --git a/src/vai_lab/examples/xml_files/ridge_regression_demo.xml b/src/vai_lab/examples/xml_files/ridge_regression_demo.xml new file mode 100644 index 00000000..3ed81ce6 --- /dev/null +++ b/src/vai_lab/examples/xml_files/ridge_regression_demo.xml @@ -0,0 +1,76 @@ + + + + + + + [(350.0, 50), 0, {}] + + + + + + + + + + + + + + + + + + [(350.0, 350.0), 2, {0: 'd0-u2'}] + + + + + 0.02 + + + + + + X + + + Y + + + + + + + X_test + + + Y_test + + + + + + + + + + + + + + [(350.0, 650), 1, {2: 'd2-u1'}] + + + + + Modelling + + + .\examples\results\output.pkl + + + + +