Code Documentation¶
Created on Thu Feb 10 12:45:21 2022
@author: khs3z
- class flim.plugin.AbstractPlugin(name: str = 'flim.plugin', input: Dict[str, Any] = <built-in function input>, input_select: str = None, **kwargs)¶
Bases:
prefect.core.task.TaskAbstract class used to template plugins for data manipulation, analysis, plotting.
- configure(input: dict = <built-in function input>, input_select: Optional[str] = None, **kwargs)¶
Updates the configuration with the passed arguments.
The configuration is updated not replaced, i.e values of matching keys are overwritten, values of non-matching keys remain unaltered.
- Parameters
kwargs – the new key:value pairs.
- abstract execute()¶
Executes the analysis using the analyzer’s set input and configuration.
- Returns
- Dictionary of pandas.DataFrame and/or matplotlib.pyplot.Figure objects.
Keys represent window titles, values represent the DataFrame or Fugure objects.
- Return type
dict
- get_config_name() str¶
Returns a string copy of plugin’s name (self.name) in which whitespaces and non alphanumeric characters have been removed. It’s used to defines the plugin’s identifier in the config file.
- Returns
cleaned up plugin name
- Return type
str
- get_default_parameters() dict¶
Provides the plugin’s default parameters.
- Returns
default parameters
- Return type
dict
- get_description() str¶
Returns a description for this analyzing module. This may include instructions on how to use the parameters.
- Returns
the description.
- Return type
str
- get_icon() Any¶
Returns icon for this analysis.
- Returns
The bitmap of the icon.
- Return type
wx.Bitmap
- get_mapped_parameters() List[Dict[str, Any]]¶
Provides a list of the plugins current parameters. Each list item defines a parameters for the smallest independent work unit. The list can be mapped for parallel flow execution.
- Returns
list of current parameters
- Return type
list[dict]
- get_parameters() dict¶
Defines the plugins current parameters.
- Returns
current parameters
- Return type
dict
- abstract get_required_categories() List[str]¶
Returns the category column names that are required in the input to be analyzed.
Category columns use ‘category’ as dtype in Pandas DataFrame.
- Returns
list of column names.
- Return type
list(str)
- abstract get_required_features() List[str]¶
Returns the non-category column names that are required in the input to be analyzed.
Non-category columns are all those columns that do not use ‘category’ as dtype in Pandas dataframe.
- Returns
list of column names.
- Return type
list(str)
- input_definition() List[Type]¶
Provides type definition of plugin’s required input.
- Returns
list of object types
- Return type
list[type]
- output_definition() Dict[str, Type]¶
Provides type definition of plugin’s execute method.
- Returns
- keys describe output object labels; values represent corresponding
object types
- Return type
dict[type]
- run(input={}, input_select=None, **kwargs)¶
The run() method is called (with arguments, if appropriate) to run a task.
Note: The implemented run method cannot have *args in its signature. In addition, the following keywords are reserved: upstream_tasks, task_args and mapped.
If a task has arguments in its run() method, these can be bound either by using the functional API and _calling_ the task instance, or by using self.bind directly.
In addition to running arbitrary functions, tasks can interact with Prefect in a few ways: <ul><li> Return an optional result. When this function runs successfully,
the task is considered successful and the result (if any) can be made available to downstream tasks. </li>
<li> Raise an error. Errors are interpreted as failure. </li> <li> Raise a [signal](../engine/signals.html). Signals can include FAIL, SUCCESS,
- RETRY, SKIP, etc. and indicate that the task should be put in the indicated state.
<ul> <li> FAIL will lead to retries if appropriate </li> <li> SUCCESS will cause the task to be marked successful </li> <li> RETRY will cause the task to be marked for retry, even if max_retries
has been exceeded </li>
- <li> SKIP will skip the task and possibly propogate the skip state through the
flow, depending on whether downstream tasks have skip_on_upstream_skip=True.
</li></ul>
</li></ul>
- run_configuration_dialog(parent: Any, data_choices: Dict[str, Any] = {}) Dict[str, Any]¶
Executes the plugin’s configuration dialog.
The dialog is initialized with values of the analyzer’s Config object.
- Parameters
parent – parent GUI element
data_choices (dict) – available data tables to choose from. Keys correspond to table names; values correspond to DataFrame objects.
- Returns
The key:value pairs of specified config parameters.
- Return type
dict
- set_input(input: dict, input_select: list = []) dict¶
- validate()¶
Validates the parameters currently set for the plugin.
- Returns
True if set parameters satisfy plugin’s requirements
- Return type
boolean
- class flim.plugin.DataBucket(name='Data Bucket', **kwargs)¶
Bases:
flim.plugin.AbstractPlugin- execute()¶
Executes the analysis using the analyzer’s set input and configuration.
- Returns
- Dictionary of pandas.DataFrame and/or matplotlib.pyplot.Figure objects.
Keys represent window titles, values represent the DataFrame or Fugure objects.
- Return type
dict
- output_definition()¶
Provides type definition of plugin’s execute method.
- Returns
- keys describe output object labels; values represent corresponding
object types
- Return type
dict[type]
- run(input={}, input_select=None, name=None, **kwargs)¶
The run() method is called (with arguments, if appropriate) to run a task.
Note: The implemented run method cannot have *args in its signature. In addition, the following keywords are reserved: upstream_tasks, task_args and mapped.
If a task has arguments in its run() method, these can be bound either by using the functional API and _calling_ the task instance, or by using self.bind directly.
In addition to running arbitrary functions, tasks can interact with Prefect in a few ways: <ul><li> Return an optional result. When this function runs successfully,
the task is considered successful and the result (if any) can be made available to downstream tasks. </li>
<li> Raise an error. Errors are interpreted as failure. </li> <li> Raise a [signal](../engine/signals.html). Signals can include FAIL, SUCCESS,
- RETRY, SKIP, etc. and indicate that the task should be put in the indicated state.
<ul> <li> FAIL will lead to retries if appropriate </li> <li> SUCCESS will cause the task to be marked successful </li> <li> RETRY will cause the task to be marked for retry, even if max_retries
has been exceeded </li>
- <li> SKIP will skip the task and possibly propogate the skip state through the
flow, depending on whether downstream tasks have skip_on_upstream_skip=True.
</li></ul>
</li></ul>
- flim.plugin.create_instance(clazz)¶
Creates analyzer instance.
- Parameters
clazz (class) – analyzer class to instantiate.
- Returns
analyzer object (AbstractPlugin subclass)
- flim.plugin.discover_plugin_classes(dirs=['data', 'analysis', 'workflow'])¶
Creates labels and class objects for all Plugin subclasses in this package.
- Returns
key-value pairs of analyzer labels and associated classes.
- Return type
dict
- flim.plugin.get_plugin_class(key, tosearch={'Analysis': {'Autoencoder: Augment Data': <class 'flim.analysis.aeaugment.AEAugment'>, 'Autoencoder: Run': <class 'flim.analysis.aerun.RunAE'>, 'Autoencoder: Train': <class 'flim.analysis.aetraining.AETraining'>, 'Categorize Data': <class 'flim.analysis.categorizer.Categorizer'>, 'K-Means': <class 'flim.analysis.kmeans.KMeansClustering'>, 'KS-Statistics': <class 'flim.analysis.ksstats.KSStats'>, 'PCA': <class 'flim.analysis.pca.PCAnalysis'>, 'Random Forest': <class 'flim.analysis.randomforest.RandomForest'>, 'Relative Change': <class 'flim.analysis.relativechange.RelativeChange'>, 'Series Analysis': <class 'flim.analysis.seriesanalyzer.SeriesAnalyzer'>, 'Summarize': <class 'flim.analysis.summarystats.SummaryStats'>}, 'Data': {'Concat Data': <class 'flim.data.concatdata.Concatenator'>, 'Filter': <class 'flim.data.filterdata.Filter'>, 'Merge': <class 'flim.data.mergedata.Merger'>, 'Order Categories': <class 'flim.data.categories.CategoryOrder'>, 'Pivot': <class 'flim.data.pivotdata.Pivot'>, 'Sort': <class 'flim.data.sortdata.Sort'>, 'Unpivot': <class 'flim.data.unpivotdata.UnPivot'>}, 'Plot': {'Bar Plot': <class 'flim.analysis.barplots.BarPlot'>, 'Box Plot': <class 'flim.analysis.boxplots.BoxPlot'>, 'FLIRR Plot': <class 'flim.analysis.flirr.FLIRRPlot'>, 'Frequency Histogram': <class 'flim.analysis.freqhisto.FreqHisto'>, 'Heatmap': <class 'flim.analysis.heatmap.Heatmap'>, 'KDE': <class 'flim.analysis.kde.KDE'>, 'Line Plot': <class 'flim.analysis.lineplots.LinePlot'>, 'Pair Plot': <class 'flim.analysis.pairplots.PairPlot'>, 'Scatter Plot': <class 'flim.analysis.scatterplots.ScatterPlot'>, 'Swarm Plot': <class 'flim.analysis.swarmplot.SwarmPlot'>, 'Violin Plot': <class 'flim.analysis.violinplot.ViolinPlot'>}, 'Workflow': {'Basic FLIRR Analysis': <class 'flim.workflow.basicflow.BasicFLIRRWorkFlow'>, 'FLIM Data Augmentation Tuning': <class 'flim.workflow.aetune.AEWorkflow'>, 'FLIM Feature Analysis': <class 'flim.workflow.aefeature.AEFeatureWorkflow'>}})¶
- flim.plugin.init_plugins()¶
Initializes an instance for each individual Plugin subclass in this package.
- Returns
analyzer object instances.
- Return type
list
- flim.plugin.init_plugins_configs()¶
Creates a single configuration with default settings for a given group of Plugin objects.
- Parameters
list – plugin objects.
- Returns
configuration parameters.
- Return type
dict
- flim.plugin.plugin(plugintype)¶
Register an instantiated plugin to the PLUGINS dict.