Output (class)

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

class Output(simu=-1, path_result='', geo=-1, elec=-1, mag=-1, struct=-1, post=-1, logger_name='Pyleecan.Output', force=-1, init_dict=None, init_str=None)[source]

Bases: pyleecan.Classes._frozen.FrozenClass

Main Output object: gather all the outputs of all the modules

VERSION = 1
get_angle_offset_initial()

Return the difference between the d axis angle of the stator and the rotor

Parameters

self (Output) – an Output object

Returns

angle_offset_initial – difference between the d axis angle of the stator and the rotor [rad]

Return type

float

get_angle_rotor()

Return the angular position of the rotor as a function of time and set the Output.elec.angle_rotor attribute if it is None

Parameters

self (Output) – an Output object

Returns

alpha_rotor – angular position of the rotor as a function of time (vector) [rad]

Return type

numpy.ndarray

get_BH_rotor()

Return the B(H) curve of the rotor material

Parameters

self (Output) – an Output object

Returns

BH – B(H) values (two colums matrix: H and B(H))

Return type

numpy.ndarray

get_BH_stator()

Return the B(H) curve of the stator material

Parameters

self (Output) – an Output object

Returns

BH – B(H) values (two colums matrix: H and B(H))

Return type

numpy.ndarray

get_path_result()

Return the path to the result folder. If there is a name for the simulation, the path leads to a sub-folder of ‘Results’ folder which has the same name. If this sub-folder does not exist, it creates it.

Parameters

self (Output) – an Output object

Returns

res_path – path to the result folder

Return type

str

get_machine_periodicity()

Return / Compute the (anti)-periodicities of the machine in time and space domain

Parameters

self (Output) – An Output object

Returns

  • per_a (int) – Number of space periodicities of the machine

  • is_antisym_a (bool) – True if an anti-periodicity is possible after the space periodicities

  • per_t (int) – Number of time periodicities of the machine

  • is_antisym_t (bool) – True if an anti-periodicity is possible after the time periodicities

get_rot_dir()

Return the rotation direction of the magnetic field fundamental WARNING: rot_dir = -1 to have positive rotor rotating direction, i.e. rotor position moves towards positive angle

Parameters

self (Output) – an Output object

Returns

rot_dir – Rotation direction of magnetic field fundamental

Return type

int

plot_2D_Data(Data_str, *arg_list, is_norm=False, unit='SI', data_list=[], component_list=None, legend_list=[], color_list=[], save_path=None, x_min=None, x_max=None, y_min=None, y_max=None, is_logscale_x=False, is_logscale_y=False, is_disp_title=True, is_grid=True, is_auto_ticks=True, fig=None, ax=None, barwidth=100, type_plot=None, fund_harm_dict=None, is_show_fig=None)

Plots a field as a function of time

Parameters
  • self (Output) – an Output object

  • Data_str (str) – name of the Data Object to plot (e.g. “mag.Br”)

  • *arg_list (list of str) – arguments to specify which axes to plot

  • is_norm (bool) – boolean indicating if the field must be normalized

  • unit (str) – unit in which to plot the field

  • data_list (list) – list of Data objects to compare

  • component_list (list) – list of component names to plot in separate figures

  • legend_list (list) – list of legends to use for each Data object (including reference one) instead of data.name

  • color_list (list) – list of colors to use for each Data object

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

  • x_min (float) – minimum value for the x-axis

  • x_max (float) – maximum value for the x-axis

  • y_min (float) – minimum value for the y-axis

  • y_max (float) – maximum value for the y-axis

  • is_logscale_x (bool) – boolean indicating if the x-axis must be set in logarithmic scale

  • is_logscale_y (bool) – boolean indicating if the y-axis must be set in logarithmic scale

  • is_disp_title (bool) – boolean indicating if the title must be displayed

  • is_grid (bool) – boolean indicating if the grid must be displayed

  • is_auto_ticks (bool) – in fft, adjust ticks to freqs (deactivate if too close)

  • fig (Matplotlib.figure.Figure) – existing figure to use if None create a new one

  • ax (Matplotlib.axes.Axes object) – ax on which to plot the data

  • barwidth (float) – barwidth scaling factor, only if type_plot = “bargraph”

  • type_plot (str) – type of 2D graph : “curve”, “bargraph”, “barchart” or “quiver”

  • fund_harm_dict (dict) – Dict containing axis name as key and frequency/order/wavenumber of fundamental harmonic as value to display fundamental harmonic in red in the fft

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

get_fund_harm(data)

