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_nameslist 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]
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:
confStruct

The configuration object.

log_namestr, optional

The name of the log configuration attribute in conf.

Returns:
logdict

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

sfepy.base.log.iter_names(data_names, igs=None)[source]
sfepy.base.log.plot_log(axs, log, info, xticks=None, yticks=None, xnbins=None, ynbins=None, groups=None, show_legends=True, swap_axes=False)[source]

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

Parameters:
axssequence of matplotlib.axes.Axes

The list of axes for the log data plots.

logdict

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

infodict

The log plot configuration with subplot numbers as keys.

xtickslist of arrays, optional

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

ytickslist of arrays, optional

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

xnbinslist, optional

The list of x-axis number of bins (int or None) for each subplot.

ynbinslist, optional

The list of y-axis number of bins (int or None) for each subplot.

groupslist, optional

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

show_legendsbool

If True, show legends in plots.

swap_axesbool

If True, swap the axes of the plots.

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

Read data saved by Log into a text file.

Parameters:
filenamestr

The name of a text log file.

Returns:
logdict

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

infodict

The log plot configuration with subplot numbers as keys.

sfepy.base.log.write_log(output, log, info)[source]