tools

Module Contents

Classes

Functions

Attributes

_workspace_path
class text_format[source]
software_version()[source]
find_and_replace(begin_char, end_char, theStr, replace_function)[source]
create_unique_dirname(dirname)[source]

Create dirname if it doesn’t exists, otherwise append an integer to dirname and create it.

Parameters:dirname – name of the directory to create
Returns:name of the directory created
applyEquation(objectIn, s)[source]

Apply literal expression based on an object

Parameters:
  • objectIn – Object
  • s – literal expression. Float variables taken from the object are written between {}, int between []. Example: s=”{x}+{y}*2” if x and y are attributes of objectIn.
Returns:

value (float)

arithmeticEval(s)[source]
isNonePrintMessage(theObject, theMessage, show_type=SHOW_INFO)[source]
getPath_workspace()[source]

Get workspace path (i.e., location where optimeed files will be created). Create directory if doesn’t exist.

setPath_workspace(thePath)[source]

Set workspace path (i.e., location where optimeed files will be created)

getLineInfo(lvl=1)[source]
printIfShown(theStr, show_type=SHOW_DEBUG, isToPrint=True, appendTypeName=True, end='n')[source]
universalPath(thePath)[source]
add_suffix_to_path(thePath, suffix)[source]
get_object_attrs(obj)[source]
rsetattr(obj, attr, val)[source]

setattr, but recursively. Works with list (i.e. theObj.myList[0].var_x)

rgetattr(obj, attr)[source]

getattr, but recursively. Works with list.

indentParagraph(text_in, indent_level=1)[source]

Add ‘ ‘ at beginning of strings and after each ‘ ‘.

truncate(theStr, truncsize)[source]
get_recursive_attrs(theObject, max_recursion_level=2)[source]
str_all_attr(theObject, max_recursion_level)[source]
get_2D_pareto(xList, yList, max_X=True, max_Y=True)[source]

Get 2D pareto front

Parameters:
  • xList – list of x coordinates
  • yList – list of y coordinates
  • max_X – True if x is to maximize
  • max_Y – true if y is to maximize
Returns:

x pareto-optimal coordinates, y pareto-optimal coordinates, indices of these points in input parameters

get_ND_pareto(objectives_list, are_maxobjectives_list=None)[source]

Return the N-D pareto front

Parameters:
  • objectives_list – list of list of objectives: example [[0,1], [1,1], [2,2]]
  • are_maxobjectives_list – for each objective, tells if they are to be maximized or not: example [True, False]. Default: False
Returns:

extracted_pareto, indices: list of [x, y, …] points forming the pareto front, and list of the indices of these points from the base list.

delete_indices_from_list(indices, theList)[source]

Delete elements from list at indices

Parameters:
  • indices – list
  • theList – list
merge_two_dicts(dict1, dict2)[source]

Merge two dicts without affecting them

Returns:new dictionary
deep_sizeof(obj)[source]
order_lists(ref_list, linked_list)[source]