Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

limits keyword does not work for DOS plots #57

Closed
MRedies opened this issue Jul 4, 2021 · 5 comments
Closed

limits keyword does not work for DOS plots #57

MRedies opened this issue Jul 4, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@MRedies
Copy link
Contributor

MRedies commented Jul 4, 2021

Following the docu I tried to do this:
image

#Read in data
with HDF5Reader("PBE/kpts=0003/DOS/banddos.hdf") as h5reader:
   data, attributes = h5reader.read(recipe=FleurDOS)

#Plot the data
#Notice that you get the axis object of this plot is returned
#if you want to make any special additions
ax = plot_fleur_dos(data, attributes, multiply_by_equiv_atoms=True, linewidth=1.5, limits={'x': (-5,5)})

The linewidth one works, but the limits one returns:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-11-09c6c8132087> in <module>
      6 #Notice that you get the axis object of this plot is returned
      7 #if you want to make any special additions
----> 8 ax = plot_fleur_dos(data, attributes, multiply_by_equiv_atoms=True, linewidth=1.5, limits={'x': (-5,5)})

~/.local/lib/python3.8/site-packages/masci_tools/vis/fleur.py in plot_fleur_dos(dosdata, attributes, spinpol, bokeh_plot, multiply_by_equiv_atoms, plot_keys, show_total, show_interstitial, show_sym, show_atoms, show_lresolved, key_mask, **kwargs)
    364     legend_labels, keys = np.array(legend_labels)[key_mask].tolist(), np.array(keys)[key_mask].tolist()
    365 
--> 366     kwargs = _process_dos_kwargs(keys, **kwargs)
    367 
    368     if bokeh_plot:

~/.local/lib/python3.8/site-packages/masci_tools/vis/fleur.py in _process_dos_kwargs(ordered_keys, **kwargs)
    404                         new_dict[ordered_keys.index(plot_label)] = new_dict.pop(plot_label)
    405                     else:
--> 406                         raise ValueError(f'The label {plot_label} is not a valid label for the current plot')
    407             kwargs[key] = new_dict
    408     return kwargs

ValueError: The label x is not a valid label for the current plot

@MRedies
Copy link
Contributor Author

MRedies commented Jul 4, 2021

Also notice that the appostrophies around x are wrong in the docu. They seem to be correct in the comment of the source, but by the time they arrive on readthedocs they are not 'x', but ‘x’, which makes copied stuff wrong.

This might be a problem for newer users.

@MRedies MRedies added the bug Something isn't working label Jul 4, 2021
@janssenhenning
Copy link
Contributor

janssenhenning commented Jul 5, 2021

@MRedies The documentation is now fixed. All the dictionaries in the table are now put into literal blocks to avoid this character change.
I will prepare a bugfix release for the limits keyword shortly

@janssenhenning
Copy link
Contributor

@MRedies This is fixed with the newest pypi release.

@MRedies
Copy link
Contributor Author

MRedies commented Jul 5, 2021

Thank you, Hennig. I already feel bad about creating too many issues. I actually really like the masci tools

@janssenhenning
Copy link
Contributor

@MRedies That's no problem and I'm happy about all reported issues (otherwise I only fix the stuff I stumble upon :D). I'm aware that the test coverage in the plotting methods is still lacking so these kind of errors can easily happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants