<html><body>
<p>1 new commit in yt:</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/6db4d26078e5/">https://bitbucket.org/yt_analysis/yt/commits/6db4d26078e5/</a> Changeset:   6db4d26078e5 Branch:      yt User:        jzuhone Date:        2016-05-11 18:18:09+00:00 Summary:     Merged in ngoldbaum/yt (pull request #2152)</p>
<p>Make trig functions give correct results when supplied data with dimensions of angle but units that aren't radian. Closes #982 Affected #:  2 files</p>
<p>diff -r 7f7ccbc9329e14578e120835c0365f2e271e72cf -r 6db4d26078e523630af50bde111952bbee7a1018 yt/units/tests/test_ytarray.py --- a/yt/units/tests/test_ytarray.py +++ b/yt/units/tests/test_ytarray.py @@ -42,7 +42,7 @@</p>
<pre>    assert_allclose_units
from yt.funcs import fix_length
from yt.units.unit_symbols import \</pre>
<ul><li><p>cm, m, g</p></li></ul>
<p>+    cm, m, g, degree</p>
<pre>from yt.utilities.physical_ratios import \
    metallicity_sun
</pre>
<p>@@ -1157,3 +1157,9 @@</p>
<pre>os.chdir(curdir)
shutil.rmtree(tmpdir)</pre>
<p>+ +def test_trig_ufunc_degrees(): +    for ufunc in (np.sin, np.cos, np.tan): +        degree_values = np.random.random(10)*degree +        radian_values = degree_values.in_units('radian') +        assert_array_equal(ufunc(degree_values), ufunc(radian_values))</p>
<p>diff -r 7f7ccbc9329e14578e120835c0365f2e271e72cf -r 6db4d26078e523630af50bde111952bbee7a1018 yt/units/yt_array.py --- a/yt/units/yt_array.py +++ b/yt/units/yt_array.py @@ -31,7 +31,11 @@</p>
<pre>from yt.units.unit_object import Unit, UnitParseError
from yt.units.unit_registry import UnitRegistry</pre>
<p>-from yt.units.dimensions import dimensionless, current_mks, em_dimensions +from yt.units.dimensions import \ +    angle, \ +    current_mks, \ +    dimensionless, \ +    em_dimensions</p>
<pre>from yt.utilities.exceptions import \
    YTUnitOperationError, YTUnitConversionError, \
    YTUfuncUnitError, YTIterableUnitCoercionError, \</pre>
<p>@@ -180,6 +184,10 @@</p>
<pre>    fmax, fmin, copysign, nextafter, ldexp, fmod,
)
</pre>
<p>+trigonometric_operators = ( +    sin, cos, tan, +) +</p>
<pre>class YTArray(np.ndarray):
    """
    An ndarray subclass that attaches a symbolic unit object to the array data.</pre>
<p>@@ -1166,6 +1174,9 @@</p>
<pre>u = getattr(context[1][0], 'units', None)
if u is None:
    u = NULL_UNIT</pre>
<p>+            if u.dimensions is angle and context[0] in trigonometric_operators: +                out_arr = context[0]( +                    context[1][0].in_units('radian').view(np.ndarray))</p>
<pre>unit = self._ufunc_registry[context[0]](u)
ret_class = type(self)
         elif context[0] in binary_operators:</pre>
<p>Repository URL: <a href="https://bitbucket.org/yt_analysis/yt/">https://bitbucket.org/yt_analysis/yt/</a></p>
<p>—</p>
<p>This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.</p>

<img src="http://link.bitbucket.org/wf/open?upn=ll4ctv0L-2ByeRZFC1LslHcg6aJmnQ70VruLbmeLQr27CRFnbNHAzUaez3Gi4MkEsc3PSI-2BdV2Lb-2BcSSJnkuhKPDJTV-2Bh4eppouCmZnYqOAqQVx9I9I1nnCoVlHVI65WpxsDyW3mTAJamnaMLVqCSn5hwZBp7meq-2FOrXld81IzHJSQ5JzWElTomd6gWJp-2Fn1Qs6s43Q5RUMOq5zDY572upSkuttjDSC79FURRm0FOPbUQ-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"/>
</body></html>