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

PR: Update ArrayEditor to correct deprecated Numpy operator #4667

Merged
merged 3 commits into from
Jun 29, 2017

Conversation

GKosiba
Copy link
Contributor

@GKosiba GKosiba commented Jun 27, 2017

Fixes #4663.


Changed numpy boolean subract operator '-' to np.logical_xor. As suggested in the numpy deprec warning.
Tested locally with no error originally described in #4663

Changed numpy boolean subract operator '-' to np.logical_xor. As suggested in the numpy deprec warning.
Tested locally with no error originally described in spyder-ide#4663
@ccordoba12 ccordoba12 added this to the v3.2 milestone Jun 28, 2017
@ccordoba12
Copy link
Member

Is this backwards compatible? I mean, does it work with previous Numpy versions?

@ccordoba12
Copy link
Member

And of course. thanks a lot for your contribution!!

@jitseniesen
Copy link
Member

What about when the array loaded in the variable explorer does not have boolean entries?

@GKosiba
Copy link
Contributor Author

GKosiba commented Jun 28, 2017

Sorry, didn't have a lot of time yesterday, but that wasn't a fix.
Essentially this line is scaling the hue of each index in the pop-up 'array' window relative to the maximum value in the array.

This new edit calculates this scaling factor (max-value)/(max-min) with max as float each time. The issue only occurs for boolean with the deprecated minus operator but float of 0 or 1 minus value of 0 or 1 gives the same value for the scaling factor and was converted to float anyways in the next line.

Tested with bool and non-bool array types and older numpy versions.

@ccordoba12 ccordoba12 changed the title Update arrayeditor.py to correct deprecated numpy operator PR: Update ArrayEditor to correct deprecated Numpy operator Jun 28, 2017
@ccordoba12
Copy link
Member

@jitseniesen, do you approve this one?

@jitseniesen
Copy link
Member

@GKosiba Looks good; but one detail: could you please add a short comment explaining why the conversion to float is there? e.g. "convert to float to handle bool arrays". I am afraid the conversion will puzzle us later.

@GKosiba
Copy link
Contributor Author

GKosiba commented Jun 28, 2017

@ccordoba12 @jitseniesen Comment added

Copy link
Member

@jitseniesen jitseniesen 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 to me. Thanks for your contribution.

@ccordoba12
Copy link
Member

Thanks @GKosiba for your contribution and @jitseniesen for reviewing it.

This is going in!

@ccordoba12 ccordoba12 merged commit f6dd98f into spyder-ide:3.x Jun 29, 2017
ccordoba12 added a commit that referenced this pull request Jun 29, 2017
@GKosiba GKosiba deleted the GKosiba-patch-1 branch June 29, 2017 15:08
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.

3 participants