sfepy.base.log module

class sfepy.base.log.Log(data_names=None, plot_kwargs=None, xlabels=None, ylabels=None, yscales=None, show_legends=True, is_plot=True, aggregate=100, sleep=1.0, log_filename=None, formats=None)[source]

Log data and (optionally) plot them in the second process via LogPlotter.

add_group(names, plot_kwargs=None, yscale=None, xlabel=None, ylabel=None, formats=None)[source]

Add a new data group. Notify the plotting process if it is already running.

count = -1
static from_conf(conf, data_names)[source]
Parameters:
data_names : list of lists of str

The data names grouped by subplots: [[name1, name2, …], [name3, name4, …], …], where name<n> are strings to display in (sub)plot legends.

get_log_name()[source]
iter_names(igs=None)[source]
plot_data(igs)[source]
plot_vlines(igs=None, **kwargs)[source]

Plot vertical lines in axes given by igs at current x locations to mark some events.

terminate()[source]
sfepy.base.log.get_logging_conf(conf, log_name=’log’)[source]

Check for a log configuration (‘log’ attribute by default) in conf. Supply default values if necessary.

Parameters:
conf : Struct

The configuration object.

log_name : str, optional

The name of the log configuration attribute in conf.

Returns:
log : dict

The dictionary {‘plot’ : <figure_file>, ‘text’ : <text_log_file>}. One or both values can be None.

sfepy.base.log.name_to_key(name, ii)[source]
sfepy.base.log.plot_log(axs, log, info, xticks=None, yticks=None, groups=None, show_legends=True)[source]

Plot log data returned by read_log() into a specified figure.

Parameters:
axs : sequence of matplotlib.axes.Axes

The list of axes for the log data plots.

log : dict

The log with data names as keys and (xs, ys, vlines) as values.

info : dict

The log plot configuration with subplot numbers as keys.

xticks : list of arrays, optional

The list of x-axis ticks (array or None) for each subplot.

yticks : list of arrays, optional

The list of y-axis ticks (array or None) for each subplot.

groups : list, optional

The list of data groups subplots. If not given, all groups are plotted.

show_legends : bool

If True, show legends in plots.

sfepy.base.log.read_log(filename)[source]

Read data saved by Log into a text file.

Parameters:
filename : str

The name of a text log file.

Returns:
log : dict

The log with data names as keys and (xs, ys, vlines) as values.

info : dict

The log plot configuration with subplot numbers as keys.