[yt-svn] commit/yt: 4 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Aug 11 08:19:14 PDT 2015
4 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/6dede6cd1288/
Changeset: 6dede6cd1288
Branch: yt
User: ngoldbaum
Date: 2015-08-09 19:14:16+00:00
Summary: Add failing test for coersion when multiplying YTQuantity by an ndarray
Affected #: 1 file
diff -r 57abf679467c2b46098177a6662cc507c173395b -r 6dede6cd12882a147029d5c8ea8221946dab1643 yt/units/tests/test_ytarray.py
--- a/yt/units/tests/test_ytarray.py
+++ b/yt/units/tests/test_ytarray.py
@@ -1009,7 +1009,18 @@
V = YTQuantity(1.0, "statV")
V_mks = V.to_equivalent("V", "SI")
yield assert_array_almost_equal, V_mks.v, 1.0e8*V.v/speed_of_light_cm_per_s
-
+
+def test_ytarray_coersion():
+ a = YTArray([1, 2, 3], 'cm')
+ q = YTQuantity(3, 'cm')
+ na = np.array([1, 2, 3])
+
+ assert_isinstance(a*q, YTArray)
+ assert_isinstance(q*na, YTArray)
+ assert_isinstance(q*3, YTQuantity)
+ assert_isinstance(q*np.float64(3), YTQuantity)
+ assert_isinstance(q*np.array(3), YTQuantity)
+
def test_numpy_wrappers():
a1 = YTArray([1, 2, 3], 'cm')
a2 = YTArray([2, 3, 4, 5, 6], 'cm')
https://bitbucket.org/yt_analysis/yt/commits/016abb2f67b0/
Changeset: 016abb2f67b0
Branch: yt
User: ngoldbaum
Date: 2015-08-09 19:15:22+00:00
Summary: Fix API bug in YTArray casting during coercion from YTQuantity
Affected #: 1 file
diff -r 6dede6cd12882a147029d5c8ea8221946dab1643 -r 016abb2f67b02e0e0f3929c513a01ce5b0dcbb71 yt/units/yt_array.py
--- a/yt/units/yt_array.py
+++ b/yt/units/yt_array.py
@@ -1085,7 +1085,7 @@
if ret_class is YTQuantity:
# This happens if you do ndarray * YTQuantity. Explicitly
# casting to YTArray avoids creating a YTQuantity with size > 1
- return YTArray(np.array(out_arr, unit))
+ return YTArray(np.array(out_arr), unit)
return ret_class(np.array(out_arr, copy=False), unit)
https://bitbucket.org/yt_analysis/yt/commits/957bb6388151/
Changeset: 957bb6388151
Branch: yt
User: ngoldbaum
Date: 2015-08-11 15:06:56+00:00
Summary: fix spelling error in test function name
Affected #: 1 file
diff -r 016abb2f67b02e0e0f3929c513a01ce5b0dcbb71 -r 957bb6388151f8e96658036f8d332c3bac21b434 yt/units/tests/test_ytarray.py
--- a/yt/units/tests/test_ytarray.py
+++ b/yt/units/tests/test_ytarray.py
@@ -1010,7 +1010,7 @@
V_mks = V.to_equivalent("V", "SI")
yield assert_array_almost_equal, V_mks.v, 1.0e8*V.v/speed_of_light_cm_per_s
-def test_ytarray_coersion():
+def test_ytarray_coercion():
a = YTArray([1, 2, 3], 'cm')
q = YTQuantity(3, 'cm')
na = np.array([1, 2, 3])
https://bitbucket.org/yt_analysis/yt/commits/87b696c1a0e3/
Changeset: 87b696c1a0e3
Branch: yt
User: jzuhone
Date: 2015-08-11 15:19:01+00:00
Summary: Merged in ngoldbaum/yt (pull request #1686)
Fix API bug in YTArray casting during coercion from YTQuantity
Affected #: 2 files
diff -r 7c2d53feae18014f798008c038aeea9101cf1570 -r 87b696c1a0e3c58fd6719b1dfc973b82f1624c77 yt/units/tests/test_ytarray.py
--- a/yt/units/tests/test_ytarray.py
+++ b/yt/units/tests/test_ytarray.py
@@ -1009,7 +1009,18 @@
V = YTQuantity(1.0, "statV")
V_mks = V.to_equivalent("V", "SI")
yield assert_array_almost_equal, V_mks.v, 1.0e8*V.v/speed_of_light_cm_per_s
-
+
+def test_ytarray_coercion():
+ a = YTArray([1, 2, 3], 'cm')
+ q = YTQuantity(3, 'cm')
+ na = np.array([1, 2, 3])
+
+ assert_isinstance(a*q, YTArray)
+ assert_isinstance(q*na, YTArray)
+ assert_isinstance(q*3, YTQuantity)
+ assert_isinstance(q*np.float64(3), YTQuantity)
+ assert_isinstance(q*np.array(3), YTQuantity)
+
def test_numpy_wrappers():
a1 = YTArray([1, 2, 3], 'cm')
a2 = YTArray([2, 3, 4, 5, 6], 'cm')
diff -r 7c2d53feae18014f798008c038aeea9101cf1570 -r 87b696c1a0e3c58fd6719b1dfc973b82f1624c77 yt/units/yt_array.py
--- a/yt/units/yt_array.py
+++ b/yt/units/yt_array.py
@@ -1085,7 +1085,7 @@
if ret_class is YTQuantity:
# This happens if you do ndarray * YTQuantity. Explicitly
# casting to YTArray avoids creating a YTQuantity with size > 1
- return YTArray(np.array(out_arr, unit))
+ return YTArray(np.array(out_arr), unit)
return ret_class(np.array(out_arr, copy=False), unit)
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list