full_box,files_w = get_files_gui(theme_colors=light_colors,height=400)
va = VasprunApp()
# va.set_options(cache_data = False, mode= 'markers')
# va.show()
va.set_theme_colors({'next_bg': 'whitesmoke',
'hover_bg': 'skyblue',
'accent': 'black',
'main_bg': 'white',
'main_fg': 'black'})
App Attributes
Note: If you used pivotpy.sio.get_kpath for generating KPOINTS file, your kticks will be automatically filled. If not, you can still add this example string at end of first line of first KPOINTS file with your own values, (not required in all KPOINST files, one time fill is enough if whole project is based on same kpath) [Do not modify names of variables!].
HSK-INDS = [0, 29, -1], LABELS = ['M', 'Γ|M', 'L'], SEG-INDS = [21, 29]
va = VasprunApp()
va.input # is dictionary which is unpacked in plot arguments.
va.result # is what you see in table.
va.fig # is current figure.
va.set_options(
cache_data = False, #Turn off cache globally.
mode = 'bands', #Change graph mode from 'markers' to 'bands'. Setting it to'lines' is not recommended in live graph, it could hang all UI.
interp_nk = dict(n = 2, k = 2), #Add 2 points between data points withquadratic interpolation.
**kwargs
)
va.iplot # and
va.splot # give current figure(detached) and its matplotlib figure respectively. Their `kwargs` correspond to current figure's command e.g if `Bands` figure is there, `kwargs` are passed to `iplot_rgb_lines` for `va.iplot` and to `splot_rgb_lines` for `va.splot`.
Almost every other attribute is a gui or collection of widgets. E.g. va.dds
is dictionary that contains all dropdowns in app. Make sure to not change any key in any dictionary, if done by mistake use, dictionary.pop(key,None)
.
Edit Custom Theme
You can set va.set_theme_colors(<va.theme_colors after edit>)
and then apply Custom
from theme dropdown to display theme of your choice. Used CSS-compatible color values only.
Extend Functionality (Example: Save Matplotlib's figure on clicking Update/Latest Graph
)
You can extend app as you choose, see how it saves a figure on button(within app) click.
import pivotpy as pp
import ipywidgets as ipw, os
va = pp.VasprunApp()
va.show()
#Create Additional Functionality
out = ipw.Output()
@out.capture(clear_output=True, wait=True)
def update_mpl(change):
if change:
va.splot(colorbar=False)
path = os.path.join(os.path.dirname(va.path),'mpl_plot.png')
pp.savefig(path,transparent=True,dpi=600) #Prevents overwiting existing files
pp._show()
print(va.data.sys_info.incar)
va.buttons['load_graph'].on_click(update_mpl)
out
#ka.show()
Interactive Rich Slides in Jupyter Notebook
Navigate to ipyslides or do pip install ipyslides
to create beautiful data driven presentation in Jupyter Notebook.