versatile shortcuts for quick typing in an (i)python shell,
or even using from cma.s import * in interactive sessions.
Provides various aliases from within the cma package, to be reached like
cma.s....
Do not use this module for stable code developments!
This may not be actively maintained.
| Class | CMAES |
Undocumented |
| Function | better |
l, u are the plt.axis('tight') limits, return new limits. |
| Function | clean |
Deprecated, renamed to ddir |
| Function | ddir |
return "public" elements of a list or dict or of object.__dict__. |
| Function | figpolish |
set better matplotlib figure default values |
| Function | figshow |
pyplot.show to make a plotted figure show up |
| Function | formated |
return $10^{{-3}}$, $0.01$,...,$1000$, $10^{{4}}$... |
| Function | grid |
arguments are passed to matplotlib.pyplot.grid |
| Function | log |
return positions, labels for plt.gca().set_?ticks with log-log plots. |
| Variable | log |
candidate tick label positions [times 10^i] |
| Variable | log |
minimal number of tick labels |
| Function | _cdict |
return public attributes of obj as a dict. |
l, u are the plt.axis('tight') limits, return new limits.
This is a quick hack to compute tight-ish plot limits that do not cover up any extreme lines or symbols.
return "public" elements of a list or dict or of object.__dict__.
Ignore entries starting with exclude. Return a 'list` when obj
is a list or a dict, return a dict otherwise. This is versatile
and could change in future.
Typical usage: clean(dir()) or clean(obj) or clean(dir(), '__').
set better matplotlib figure default values
for scrutinizing data, in particular grid and clip_on.
Set the axis limits, such that regression or grid lines plotted _after_
calling figpolish conveniently do not change the displayed area.
Accepts the following kw-arguments:
axis: str='tight-ish' where 'image', 'scaled' or 'square' are other notable values which all lead to equal scaling, True, 'auto', 'tight' are further alternatives, see help(plt.axis).
clip_on: bool=False do not clip lines outside of the frame, lines
after calling figpolish are still clipped
frame: bool=True show frame (default in matplotlib)
grid: dict={'visible': True, 'which': 'both'}
legend: dict={} works for setting a legend title
patch: float=3 is the relative width between data and frame in percent. This is not a matplotlib parameter and ignored when 'axis' is given.
return positions, labels for plt.gca().set_?ticks with log-log plots.
l and u are the axis limits, *plt.?lim(), tick labels are chosen
based on log_tick_labels_candidates and log_tick_labels_number.
Example:
if plt.gca().get_xscale() == 'log':
plt.gca().set_xticks(*log_tick_labels(*plt.xlim()))
Details: (1,2,4,6) leaves three empty lines 7-9, hence (1,2,5,7) seems preferable where also the smallest factors 7/5 and 10/7 are close to sqrt(2) and >=1.4 while 6/4=1.33 is smaller.