XOutput (class)

Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Output/XOutput

class XOutput(paramexplorer_list=-1, output_list=-1, xoutput_dict=-1, nb_simu=0, xoutput_ref=None, xoutput_ref_index=None, simu=-1, path_result='', geo=-1, elec=-1, mag=-1, struct=-1, post=-1, logger_name='Pyleecan.Output', force=-1, loss=-1, init_dict=None, init_str=None)[source]

Bases: pyleecan.Classes.Output.Output

XOutput object: gather all the outputs of all the modules for multiple simulations

VERSION = 1
append(elem)

Method to behave like a list and access quickly to output_list

count(x)

Return the number of times x appears in the list.

get_param_simu(idx)

Return the list of parameter values for a specific simulation

get_paramexplorer(symbol)

Get the ParamExplorer with symbol :param symbol: ParamExplorer symbol :type symbol: str

get_pareto_index()

Return index of individuals in the pareto

Parameters

self (XOutput) –

Returns

idx_non_dom – list of index of non dominated individuals

Return type

list

get_simu(index)

Generate a simulation according to index

Parameters

index (int) – simulation index

Returns

simu – simulation generated

Return type

Simulation

get_symbol_list()

Return the list of the symobl of the DataKeeper and ParamExplorer

get_xoutput_ref()

Return the reference XOutput (or Output) either from xoutput_ref or output_list

Parameters

self (XOutput) – A XOutput object

Returns

xoutput_ref – reference XOutput (or Output) (if defined)

Return type

XOutput

insert(i, x)

Insert an item at a given position. The first argument is the index of the element before which to insert, so a.insert(0, x) inserts at the front of the list, and a.insert(len(a), x) is equivalent to a.append(x).

items()

Returns self.xoutput_dict.items to behave like a dict

keys()

Return xoutput_dict keys to behave like a dict

plot_generation(x_symbol, y_symbol, ax=None)

Plot every fitness values according to the two fitness

Parameters
  • self (XOutput) –

  • obj1 (str) – symbol of the ParamExplorer, the OptiObjective or the DataKeeper

  • obj2 (str) – symbol of the ParamExplorer, the OptiObjective or the DataKeeper

plot_multi(x_symbol, y_symbol, c_symbol=None, cmap=None, plot_type='point', idx=None, ax=None, title=None, is_show_fig=True, save_path=None, win_title=None)

Plot data from a DataKeeper for a given parameter from a ParamExplorer

x_symbol: str

ParamExplorer or DataKeeper symbol

y_symbol: str

ParamExplorer or DataKeeper symbol

c_symbol: str

optional symbol to set the plot colors

cmap: colormap

optional colormap

plot_type: str

scatter or plot to chose plot type

idx: slice

To plot only some data

ax: matplotlib.pyplot.Axe

To put the plot in a specific ax

title: str

Figure or subfigure title according to ax

is_show_figbool

True to show figure after plot

save_pathstr

full path of the png file where the figure is saved if save_path is not None

Returns

Return type

fig or ax

Raises

PlotError

plot_pareto(x_symbol, y_symbol, c_symbol=None, cmap=None, ax=None, title=None, grid=False, is_show_fig=True, save_path=None)

Plot the pareto front for 2 objective functions

Parameters
  • self (XOutput) –

  • x_symbol (str) – symbol of the first objective function

  • y_symbol (str) – symbol of the second objective function

  • c_symbol (str) – optional symbol to set the plot colors

  • cmap (colormap) – optional colormap

  • is_show_fig (bool) – True to show figure after plot

  • save_path (str) – full path of the png file where the figure is saved if save_path is not None

pop(i)

Remove the item at the given position in the list, and return it. If no index is specified, a.pop() removes and returns the last item in the list.

print_memory(tab_level=0, detail_level=1, is_print=True)

Print an estimation of the memory usage for each property of the object

Parameters
  • self (XOutput) – An XOutput object

  • tab_level (int) – Number of tab (” “) to add before each line

  • detail_level (int) – Select how many data to display (0: only object size, 1: object + properties, 2:object + detailed properties)

  • is_print (bool) – True print, else return str

Returns

mem_str – if is_print == False, return the string that descibe the memory usage of the object

Return type

str

remove(x)

Remove the first item from the list whose value is equal to x. It raises a ValueError if there is no such item.

save(save_path='', is_folder=False)

Save the object to the save_path

Parameters
  • self – A pyleecan object

  • save_path (str) – path to the folder to save the object

  • is_folder (bool) – to split the object in different files: separate simulation machine and materials

copy(**kwargs)

Return a copy of the class

get_logger()

Get the object logger or its parent’s one

Parameters

obj – A pyleecan object

Returns

logger – Pyleecan object dedicated logger

Return type

logging.Logger

compare(other, name='self')[source]

Compare two objects and return list of differences

as_dict(**kwargs)[source]

Convert this object in a json serializable dict (can be use in __init__). Optional keyword input parameter is for internal use only and may prevent json serializability.

property paramexplorer_list

List containing ParamExplorer

Type

[ParamExplorer]

property output_list

List containing Output (or Xoutput) for each simulation

Type

[Output]

property xoutput_dict

Dictionnary containing DataKeeper

Type

{DataKeeper}

property nb_simu

Number of simulations excluding reference simulation

Type

int

Min

0

property xoutput_ref

Xoutput (or Output) of the reference simulation (only if is_keep_all_output is True and not included in output_list)

Type

Output

property xoutput_ref_index

Index of the Xoutput (or Output) of the reference simulation in the output_list (only if is_keep_all_output is True)

Type

int