-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
195 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from vai_lab._plugin_templates import InputDataPluginT | ||
|
||
from vai_lab.Data.Data_core import Data as model | ||
import pandas as pd | ||
|
||
_PLUGIN_READABLE_NAMES = {"Input": "default", | ||
"input": "alias"} # type:ignore | ||
_PLUGIN_MODULE_OPTIONS = {} # type:ignore | ||
_PLUGIN_REQUIRED_SETTINGS = {} # type:ignore | ||
_PLUGIN_OPTIONAL_SETTINGS = {} # type:ignore | ||
_PLUGIN_REQUIRED_DATA = {} # type:ignore | ||
_PLUGIN_OPTIONAL_DATA = {"X", "Y", "X_tst", 'Y_tst'} # type:ignore | ||
|
||
class Input(InputDataPluginT): | ||
""" | ||
Import data to the pipeline or append column to existing data | ||
""" | ||
|
||
def __init__(self, config = {}, data_in = [None], ini = False): | ||
"""Initialises parent class. | ||
Passes `globals` dict of all current variables | ||
""" | ||
super().__init__(globals()) | ||
if not ini: | ||
# Model configuration | ||
self.set_data_in(data_in) | ||
self.configure(config) | ||
# Model initialisation | ||
try: | ||
self.model = model(**self._config["options"]) | ||
except Exception as exc: | ||
print('The plugin encountered an error on the parameters of ' | ||
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.') | ||
raise | ||
else: | ||
self.model = model | ||
|
||
self.import_plugin = self.model.import_data | ||
self.append_plugin = self.model.append_data_column |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<pipeline> | ||
<Initialiser name="Initialiser"> | ||
<relationships> | ||
<child name="Input Data" /> | ||
</relationships> | ||
<coordinates> | ||
[(350.0, 50), 0, {}] | ||
</coordinates> | ||
</Initialiser> | ||
<InputData name="Input Data"> | ||
<inputdata> | ||
<X module="Initialiser" /> | ||
</inputdata> | ||
<relationships> | ||
<parent name="Initialiser" /> | ||
<child name="Output" /> | ||
</relationships> | ||
<coordinates> | ||
[(350.0, 350.0), 2, {0: 'd0-u2'}] | ||
</coordinates> | ||
<plugin type="Input"> | ||
<options /> | ||
<method type="import_data"> | ||
<options> | ||
<filename> | ||
.\examples\crystalDesign\20190606-R1-JT\BMP\RGB\Calibrated\Samples.csv | ||
</filename> | ||
<index_col> | ||
0 | ||
</index_col> | ||
</options> | ||
</method> | ||
</plugin> | ||
</InputData> | ||
<Output name="Output"> | ||
<inputdata> | ||
<X module="Input Data" /> | ||
</inputdata> | ||
<relationships> | ||
<parent name="Input Data" /> | ||
</relationships> | ||
<coordinates> | ||
[(350.0, 650), 1, {2: 'd2-u1'}] | ||
</coordinates> | ||
<plugin type="Output"> | ||
<options> | ||
<outdata> | ||
Input Data | ||
</outdata> | ||
<outpath> | ||
.\examples\results\output.pkl | ||
</outpath> | ||
</options> | ||
</plugin> | ||
</Output> | ||
</pipeline> |