roxieapi.output.parser module

class roxieapi.output.parser.CoilGeomDfs(conductors: pandas.core.frame.DataFrame, strands: pandas.core.frame.DataFrame)[source]

Bases: object

conductors: DataFrame
strands: DataFrame
class roxieapi.output.parser.EddyCurrentsData(xroot)[source]

Bases: object

Data for eddy currents calculations for every time_step

get_eddy_currents_all_timesteps() DataFrame[source]

Retrieve eddy currents data for all time steps and store it in a pandas DataFrame.

Returns:

A DataFrame containing eddy currents data for all time steps. The columns are: - time_step: index of the time step - node: node number - elem: element number - jx: x component of the current density - jy: y component of the current density - jz: z component of the current density - j2/sigma: squared current density divided by the conductivity If no data exists, returns an empty DataFrame with the above columns.

Return type:

pd.DataFrame

get_eddy_currents_on_timestep(time_step_index=0) DataFrame[source]

Parse the eddy currents data from a specific time_step in the post.xml file.

Parameters:

time_step_index (int, optional) – The index of the <time_step> element from which to retrieve the <eddy_currents_data>. Defaults to 0, which is the first time_step.

Returns:

A DataFrame with the eddy currents data. The columns are - node: node number - elem: element number - jx: x component of the current density - jy: y component of the current density - jz: z component of the current density - j2/sigma: squared current density divided by the conductivity

Return type:

pd.DataFrame

get_elements() DataFrame[source]

Parse the <elements> data to extract details for each element.

Returns:

A DataFrame with columns: - ele_num: Element number - hmo_ele: HMO element - ele_type: Element type - ele_collector: Element collector - nodes: List of node numbers (up to max_nodes)

Return type:

pd.DataFrame

get_elements_info() dict[source]

Parse the <element_data> line to extract tot_ele and max_nodes.

Returns:

A dictionary containing: - “tot_ele” (int): The total number of elements. - “max_nodes” (int): The maximum number of nodes.

Return type:

dict

get_info_on_timestep(time_step_index: int) dict[source]

Parse the information for the specified <time_step> to extract step_number and absolute_time.

Parameters:

time_step_index (int) – The index of the <time_step> element to parse.

Returns:

A dictionary containing: - “step_number” (int): The time step number. - “absolute_time” (float): The absolute time for the present time step.

Return type:

dict

get_iron_nodal_data_info() dict[source]

Parse the <iron_nodal_data> line to extract tot_nodes, nodf, and dim.

Returns:

A dictionary containing: - “tot_nodes” (int): Total number of nodes. - “nodf” (int): Number of degrees of freedom. - “dim” (int): Dimensionality of the nodes.

Return type:

dict

get_magnetic_field_all_timesteps() DataFrame[source]

Retrieve magnetic field data for all time steps and store it in a pandas DataFrame.

Returns:

A DataFrame containing magnetic field data for all time steps. The columns are: - time_step: index of the time step - node: node number - elem: element number - Hx: x component of the magnetic field - Hy: y component of the magnetic field - Hz: z component of the magnetic field If no data exists, returns an empty DataFrame with the above columns.

Return type:

pd.DataFrame

get_magnetic_field_on_timestep(time_step_index: int) DataFrame[source]

Parse the magnetic field data from a specific time_step in the post.xml file.

Parameters:

time_step_index (int) – The index of the <time_step> element from which to retrieve the <magnetic_field_data>.

Returns:

A DataFrame with the magnetic field data. The columns are - node: node number - elem: element number - Hx: x component of the magnetic field - Hy: y component of the magnetic field - Hz: z component of the magnetic field

Return type:

pd.DataFrame

get_magnetic_induction_all_timesteps() DataFrame[source]

Retrieve magnetic induction data for all time steps and store it in a pandas DataFrame.

Returns:

A DataFrame containing magnetic induction data for all time steps. The columns are: - time_step: index of the time step - node: node number - elem: element number - Bx: x component of the magnetic induction - By: y component of the magnetic induction - Bz: z component of the magnetic induction If no data exists, returns an empty DataFrame with the above columns.

Return type:

pd.DataFrame

get_magnetic_induction_on_timestep(time_step_index: int) DataFrame[source]

Parse the magnetic induction data from a specific time_step in the post.xml file.

Parameters:

time_step_index (int) – The index of the <time_step> element from which to retrieve the <magnetic_induction_data>.

Returns:

A DataFrame with the magnetic induction data. The columns are - node: node number - elem: element number - Bx: x component of the magnetic induction - By: y component of the magnetic induction - Bz: z component of the magnetic induction

Return type:

pd.DataFrame

get_mesh_elements() DataFrame | None[source]

Extract mesh elements from the XML root element and return them as a pandas DataFrame.

Returns:

A DataFrame with mesh elements. Returns None if the “elements” tag is not found.

Return type:

Optional[pd.DataFrame]

get_nodal_coords() ndarray | None[source]

Extract node data from the XML root element and return it as a NumPy array.

Returns:

A NumPy array of node data. Returns None if the “nodes” tag is not found.

Return type:

Optional[np.ndarray]

get_potential_all_timesteps() DataFrame[source]

Retrieve potential data for all time steps and store it in a pandas DataFrame.

Returns:

A DataFrame containing potential data for all time steps. The columns are: - time_step: index of the time step - node: node number - az: potential value - norm_deriv_az: normalized derivative of az If no data exists, returns an empty DataFrame with the above columns.

Return type:

pd.DataFrame

get_potential_on_timestep(time_step_index: int) DataFrame[source]

Parse the potential data from a specific time_step in the post.xml file.

Parameters:

time_step_index (int) – The index of the <time_step> element from which to retrieve the <potential_data>.

Returns:

