Tools

Tools, functions and other funny things

pymoskito.tools.get_resource(res_name, res_type='icons')[source]

Build absolute path to specified resource within the package

Parameters:
  • res_name (str) – name of the resource

  • res_type (str) – subdir

Returns:

path to resource

Return type:

str

pymoskito.tools.rotation_matrix_xyz(axis, angle, angle_dim)[source]

Compute the rotation matrix for a rotation around a given axis with the angle \varphi.

Parameters:
  • axis (str) – choose rotation axis “x”, “y” or “z”

  • angle (int or float) – rotation angle \varphi

  • angle_dim (str) – choose “deg” for degree or “rad” for radiant

Returns:

rotation matrix

Return type:

numpy.ndarray

pymoskito.tools.sort_tree(data_list, sort_key_path)[source]

Helper method for data sorting.

Takes a list of simulation results and sorts them into a tree whose index is given by the sort_key_path.

Parameters:
  • data_list (list) – List of simulation results

  • sort_key_path (list) – List of dictionary keys to sort for.

Returns:

sorted dictionary

Return type:

dict