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

Bug fix for edge case in _compute_drho #189

Merged
merged 1 commit into from
May 30, 2023
Merged

Conversation

s-kuberski
Copy link
Collaborator

I finally got the indexing in the _compute_drho routine correct. My last fix did not solve all the edge cases that one can find and in one case, I ran into an error because the code tried to add arrays of non-equal size. I am fairly sure that the counting is now correct.

@s-kuberski s-kuberski requested a review from fjosw as a code owner May 30, 2023 14:24
Copy link
Owner

@fjosw fjosw left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@s-kuberski
Copy link
Collaborator Author

I tried to check this along the lines of

w_max = 49
r = range(100000)
for i in range(1, w_max):
    lll = [len(r[i + 1:w_max]),
        len(r[i - 1:None if i - w_max // 2 <= 0 else 2 * i - (2 * w_max)//2 : -1]) + len(r[1:max(1, w_max - 2 * i)]),
        len(r[1:w_max - i])]
    assert(np.all([o - lll[0] == 0 for o in lll]))

which did throw an error with the old counting.

@fjosw fjosw merged commit 34fe7f4 into fjosw:develop May 30, 2023
fjosw pushed a commit that referenced this pull request Jun 1, 2023
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.

2 participants