Merged
Conversation
c66add5 to
c3269a2
Compare
Member
Author
|
Now I remember the issue with: if not np.iterable(positions):
positions = [positions]This deals with e.g. scalars, but will break later on in EventCollection with: if np.ndim(positions) != 1:
raise ValueError('positions must be one-dimensional')Are there any inputs that are not |
oscargus
commented
Apr 13, 2023
| else: | ||
| positions = [np.asanyarray(positions)] | ||
|
|
||
| if len(positions) == 0: |
Member
Author
There was a problem hiding this comment.
Because of the code above, this cannot happen.
oscargus
commented
Apr 13, 2023
| lineoffsets = [None] | ||
| raise ValueError('linewidths cannot be empty') | ||
| if len(alpha) == 0: | ||
| raise ValueError('alpha cannot be empty') |
Member
Author
There was a problem hiding this comment.
This is added compared to the discussion we had. For similar behavior and it will still break with unequal sizes below.
An option is to skip all these len() == 0 checks, except for colors, and rely on the unequal size below. Fewer checks, but slightly worse error message.
tacaswell
approved these changes
Apr 14, 2023
timhoffm
approved these changes
Apr 14, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
This is not finalized, but more a base for discussion. (Tests will be added once the final solution is decided.)
Closes #7560
There are two issues that are considered here:
eventplot(1)), but one can also consider raising an error with an appropriate error message already there.Finally, an if-statement that I cannot see can even be triggered is removed.
(Issue 2 and the removal came from trying to test these lines, which lead me to find #7560 and the earlier attempts to fix it.)
PR Checklist
Tests and Styling
pytestpasses).flake8-docstringsand runflake8 --docstring-convention=all).Documentation
doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).