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

rescale stopped working for rad and deg #215

Closed
axelande opened this issue Feb 16, 2023 · 4 comments · Fixed by #216
Closed

rescale stopped working for rad and deg #215

axelande opened this issue Feb 16, 2023 · 4 comments · Fixed by #216

Comments

@axelande
Copy link

Something broke in version 0.14.0 with regards to rescale:
In version 0.13.0:

heading = pq.Quantity(10, pq.deg)
print(heading.rescale(pq.rad)) -> array(0.17453293) * rad

In version 0.14.0:

heading = pq.Quantity(10, pq.deg)
heading.rescale(pq.rad) -> array(0) * rad

I can't see anything in changed api in the changelog?

@apdavison
Copy link
Contributor

Thanks for reporting this. We'll look into it urgently.

As a workaround, I note that explicitly giving heading a float dtype avoids the problem, e.g.

heading = pq.Quantity(10.0, pq.deg)
print(heading.rescale(pq.rad)) -> array(0.17453293) * rad

@apdavison
Copy link
Contributor

@bjodah could you look at this?

@bjodah
Copy link
Contributor

bjodah commented Feb 17, 2023

@apdavison, sure I'll look into this right away, I think I see what's happening here: numpy casting rules aren't really well suited for integer types in quantities. I'll try to put a PR together.

apdavison added a commit that referenced this issue Feb 17, 2023
@apdavison apdavison linked a pull request Feb 17, 2023 that will close this issue
@apdavison
Copy link
Contributor

Many thanks for the quick response @bjodah !

@axelande I've made a bug-fix release. Updating to 0.14.1 should fix the problem.

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 a pull request may close this issue.

3 participants