Various tools.
Class |
|
Not in use. Not necessary when the algorithm dict is an OrderedDict anyway. |
Class |
|
Contextmanager to do some work in a folder of choice and change dir back in the end. |
Class |
|
with InfolderGoneWithTheWind(): ... executes the block in a |
Class |
|
A microtool to join a list of strings using property as_string . |
Class |
|
A list of str with search/find functionality. |
Function | diff |
return list of [name, val1, val2] triplets for attributes with different values. |
Function | equals |
Undocumented |
Function | get |
Returns a string with the COCO version of the installed postprocessing, potentially adding the hash of the hypervolume reference values from the actual experiments (in the bbob-biobj setting). If algorithmID==None, the set of different hypervolume reference values from all algorithms, read in by the postprocessing, are returned in the string... |
Function | git |
Run a git command and return its output. |
Function | legend |
Undocumented |
Function | less |
return a < b, while comparing nan results in False without warning |
Function | num2str |
returns the shortest string representation with either significant_digits digits shown or its true value, whichever is shorter. |
Function | number |
returns the number of non-zero digits of a number, e.g. two for 1200 or three for 2.03. |
Function | number |
usage as number_to_html(num2str(1.023e-12)) == "'-1.0 x 10<sup>-12</sup>'" |
Function | number |
usage as number_to_latex(num2str(1.023e-12)) == "'-1.0\times10^{-12}'" |
Function | path |
Undocumented |
Function | prepend |
"prepend lines the tex-command filename |
Function | print |
prints a message with time stamp |
Function | replace |
"replace a string in the file with another string |
Function | str |
do replacements in string such that it most likely compiles with latex |
Function | strip |
remove ../ and ./ and leading/trailing blanks and path separators from input string name and replace any remaining path separator with '/' |
Function | strip |
remove ../ and ./ and leading/trailing blanks and path separators from input string name, replace any remaining path separator with '/', and keep only the last part of the path |
Function | strip |
as strip_pathname1 but keep the last two parts of the path |
Function | strip |
as strip_pathname1 and also remove 'noiseless' from the name |
Function | truncate |
truncate file but keep in good latex shape |
return list
of [name, val1, val2] triplets for
attributes with different values.
Attributes whose names start with any string from the
exclude
list are skipped. Furthermore, only attributes
present in both m1
and m2
are compared.
This function was introduced to compare the genericsettings
module with its state directly after import. It should be
applicable any other two class instances as well.
Details: to "find" the attributes, m1.__dict__
is iterated over.
Returns a string with the COCO version of the installed postprocessing,
potentially adding the hash of the hypervolume reference values from
the actual experiments (in the bbob-biobj
setting).
If algorithmID==None, the set of different hypervolume reference values
from all algorithms, read in by the postprocessing, are returned in
the string. If more than one reference value is present in the data,
the string displays also a warning.
Run a git command and return its output.
All errors are deemed fatal and the system will quit.
WARNING: This method is also defined in ../../code-experiments/tools/cocoutils.py. If you change something you have to change it in both files.
returns the shortest string representation with either significant_digits digits shown or its true value, whichever is shorter.
force_rounding shows no more than the desired number of significant digits, which means, e.g., 12345 becomes 12000.
remove_trailing_zeros removes zeros, if and only if the value is exactly.
>>> from cocopp import toolsdivers as td >>> print([td.num2str(val) for val in [12345, 1234.5, 123.45, 12.345, 1.2345, .12345, .012345, .0012345]]) ['12345', '1234', '123', '12', '1.2', '0.12', '0.012', '1.2e-3']
remove ../ and ./ and leading/trailing blanks and path separators from input string name and replace any remaining path separator with '/'
remove ../ and ./ and leading/trailing blanks and path separators from input string name, replace any remaining path separator with '/', and keep only the last part of the path