Skip to content

Commit

Permalink
Move dimensionless_cycles to phase module
Browse files Browse the repository at this point in the history
  • Loading branch information
mhvk committed May 24, 2020
1 parent 098bd4c commit bd710de
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pint/phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from astropy.time.utils import two_sum, two_product
from astropy.utils import minversion

from pint import dimensionless_cycles


__all__ = ['Phase', 'FractionalPhase']

Expand All @@ -22,6 +20,9 @@
np.less, np.less_equal, np.greater, np.greater_equal}


dimensionless_cycles = [(u.cycle, None)]


def day_frac(val1, val2, factor=None, divisor=None):
"""Return the sum of ``val1`` and ``val2`` as two float64s.
Expand Down Expand Up @@ -170,6 +171,9 @@ def __new__(cls, angle, unit=None, wrap_angle=None, **kwargs):
if isinstance(angle, Phase):
angle = angle['frac']

if unit is None:
unit = cls._default_unit

with u.add_enabled_equivalencies(dimensionless_cycles):
return super().__new__(cls, angle, unit=unit, wrap_angle=wrap_angle,
**kwargs)
Expand Down

0 comments on commit bd710de

Please sign in to comment.