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

enable dimension order in selection #2103

Merged
merged 13 commits into from
Oct 6, 2022
Merged

Conversation

ahartikainen
Copy link
Contributor

@ahartikainen ahartikainen commented Aug 27, 2022

Description

Fixes #2102

Add dim_order keyword for xarray_var_iter

Checklist

  • Follows official PR format
  • Includes a sample plot to visually illustrate the changes (only for plot-related functions)
  • New features are properly documented (with an example if appropriate)?
  • Includes new or updated tests to cover the new feature
  • Code style correct (follows pylint and black guidelines)
  • Changes are listed in changelog

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

@ahartikainen
Copy link
Contributor Author

This does fix the problem, but feels like the wrong solution

arviz/sel_utils.py Outdated Show resolved Hide resolved
@OriolAbril
Copy link
Member

This does fix the problem, but feels like the wrong solution

I am not sure there is any other way around. We start from labelled data and remove the labels in the process, but then functions assume that the dimensions are in the chain, draw, *shape order, so we need to make sure to enforce that order before loosing the labels for everything to work properly.

Co-authored-by: Oriol Abril-Pla <oriol.abril.pla@gmail.com>
@codecov
Copy link

codecov bot commented Sep 8, 2022

Codecov Report

Merging #2103 (7b44683) into main (5ca7643) will decrease coverage by 0.02%.
The diff coverage is 83.33%.

@@            Coverage Diff             @@
##             main    #2103      +/-   ##
==========================================
- Coverage   90.79%   90.77%   -0.03%     
==========================================
  Files         117      117              
  Lines       12488    12504      +16     
==========================================
+ Hits        11338    11350      +12     
- Misses       1150     1154       +4     
Impacted Files Coverage Δ
arviz/plots/autocorrplot.py 100.00% <ø> (ø)
arviz/plots/ecdfplot.py 75.00% <ø> (ø)
arviz/plots/parallelplot.py 97.77% <ø> (ø)
arviz/plots/rankplot.py 91.42% <ø> (ø)
arviz/plots/traceplot.py 95.34% <ø> (ø)
arviz/rcparams.py 92.56% <60.00%> (-0.72%) ⬇️
arviz/plots/backends/bokeh/kdeplot.py 94.70% <75.00%> (-1.19%) ⬇️
arviz/sel_utils.py 83.09% <90.00%> (-0.73%) ⬇️
arviz/data/io_numpyro.py 93.98% <100.00%> (+0.18%) ⬆️
arviz/plots/energyplot.py 88.88% <100.00%> (+5.55%) ⬆️
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@OriolAbril
Copy link
Member

make sure all functions mentioned in #2102 (comment) also work

@sethaxen
Copy link
Member

sethaxen commented Oct 2, 2022

#2126 fixed a few other functions. The only remaining ones I can find with dimension ordering issues are:

  • plot_trace (already handled by this PR)
  • plot_autocorr
  • plot_rank
    The latter two both use xarray_var_iter so could potentially be fixed by this PR once the dim_order keyword is set.

@sethaxen
Copy link
Member

sethaxen commented Oct 2, 2022

I think someone more familiar with xarray should give an actual review, but all the plots in #2103 (comment) LGTM now. Thanks!

@ahartikainen
Copy link
Contributor Author

Going to push this in, all adhoc tests are working.

@ahartikainen ahartikainen merged commit 5bfdeff into main Oct 6, 2022
@ahartikainen ahartikainen deleted the bugfix/iter_dim_order branch October 6, 2022 06:54
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.

plot_trace errors for non-default order of dimensions
3 participants