A DataFrame with the potential data. The columns are - node: node number - az: potential value - norm_deriv_az: normalized derivative of az

Return type:

pd.DataFrame

get_time_step_count() int[source]

Get the number of <time_step> elements in the XML file.

Returns:

The number of <time_step> elements found.

Return type:

int

parse_nodal_coord_info() DataFrame[source]

Parse the <nodal_coord> data to extract details for each node.

Returns:

A DataFrame with columns: - node_num: Node number - hmo_node: HMO node - x: X coordinate - y: Y coordinate - z: Z coordinate - frame: Frame value - bound: Boundary condition - nodf: Degrees of freedom

Return type:

pd.DataFrame

class roxieapi.output.parser.EddyStepData(id: int, time: float)[source]

Bases: object

Data of an eddy time step

property eddyCurrentsData: DataFrame

Read-only - retrieve the eddy currents data for the eddy time step

Returns:

DataFrame with the eddy currents data

Return type:

pd.DataFrame

property id: int

Read-only - retrieve the index of the eddy time step

Returns:

index of the eddy time step

Return type:

int

property magneticFieldData: DataFrame

Read-only - retrieve the magnetic field data for the eddy time step

Returns:

DataFrame with the magnetic field data

Return type:

pd.DataFrame

property magneticInductionData: DataFrame

Read-only - retrieve the magnetic induction data for the eddy time step

Returns:

DataFrame with the magnetic induction data

Return type:

pd.DataFrame

property meshData: DataFrame

Read-only - Retrieve the iron mesh data for the eddy time step, which includes the potential data, magnetic induction data, eddy currents data, and magnetic field data for the coresponding eddy step.

TODO: This should already be cleaned in the xml file

Returns:

DataFrame with the potential data

Return type:

pd.DataFrame

property potentialData: DataFrame

Read-only - retrieve the potential data for the eddy time step

Returns:

DataFrame with the potential data

Return type:

pd.DataFrame

property time: float

Read-only - retrieve the time at which the eddy time step is defined

Returns:

time at which the eddy time step is defined

Return type:

float

class roxieapi.output.parser.MeshGeomDfs(nodes: pandas.core.frame.DataFrame, elements: pandas.core.frame.DataFrame, boundaries: pandas.core.frame.DataFrame)[source]

Bases: object

boundaries: DataFrame
elements: DataFrame
nodes: DataFrame
class roxieapi.output.parser.OptData(id: int, name: str)[source]

Bases: object

Data Of an optimization Step

property blockGeometries3D: Dict[int, BlockGeometry]
property blockTopologies: Dict[int, BlockTopology]

Get block topologies

property brickGeometries3D: Dict[int, Brick3DGeometry]
property coilGeometries: Dict[int, CoilGeometry]
property coilGeometries3D: Dict[int, Coil3DGeometry]
property meshGeometries: Geometry | None
property meshGeometries3D: Geometry | None
property transient_steps_number: int

Read-only - retrieve the number of transient steps associated with this optimization step.

property wedgeGeometries3D: Dict[int, WedgeGeometry]
class roxieapi.output.parser.RoxieOutputParser(xml_file: str)[source]

Bases: object

Roxie output parser class.

Takes all different Roxie outputs, parses them, and provides a structured output of the results.

find_eddystep(opt_step: int, trans_step: int, eddy_step: int | None) EddyStepData | None[source]

Find the eddy step data for a given optimization step and transient step

Parameters:
  • opt_step – The optimization step number

  • trans_step – The transient step number

  • eddy_step – The eddy step number

Returns:

The EddyStep object or None if not found

find_optstep(opt_step) OptData | None[source]

Find the optimization step data for a given optimization step

Parameters:

opt_step – The optimization step number

Returns:

The OptData object or None if not found

find_transstep(opt_step: int, trans_step: int) TransStepData | None[source]

Find the transient step data for a given optimization step and transient step

Parameters:
  • opt_step – The optimization step number

  • trans_step – The transient step number

Returns:

The TransStepData object or None if not found

get_3d_plot(plot_nr: int = 1) Plot3D | None[source]

Return the 3D plot with number i :param plon_nr: The plot number, defaults to 1 :return: The Plot3D definition, or None

get_conductor_forces(opt_step: int = 1, trans_step: int = 1) DataFrame | None[source]

Return Conductor forces for given Step, or None if not present

Parameters:
  • opt_step – The Optimization step, defaults to 1

  • trans_step – Transient step, defaults to 1

Returns:

The Conductor forces as Dataframe

get_crosssection_plot(plot_nr: int = 1) Plot2D | None[source]

Return the Crossection 2D plot with number i

Parameters:

plot_nr – The plot_number, defaults to 1

Returns:

The Plot2D object, or None

get_harmonic_coil(coil_nr: int = 1, opt_step: int = 1, trans_step: int = 1) HarmonicCoil | None[source]

Return the harmonic coil for given step and coil id, or None if not present

Parameters:
  • coil_nr – Harmonic Coil Nr, defaults to 1

  • opt_step – The Optimization Step Nr, defaults to 1

  • trans_step – The Transient Step Nr, defaults to 1

Returns:

The Harmonic coil, or None

class roxieapi.output.parser.TransStepData(id: int, name: str)[source]

Bases: object

Data of a transient step

property eddyTimeSteps: Dict[int, EddyStepData]

Read-only - retrieve the dictionary of eddy time steps associated with this transient step.

Returns:

A dictionary where keys are the step indices and values are EddyStepData objects representing the data for each eddy_time_step.

Return type:

Dict[int, EddyStepData]

property eddy_steps_number: int

Read-only - retrieve the number of eddy time steps associated with this transient step.

property id: int

Read-only - retrieve the unique identifier of this transient step.

property name: str

Read-only - retrieve the name of this transient step.