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

Fix for incorrect function signature in power() from issue #271: updated parameters and order. #272

Closed
wants to merge 1 commit into from

Conversation

haesleinhuepf
Copy link
Member

This message was generated by git-bob (version: 0.9.0, model: gpt-4o-2024-08-06), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully.

To address issue #271, I modified the pyclesperanto/_interoperability.py file by updating the function signature of the power() function to power(input_image, output_image, exponent). I also renamed the parameters: "x1" is now "input_image", "out" is now "output_image", and "x2" is now "exponent". These changes ensure that the function will now take parameters in the correct order, aligning with the intended design.

closes #271

… output_image, exponent)` and renamed the parameters accordingly.
Comment on lines +137 to +146
if np.isscalar(exponent):
from ._tier1 import power

return power(input_image=x1, scalar=x2, output_image=out, device=x1.device)
return power(input_image=input_image, scalar=exponent, output_image=output_image, device=input_image.device)
else:
from ._tier1 import power_images

x2 = asarray(x2)
exponent = asarray(exponent)
return power_images(
input_image0=x1, input_image1=x2, output_image=out, device=x1.device
input_image0=input_image, input_image1=exponent, output_image=output_image, device=input_image.device
Copy link
Member Author

Choose a reason for hiding this comment

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

This logic seems broken now.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it should not be in there anyway. Can we remove it @StRigaud ? I think if people wanted to call power_images, they should do it explicitly. It should not be called in case some parameters are set in a specific way.

Copy link
Member

Choose a reason for hiding this comment

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

This was a mimic of the numpy power function, along with other numpy function in interoperability.

The question is "how far do we mimic numpy" ( we dont is a valid answer 😉 )

@StRigaud
Copy link
Member

Same as for the clip function, we will remove it from the file

@StRigaud StRigaud closed this Oct 16, 2024
@StRigaud StRigaud deleted the git-bob-mod-YgsC2AnUWq branch November 26, 2024 13:37
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.

Wrong funcgtion signature for power()
2 participants