-
Notifications
You must be signed in to change notification settings - Fork 60
Fix remain arr.shape= #1170
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
base: master
Are you sure you want to change the base?
Fix remain arr.shape= #1170
Conversation
|
They had double space before |
|
I found these remains accidentally, while investigating do not change them. So probably |
No, it was not a bug. Continuum must have the same length as ymatrix. |
|
Personally I prefer to use reshape rather than ravel to simplify tracking of changes, but it is not a big deal. My recommendation would be to use ravel as replacement of |
In #1165 it was already done as here. We can change if needed but it seems to be same things. |
Yes, I think there was only one case of use of ravel to replace |
|
Now you have a bug. You have made continuum equal to ymatrix. Only the shape is equal not the content! |
vasole
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now you have a bug.
x.reshape(len(y)) is not the same as numpy.ravel(y)
|
in this case there is a clear difference between using reshape ddict['result']['ymatrix'] = ddict['result']['ymatrix'].reshape(len(ddict['result']['ymatrix']))
ddict['result']['continuum'] = ddict['result']['continuum'].reshape(len(ddict['result']['ymatrix']))and using ravel ddict['result']['ymatrix'] = numpy.ravel(ddict['result']['ymatrix'])
ddict['result']['continuum'] = numpy.ravel(ddict['result']['continuum'])The key difference is how they behave for unexpected shapes.
The Additionally, reshaping For these reasons, I’d prefer the explicit reshape version so we fail fast on invalid or inconsistent shapes rather than silently flattening them. Note: in #1165 we did replace |
|
Concerning the #1165 places which you've mentioned and probably some others (where Do you mind if I fix it in this PR? |
Yes indeed, sorry. |
I did not found other places. All other
Now it is like this. |
Related to #1165 and #1162
Fixes remain
arr.shape=.Moreover probably it was a 'bug' since
continuumwas reshaped byymatrix. If not please please let me know.