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

feat: Sort _ChannelSummaryMixin.channel_nbins by keys to match channels order #1546

Merged
merged 4 commits into from
Aug 5, 2021

Conversation

matthewfeickert
Copy link
Member

@matthewfeickert matthewfeickert commented Aug 4, 2021

Description

Resolves #1545

This PR sorts the _ChannelSummaryMixin.channel_nbins dict by its keys such that its keys are in the same order as the entries of the _ChannelSummaryMixin.channels list. This is done for aesthetics mostly and for quick checks, as users should rely on dict keys not dict ordering. It additionally adds a test.

Checklist Before Requesting Reviewer

  • Tests are passing
  • "WIP" removed from the title of the pull request
  • Selected an Assignee for the PR to be responsible for the log summary

Before Merging

For the PR Assignees:

  • Summarize commit messages into a comprehensive review of the PR
* Sort _ChannelSummaryMixin.channel_nbins dict by keys to match the order of _ChannelSummaryMixin.channels
* Add a test for the order of channel_nbins keys matching the order of channels entries

@matthewfeickert matthewfeickert added feat/enhancement New feature or request tests pytest labels Aug 4, 2021
@matthewfeickert matthewfeickert self-assigned this Aug 4, 2021
Comment on lines +52 to +53
spec["channels"].append(spec["channels"][0].copy())
spec["channels"][-1]["name"] = "a_make_first_in_sort_channel2"
Copy link
Member Author

Choose a reason for hiding this comment

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

@kratsg there is probably a more elegant way to do this, so please give recommendations and ask for changes here.

@matthewfeickert matthewfeickert changed the title feat: Sort _ChannelSummaryMixin channel_nbins by keys to match channels order feat: Sort _ChannelSummaryMixin.channel_nbins by keys to match channels order Aug 4, 2021
@codecov
Copy link

codecov bot commented Aug 4, 2021

Codecov Report

Merging #1546 (a85fb7a) into master (5eab9ee) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1546   +/-   ##
=======================================
  Coverage   97.66%   97.66%           
=======================================
  Files          63       63           
  Lines        4023     4024    +1     
  Branches      571      572    +1     
=======================================
+ Hits         3929     3930    +1     
  Misses         55       55           
  Partials       39       39           
Flag Coverage Δ
contrib 25.42% <0.00%> (-0.01%) ⬇️
unittests 97.44% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
src/pyhf/mixins.py 100.00% <100.00%> (ø)

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 5eab9ee...a85fb7a. Read the comment docs.

@kratsg kratsg merged commit 4b66cd2 into master Aug 5, 2021
@kratsg kratsg deleted the feat/sort-channel-nbins branch August 5, 2021 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat/enhancement New feature or request tests pytest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Different ordering of channels between model.config.channels and mode.config.channel_nbins
2 participants