Skip to content

rescale stopped working for rad and deg #215

Closed

Description

@axelande

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?

Activity

  1. apdavison commented on Feb 16, 2023

    @apdavison
    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
    
  2. apdavison commented on Feb 16, 2023

    @apdavison
    Contributor

    @bjodah could you look at this?

  3. bjodah commented on Feb 17, 2023

    @bjodah
    Contributor

    @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.

  4. added a commit that references this issue on Feb 17, 2023
    abefd96
  5. added a commit that references this issue on Feb 17, 2023
    aa45ade
  6. linked a pull request that will close this issueFix gh-215, dtype conversion in rescale #216on Feb 17, 2023
  7. apdavison commented on Feb 17, 2023

    @apdavison
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions