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

Add energy plot #108

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add energy plot #108

wants to merge 2 commits into from

Conversation

aloctavodia
Copy link
Contributor

@aloctavodia aloctavodia commented Nov 18, 2024

schools = azb.load_arviz_data('centered_eight')
azp.plot_energy(schools)

energy_kde

azp.plot_energy(schools, kind="ecdf")

energy_ecdf

This is not working, because we have a np.nan value

azp.plot_energy(schools, kind="hist")

📚 Documentation preview 📚: https://arviz-plots--108.org.readthedocs.build/en/108/

@codecov-commenter
Copy link

codecov-commenter commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 20.68966% with 23 lines in your changes missing coverage. Please review.

Project coverage is 85.38%. Comparing base (12854cc) to head (a4fad2c).

Files with missing lines Patch % Lines
src/arviz_plots/plots/energyplot.py 17.85% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #108      +/-   ##
==========================================
- Coverage   86.04%   85.38%   -0.66%     
==========================================
  Files          24       25       +1     
  Lines        2845     2874      +29     
==========================================
+ Hits         2448     2454       +6     
- Misses        397      420      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

src/arviz_plots/plots/energyplot.py Outdated Show resolved Hide resolved
filter_vars=None,
group=None,
coords=None,
sample_dims=None,
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we want this. Sample dims should either be an input and passed downstream to plot_dist or if having flattened to sample is not to be supported here then we should hardcode it and check both chain and draw are present.

pc_kwargs=pc_kwargs,
)

plot_collection.add_legend("energy", loc="outside right upper")
Copy link
Member

Choose a reason for hiding this comment

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

I opened an issue for this, it won't work across backends yet: #109

return plot_collection


def _get_energy_ds(dt):
Copy link
Member

Choose a reason for hiding this comment

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

I'll try to look at https://docs.xarray.dev/en/stable/generated/xarray.DataArray.diff.html and see if we can make all this a bit more direct. I think it will also break when getting transposed inputs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have to admit, that I spent more than I expected to write this part (and try alternatives) :-)

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