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

Rename the first positional arg in _trapz to match numpy #1796

Merged
merged 3 commits into from
Dec 3, 2023

Conversation

varchasgopalaswamy
Copy link
Contributor

As implemented currently, the trapz function is not consistent between numpy and pint

x = np.linspace(0,1)
x2 = x * unit_registry('m')
y = x**2 
y2 = x2 ** 2

np.trapz(x=x,y=y) # Works 

np.trapz(x=x2,y=y2) # Throws error 

The reason is that as in the numpy documentation, the first positional argument for trapz is y, while pint's overriding implementation has it as a, which is more like the unary numpy functions.

@dopplershift
Copy link
Contributor

Ooops, I missed the need to match for keyword-based calls.

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 8, 2023

CodSpeed Performance Report

Merging #1796 will not alter performance

Comparing varchasgopalaswamy:master (aa5d7a0) with master (6c2dda9)

Summary

✅ 421 untouched benchmarks

@hgrecco hgrecco merged commit b449b72 into hgrecco:master Dec 3, 2023
64 of 65 checks passed
@hgrecco
Copy link
Owner

hgrecco commented Dec 3, 2023

Thanks!

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