GUI functionality

Adding atoms using GUI

For most cases the majority of the atoms is found with automatic peak finding using get_feature_separation() and get_atom_positions(). However, for some datasets there might be either missing or extra atoms. These can be added or removed using add_atoms_with_gui(). This function opens up a window showing the datasets, where atoms can be added or removed by clicking on them with the mouse pointer.

>>> %matplotlib nbagg 
>>> s = am.dummy_data.get_distorted_cubic_signal()
>>> atom_positions = am.get_atom_positions(s, 25)
>>> atom_positions_new = am.add_atoms_with_gui(s, atom_positions)

After having added or removed the atoms, atom_positions_new is used to make a sublattice object:

>>> sublattice = am.Sublattice(atom_positions_new, s)

add_atoms_with_gui() can also be used without any initial atoms:

>>> atom_positions = am.add_atoms_with_gui(s)

If the atoms in the dataset are too close together, distance_threshold is used to decrease the distance for removing an atom.

>>> atom_positions = am.add_atoms_with_gui(s, distance_threshold=2)

Toggle atom refine

To disable position refining or fitting of atoms in a sublattice, use toggle_atom_refine_position_with_gui():

>>> %matplotlib qt 
>>> sublattice = am.dummy_data.get_distorted_cubic_sublattice()
>>> sublattice.toggle_atom_refine_position_with_gui()

Use the left mouse button to toggle refinement of the atom positions. Green: refinement. Red: not refinement.


This can also be set directly through the refine_position property in the Atom_Position objects.

>>> sublattice.atom_list[5].refine_position = False