xmcd_projection.mesh_visualisation

class xmcd_projection.mesh_visualisation.MeshVisualizer(struct, projected_struct, projected_xmcd=None, struct_colors=None)

Bases: xmcd_projection.mesh_visualisation.PyQtVisualizer

Object for visualising the xmcd projection

generate_view()

Generates the view data and sets the initial camera position.

get_blurred_image(sigma=4, desired_background=None)

Applies a Gaussian blur to the image to make it correspond to the actual measurements more

get_structs_center()

Gets the centre of the structure and the projected structure

Returns

Centre.

Return type

(n,3) array

update_colors(projected_xmcd, struct_colors)

Updates the colours of the xmcd and the structure. Repaints the view.

Parameters
  • projected_xmcd ((n,) array) – XMCD values of the projected structure faces.

  • struct_colors ((m,4) array) – Colurs of the structure faces.

update_xmcd_color()

Updates internally the colours of the xmcd and the background.

view_both(**kwargs)

View both the projection and the structure in the same render.

view_projection(**kwargs)

Removes the display of the structure and focuses only on the XMCD.

view_struct(**kwargs)

Removes the display of the projection and focuses only on the structure

class xmcd_projection.mesh_visualisation.NoProjectionVisualizer(struct, struct_colors=None)

Bases: xmcd_projection.mesh_visualisation.PyQtVisualizer

Object for visualising only the structure. Useful when don’t have the xmcd information and just want to see the structure magnetisation.

generate_view()

Generates the view data and sets the initial camera position.

get_structs_center()

Gets the centre of the structure.

Returns

Centre.

Return type

(n,3) array

update_colors(struct_colors)

Updates the structure colours

Parameters

struct_colors ((n,4) array) –

class xmcd_projection.mesh_visualisation.PyQtVisualizer(dist=10000, background_color=0.5)

Bases: object

Parent class for the visualizers using PyQt5.

get_image_np(size=(1024, 1024))

Gets the image in the form plottable by matplotlib

get_view_image(size=(1024, 1024))

Gets the image from the view.

save_render(filename, size=(1024, 1024))

Saves the render to filename with the givern resolution.

set_camera(ele=None, azi=None, dist=None, fov=None, center=None)

Sets the camera angle and position. Any kwag that is not passed is kept as is.

Parameters
  • ele (float, optional) – Elevation angle. Defaults to None.

  • azi (float, optional) – Azimuthal angle in deg. Defaults to None.

  • dist (float, optional) – Distance. Defaults to None.

  • fov (float, optional) – fov angle. Defaults to None.

  • center ((3,) array, optional) – Center of view location. Defaults to None.

show(**kwargs)

Show the visualization. All kwags are passed as camera parameters.

start()

Starts the display and pyqt interactivity