Incorrect conversion to/from rad/s or deg/s and hertz · Issue #188 · python-quantities/python-quantities · GitHub
Skip to content

Incorrect conversion to/from rad/s or deg/s and hertz #188

Open

Description

@mcdowns1

The conversion between hertz and rad/s or deg/s does not produce the expected results.
Example 1: 360 deg/s gets converted to 2pi Hertz
image
Example 2: 2
pi rad/s gets converted to 2*pi Hertz
image
The expected result for both of these conversions is 1 Hertz (https://en.wikipedia.org/wiki/Radian_per_second). I would expect the quantities package to either produce 1 Hertz or to throw an error due to incompatible units.

I suspect this is because radians are dimensionless and so they can convert from rad/s (dimensionless/sec quantity) to hertz (1/sec quantity).

The core of the issue is that "Hertz" as a unit is defined as 1 cycle per second, but is commonly used for angular velocity with 1 cycle = 2*pi radians implied.

I'm not sure of the right way to fix this but one option would be to define a new quantity of "angularHertz" defined as 2*pi rad/s, and throw an error if the plain-old hertz is converted to/from an angular velocity.

Activity

  1. twmr commented on Aug 15, 2021

    @twmr
    Contributor

    @mcdowns1 Have you checked how other quantity packages (astropy.units, pint, unyt, ...) handle this?

  2. apdavison commented on Jan 13, 2022

    @apdavison
    Contributor

    also see #174

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