Repository navigation
Make phase_cross_correlation return ndarray when disambiguate=True - #7112
Conversation
| ): | ||
| real_shift_acc.append(pos_shift if sl.stop is None else neg_shift) | ||
| if not subpixel: | ||
| real_shift = tuple(map(int, real_shift_acc)) |
There was a problem hiding this comment.
And since real_shift was supposed to be a 'tuple of float,' it's not clear why this mapping to integer was even performed...
Co-authored-by: Marianne Corvellec <[email protected]>
lagru
left a comment
There was a problem hiding this comment.
Thanks for working on this. I think the test is not actually testing that the bug is fixed though. Otherwise, nothing major.
| ): | ||
| real_shift_acc.append(pos_shift if sl.stop is None else neg_shift) | ||
| if not subpixel: | ||
| real_shift = tuple(map(int, real_shift_acc)) |
mkcor
left a comment
There was a problem hiding this comment.
Yes, I think that's what I meant. Though, right now we don't need to append
shift = np.asarray(shift)because this function already returns an array with
return np.array(real_shift_acc)
@lagru well, it's EITHER/OR, of course (not both). By 'right now,' I guess that you mean 'with this PR,' since only this PR is adding return np.array(real_shift_acc) (but this PR isn't merged yet... For me, 'right now' typically means 'on current main').
So,
- EITHER this PR keeps
return np.array(real_shift_acc)but then line 145 needs to be updated
-real_shift : sequence of floats
+real_shift : ndarray- OR this PR updates the code within
phase_cross_correlationas discussed.
Co-authored-by: Lars Grüter <[email protected]>
Co-authored-by: Marianne Corvellec <[email protected]>
|
Hello @decorouz! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
|
|
All CI failures look related to #7140. As the test suite itself is passing fine, I am going ahead and merge this. |
|
Thanks everyone! |
Description
ski.registration.phase_cross_correlationreturns inconsistent results.It returns a tuple when
disambiguateis set toTruebut numpy array when set to False. Since there's no reason for a shift to sometimes be a tuple and sometimes a numpy array, this PR attempts to fix this bug #7083 by making the function return numpy array consistently.Additionally, this gallery example returns a
TypeError: can only concatenate tuple (not "int") to tuplewhendisambiguateis set toTrueon this line . This PR also fixed the error.Checklist
./doc/examplesfor new featuresRelease note
Summarize the introduced changes in the code block below in one or a few sentences. The
summary will be included in the next release notes automatically: