This module is an attempt for a global configuration file for various parameters.
The import of this module changes default settings (attributes) of other modules. This works, because each module has only one instance.
Before this module is imported somewhere, modules use their default settings.
This file could be dynamically modified and reloaded.
See also genericsettings which is a central place to define settings
used by other modules, but does not modify settings of other modules.
| Function | config |
called from a high level, e.g. rungeneric, to configure the lower level modules via modifying parameter settings. |
| Function | config |
configure genericsettings.line_styles for a parameter sweet |
| Function | config |
manage target values setting in "expensive" optimization scenario. |
| Function | main |
Undocumented |
| Function | map |
helper function for config_line_styles. |
| Function | sorted |
use the sorting of names up until and including a float to rearrange styles. |
| Variable | gs |
Undocumented |
| Variable | gs |
Undocumented |
| Function | _index |
return the first index after the first subsequence indicating a float |
| Function | _str |
return a color iterator from a string like 'plasma.1.8' |
called from a high level, e.g. rungeneric, to configure the lower level modules via modifying parameter settings.
configure genericsettings.line_styles for a parameter sweet
if parameter_sweep is given on input. The colormap and range can be changed via the --parameter_sweep_colormaps= value. The default value is 'plasma.0.9', viable alternatives are 'viridis' or 'gnuplot2.0.85' or a comma separated joined sequence of any of these, same color sweeps are 'Greens_r..7', 'Greys_r..7', 'Reds_r..7'.
The sorting of the input arguments up to and including a float value in the name determines the positioning in the color map.
Minor: The line_style_mapping attribute of genericsettings can be
used to chose the marker and line style like {input_position:
position_in_original_line_styles}. When input_position is not
present, the usual marker line style combination is used matching
input_position.
TODO: we may want to keep the original symbol colors?
TODO: config_line_styles fails when filenames do not contain a float,
probably due to the _index_after_float computation in
map_indices_to_line_styles or sorted_line_styles.
helper function for config_line_styles.
Map each index of names to the index of the first appearance of the
name, where equality of names is determined starting from after a float
number (which represents a parameter value) using _index_after_float.
use the sorting of names up until and including a float to rearrange styles.
This assumes that the names[indices] correspond to styles[indices] and that styles[indices] (colormap) are in increasing order on input. On output, sorted_styles are in increasing order w.r.t. the sorting of names[indices].
return the first index after the first subsequence indicating a float
in name. The subsequence must contain either '.' or e (the latter
cannot be trailing as part of the float). In particular, .1, -.2,
1.23, -2e0 or 1.2e-3 are identified as a float.
If return_first_digit_index, the index of the first digit is returned
instead of the first index after the float.
>>> import cocopp >>> floats = ['.1', '-.2', '1.23', '-2e0', '1.2e-3', 'a', 'bb'] >>> for i, f in enumerate(floats): ... print(cocopp.config._index_after_float(i * 's' + f + (i + 2) * 'b', True), ... cocopp.config._index_after_float(i * 's' + f + 1 * i * 'b')) 0 2 1 4 2 6 3 7 4 10 -1 0 -1 0