urclib.fuzzylogic.embedgen
Take fuzzylogic statements and generate an embeddable python module for use in larger projects. The generated module will still expect the fuzzylogic package to be discoverable.
Module Contents
Functions
|
Write header information to buffer. |
|
Write function to check for the availability of the provided keys within the intended input dictionary. |
|
Create new input definition in body of generated module. |
|
Write code to generate the contents of a fuzzylogic set within the generated module. |
|
Create new result definition in body of generated module. |
|
Generate function for executing the encoded fuzzylogic. |
|
Write function to execute combiners on implications generated from executing embedded fuzzylogic. |
|
Create function to encapsulate the logic chosen for handling encountered nodata values. |
|
Generate code for use in an embeddable module suitable for running the provided fuzzylogic statements. |
Attributes
- urclib.fuzzylogic.embedgen.INDENT_STEP
- urclib.fuzzylogic.embedgen._write_header(indent, buff, flimport='fuzzylogic')
Write header information to buffer.
- Parameters:
indent (str) – Whitespace indicating indent level.
buff (Filelike) – Buffer being written to.
flimport (str,optional) – package name to stand in for fuzzylogic.
- urclib.fuzzylogic.embedgen._write_check(indent, buff, names)
Write function to check for the availability of the provided keys within the intended input dictionary.
- Parameters:
indent (str) – Whitespace indicating indent level.
buff (Filelike) – Buffer being written to.
names (list) – String of variables to detect.
- urclib.fuzzylogic.embedgen._write_input(indent, buff, input, varname='input', typename='FuzzyInput')
Create new input definition in body of generated module.
- Parameters:
indent (str) – Whitespace indicating indent level.
buff (Filelike) – Buffer being written to.
input (FuzzyInput) – FuzzyInput object to encode.
varname (str,optional) – Name to apply to variable while it is being configured; this does not need to be unique.
typename (str,optional) – The object typename for the definition. This should be either FuzzyInput or a subclass.
- urclib.fuzzylogic.embedgen._write_flset(indent, buff, fls, varname='fls')
Write code to generate the contents of a fuzzylogic set within the generated module.
- Parameters:
indent (str) – Whitespace indicating indent level.
buff (Filelike) – Buffer being written to.
fls (FuzzyLogicSet) – The FuzzyLogicSet to embed in the generated module.
varname (str,optional) – The name to apply to the variable within the generated code.
- urclib.fuzzylogic.embedgen._write_result(indent, buff, result)
Create new result definition in body of generated module.
- Parameters:
indent (str) – Whitespace indicating indent level.
buff (Filelike) – Buffer being written to.
result (FuzzyResult) – FuzzyResult object to encode.
- urclib.fuzzylogic.embedgen._write_run_code(indent, buff, flsets)
Generate function for executing the encoded fuzzylogic.
- Parameters:
indent (str) – Whitespace indicating indent level.
buff (Filelike) – Buffer being written to.
flsets (dict) – Dict with FuzzyLogicSet for values, and their labels as keys.
- urclib.fuzzylogic.embedgen._write_combiners(indent, buff, combiners)
Write function to execute combiners on implications generated from executing embedded fuzzylogic.
- Parameters:
indent (str) – Whitespace indicating indent level.
buff (Filelike) – Buffer being written to.
combiners (dict) – A dictionary of dictionaries describing combiners as they are in a SIMPA settings file, with their labels as keys.
- urclib.fuzzylogic.embedgen._write_nodata_mode(indent, buff, ndmethod, ndsubvalue)
Create function to encapsulate the logic chosen for handling encountered nodata values.
- Parameters:
indent (str) – Whitespace indicating indent level.
buff (Filelike) – Buffer being written to.
ndmethod (str) – Label indicating method to use for managing nodata values.
ndsubvalue (float) – The optional substitution value for nodata.
- urclib.fuzzylogic.embedgen.generate_embeddable(buff, infile, flimport='fuzzylogic')
Generate code for use in an embeddable module suitable for running the provided fuzzylogic statements.
- Parameters:
buff (filelike) – The buffer to write to.
infile (str) – Path to a SIMPA project file (*.sijn) to load.
flimport (str,optional) – Custom name for the fuzzylogic package to use in the import statement.