Return the fundamental harmonic of the physical quantity in the data object

Parameters
  • self (Output) – an Output object

  • data (Data) – a Data object

Returns

fund_harm – Dict containing axis name as key and frequency/order/wavenumber of fundamental harmonic as value

Return type

dict

plot_A_quiver_2D(Data_str, t=None, t_index=0, is_norm=False, unit='SI', is_show_fig=None, save_path=None, fig=None, ax=None)

Plots a field as a function of space (angle)

Parameters
  • self (Output) – an Output object

  • Data_str (str) – name of the Data object to plot (e.g. “mag.Br”)

  • t (float) – time value at which to slice

  • t_index (int) – time index at which to slice

  • is_norm (bool) – boolean indicating if the field must be normalized

  • unit (str) – unit in which to plot the field

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

  • save_path (str) – full path including folder, name and extension of the file to save if save_path is not None

  • fig (Matplotlib.figure.Figure) – existing figure to use if None create a new one

  • ax (Matplotlib.axes.Axes object) – ax on which to plot the data

plot_3D_Data(Data_str, *arg_list, component_list=None, is_norm=False, unit='SI', save_path=None, x_min=None, x_max=None, y_min=None, y_max=None, z_min=None, z_max=None, is_auto_ticks=True, is_2D_view=False, N_stem=100, fig=None, ax=None, is_show_fig=None)

Plots a field as a function of time

Parameters
  • self (Output) – an Output object

  • Data_str (str) – name of the Data Object to plot (e.g. “mag.Br”)

  • *arg_list (list of str) – arguments to specify which axes to plot

  • is_norm (bool) – boolean indicating if the field must be normalized

  • unit (str) – unit in which to plot the field

  • save_path (str) – full path including folder, name and extension of the file to save if save_path is not None

  • x_min (float) – minimum value for the x-axis

  • x_max (float) – maximum value for the x-axis

  • y_min (float) – minimum value for the y-axis

  • y_max (float) – maximum value for the y-axis

  • z_min (float) – minimum value for the z-axis

  • z_max (float) – maximum value for the z-axis

  • is_auto_ticks (bool) – in fft, adjust ticks to freqs (deactivate if too close)

  • is_2D_view (bool) – True to plot Data in xy plane and put z as colormap

  • N_stem (int) – number of harmonics to plot (only for stem plots)

  • fig (Matplotlib.figure.Figure) – existing figure to use if None create a new one

  • ax (Matplotlib.axes.Axes object) – ax on which to plot the data

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

plot_A_time_space(Data_str, is_deg=True, is_elecorder=False, is_spaceorder=False, freq_max=20000, r_max=100, z_max=None, is_norm=False, unit='SI', save_path=None, is_auto_ticks=True, component_list=None, is_show_fig=None)

Plots a field as a function of time and space (angle)

Parameters
  • self (Output) – an Output object

  • Data_str (str) – name of the Data Object to plot (e.g. “mag.Br”)

  • is_deg (bool) – boolean indicating if the angle must be converted to degrees

  • is_elecorder (bool) – boolean indicating if we want to use the electrical order for the fft axis

  • is_spaceorder (bool) – boolean indicating if we want to use the spatial order for the fft axis

  • freq_max (float) – maximum value of the frequency for the fft axis

  • r_max (int) – maximum value of the wavenumber for the fft axis

  • z_max (float) – maximum value for the field

  • is_norm (bool) – boolean indicating if the field must be normalized

  • unit (str) – unit in which to plot the field

  • colormap (colormap object) – colormap prescribed by user

  • save_path (str) – full path including folder, name and extension of the file to save if save_path is not None

  • is_auto_ticks (bool) – in fft, adjust ticks to freqs and wavenumbers (deactivate if too close)

  • component_list (list) – list of component names to plot in separate figures

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

get_data_from_str(data_str)

Return the data object corresponding to the data str

Parameters
  • self (Output) – an Output object

  • data_str (string) – a string corresponding to a data object

Returns

data – a Data object

Return type

Data

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()

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

as_dict()[source]

Convert this object in a json seriable dict (can be use in __init__)

property simu

Simulation object that generated the Output

Type

Simulation

property path_result

Path to the folder to same the results

Type

str

property geo

Geometry output

Type

OutGeo

property elec

Electrical module output

Type

OutElec

property mag

Magnetic module output

Type

OutMag

property struct

Structural module output

Type

OutStruct

property post

Post-Processing settings

Type

OutPost

property logger_name

Name of the logger to use

Type

str

property force

Force module output

Type

OutForce