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

🐛 FIX: BandsData matplotlib with NaN values #5024

Merged

Conversation

PhilippRue
Copy link
Contributor

The BandsData supports using numpy.NaN values in the bands array which can be used to remove some parts of the bands or to fill up parts which might be out of a certain energy window.

The matplotlib plotting functionality (BandsData.show_mpl()) however does not work with NaN values when the limits for the plot are found.

With nanmin and nanmax instead of the simple min/max ignores NaN values in the bands array and makes the matplotlib plotter work for incomplete bands.

Using `nanmin` and `nanmax` instead of the simple `min/max` ignores NaN values in the bands array and makes the matploblib plotter work for incomplete bands.
@codecov
Copy link

codecov bot commented Jul 21, 2021

Codecov Report

Merging #5024 (37b0684) into develop (e1abe0a) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5024      +/-   ##
===========================================
- Coverage    80.17%   80.17%   -0.00%     
===========================================
  Files          515      515              
  Lines        36746    36746              
===========================================
- Hits         29458    29457       -1     
- Misses        7288     7289       +1     
Flag Coverage Δ
django 74.65% <100.00%> (ø)
sqlalchemy 73.57% <100.00%> (-<0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiida/orm/nodes/data/array/bands.py 75.96% <100.00%> (ø)
aiida/transports/plugins/local.py 81.41% <0.00%> (-0.25%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e1abe0a...37b0684. Read the comment docs.

Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PhilippRue thanks! This looks good to me. See if others have more to comment.

@chrisjsewell chrisjsewell changed the title Fix matplotlib limits for NaN values 🐛 FIX: BandsData matplotlib with NaN values Jul 27, 2021
@chrisjsewell chrisjsewell merged commit d138842 into aiidateam:develop Jul 27, 2021
@chrisjsewell
Copy link
Member

cheers!

@PhilippRue PhilippRue deleted the BandsData-plotting-with-NaNs branch July 27, 2021 15:07
sphuber pushed a commit that referenced this pull request Aug 9, 2021
Use `numpy.nanmin` and `numpy.nanmax` for computing y-limits.

Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>

Cherry-pick: d138842
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants