[yt-svn] commit/yt: 6 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Oct 15 21:52:47 PDT 2015


6 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/ae30efe86f44/
Changeset:   ae30efe86f44
Branch:      yt
User:        atmyers
Date:        2015-10-15 18:49:16+00:00
Summary:     enforce code units in camera properties
Affected #:  1 file

diff -r 562b253b734a3abc182b712fb9009034ea3b36c6 -r ae30efe86f445a0d6f7444031a3d201ec8d67952 yt/visualization/volume_rendering/camera.py
--- a/yt/visualization/volume_rendering/camera.py
+++ b/yt/visualization/volume_rendering/camera.py
@@ -90,12 +90,18 @@
 
     def position():
         doc = '''The position is the location of the camera in
-               the coordinate system of the simulation.'''
+               the coordinate system of the simulation. This needs
+               to be either a YTArray or a numpy array. If it is a 
+               numpy array, it is assumed to be in code units. If it
+               is a YTArray, it will be converted to code units 
+               automatically. '''
 
         def fget(self):
             return self._position
 
         def fset(self, value):
+            if isinstance(value, YTArray):
+                value = value.in_units("code_length")
             self._position = value
             self.switch_orientation()
 
@@ -105,12 +111,17 @@
     position = property(**position())
 
     def width():
-        doc = '''The width of the image that will be produced. '''
+        doc = '''The width of the region that will be seen in the image. 
+               This needs to be either a YTArray or a numpy array. If it 
+               is a numpy array, it is assumed to be in code units. If it
+               is a YTArray, it will be converted to code units automatically. '''
 
         def fget(self):
             return self._width
 
         def fset(self, value):
+            if isinstance(value, YTArray):
+                value = value.in_units("code_length")
             self._width = value
             self.switch_orientation()
 
@@ -121,12 +132,18 @@
     width = property(**width())
 
     def focus():
-        doc = '''The focus defines the point the Camera is pointed at. '''
+        doc = '''The focus defines the point the Camera is pointed at. This needs
+               to be either a YTArray or a numpy array. If it is a 
+               numpy array, it is assumed to be in code units. If it
+               is a YTArray, it will be converted to code units 
+               automatically. '''
 
         def fget(self):
             return self._focus
 
         def fset(self, value):
+            if isinstance(value, YTArray):
+                value = value.in_units("code_length")
             self._focus = value
             self.switch_orientation()
 


https://bitbucket.org/yt_analysis/yt/commits/fb23b5f1b3a0/
Changeset:   fb23b5f1b3a0
Branch:      yt
User:        atmyers
Date:        2015-10-15 19:00:36+00:00
Summary:     this check needs to be done before comparing north_vector and normal_vector
Affected #:  1 file

diff -r ae30efe86f445a0d6f7444031a3d201ec8d67952 -r fb23b5f1b3a05d466d942d129e9988b02147c834 yt/utilities/orientation.py
--- a/yt/utilities/orientation.py
+++ b/yt/utilities/orientation.py
@@ -41,6 +41,12 @@
 
         """
 
+        # Make sure vectors are unitless
+        if north_vector is not None:
+            north_vector = YTArray(north_vector, "", dtype='float64')
+        if normal_vector is not None:
+            normal_vector = YTArray(normal_vector, "", dtype='float64')
+
         self.steady_north = steady_north
         if not np.dot(normal_vector, normal_vector) > 0:
             mylog.error("Normal vector is null")


https://bitbucket.org/yt_analysis/yt/commits/ecf6387d08e0/
Changeset:   ecf6387d08e0
Branch:      yt
User:        atmyers
Date:        2015-10-15 23:43:13+00:00
Summary:     Give a better error message when you try to use code units with a YTArray that has not beed defined using ds.arr
Affected #:  1 file

diff -r fb23b5f1b3a05d466d942d129e9988b02147c834 -r ecf6387d08e004b945722cdc27184af40fd27340 yt/units/unit_object.py
--- a/yt/units/unit_object.py
+++ b/yt/units/unit_object.py
@@ -545,8 +545,13 @@
             return (unit_data[0] * prefix_value, unit_data[1])
 
     # no dice
-    raise UnitParseError("Could not find unit symbol '%s' in the provided " \
-                         "symbols." % symbol_str)
+    if symbol_str.startswith('code_'):
+        raise UnitParseError(
+            "Code units have not been defined. \n"
+            "Try creating the array or quantity using ds.arr instead: \n")
+    else:
+        raise UnitParseError("Could not find unit symbol '%s' in the provided " \
+                             "symbols." % symbol_str)
 
 def validate_dimensions(dimensions):
     if isinstance(dimensions, Mul):


https://bitbucket.org/yt_analysis/yt/commits/9aea91e349d0/
Changeset:   9aea91e349d0
Branch:      yt
User:        atmyers
Date:        2015-10-15 23:57:21+00:00
Summary:     removing un-needed newline
Affected #:  1 file

diff -r ecf6387d08e004b945722cdc27184af40fd27340 -r 9aea91e349d0b81e0527c5912bafb0fa94316e57 yt/units/unit_object.py
--- a/yt/units/unit_object.py
+++ b/yt/units/unit_object.py
@@ -548,7 +548,7 @@
     if symbol_str.startswith('code_'):
         raise UnitParseError(
             "Code units have not been defined. \n"
-            "Try creating the array or quantity using ds.arr instead: \n")
+            "Try creating the array or quantity using ds.arr instead.")
     else:
         raise UnitParseError("Could not find unit symbol '%s' in the provided " \
                              "symbols." % symbol_str)


https://bitbucket.org/yt_analysis/yt/commits/830bca068d4b/
Changeset:   830bca068d4b
Branch:      yt
User:        atmyers
Date:        2015-10-16 00:12:38+00:00
Summary:     ds.arr or ds.quan
Affected #:  1 file

diff -r 9aea91e349d0b81e0527c5912bafb0fa94316e57 -r 830bca068d4bfb63eccc0b34df6c6c1642d38828 yt/units/unit_object.py
--- a/yt/units/unit_object.py
+++ b/yt/units/unit_object.py
@@ -548,7 +548,7 @@
     if symbol_str.startswith('code_'):
         raise UnitParseError(
             "Code units have not been defined. \n"
-            "Try creating the array or quantity using ds.arr instead.")
+            "Try creating the array or quantity using ds.arr or ds.quan instead.")
     else:
         raise UnitParseError("Could not find unit symbol '%s' in the provided " \
                              "symbols." % symbol_str)


https://bitbucket.org/yt_analysis/yt/commits/6912d9a2ce19/
Changeset:   6912d9a2ce19
Branch:      yt
User:        ngoldbaum
Date:        2015-10-16 04:52:39+00:00
Summary:     Merged in atmyers/yt (pull request #1804)

Enforce code units in Camera
Affected #:  3 files

diff -r a1857fbd7d50ee6060bb8e2b0a74ceb6baf118a7 -r 6912d9a2ce191dea530405370cb3ca47879d420a yt/units/unit_object.py
--- a/yt/units/unit_object.py
+++ b/yt/units/unit_object.py
@@ -545,8 +545,13 @@
             return (unit_data[0] * prefix_value, unit_data[1])
 
     # no dice
-    raise UnitParseError("Could not find unit symbol '%s' in the provided " \
-                         "symbols." % symbol_str)
+    if symbol_str.startswith('code_'):
+        raise UnitParseError(
+            "Code units have not been defined. \n"
+            "Try creating the array or quantity using ds.arr or ds.quan instead.")
+    else:
+        raise UnitParseError("Could not find unit symbol '%s' in the provided " \
+                             "symbols." % symbol_str)
 
 def validate_dimensions(dimensions):
     if isinstance(dimensions, Mul):

diff -r a1857fbd7d50ee6060bb8e2b0a74ceb6baf118a7 -r 6912d9a2ce191dea530405370cb3ca47879d420a yt/utilities/orientation.py
--- a/yt/utilities/orientation.py
+++ b/yt/utilities/orientation.py
@@ -41,6 +41,12 @@
 
         """
 
+        # Make sure vectors are unitless
+        if north_vector is not None:
+            north_vector = YTArray(north_vector, "", dtype='float64')
+        if normal_vector is not None:
+            normal_vector = YTArray(normal_vector, "", dtype='float64')
+
         self.steady_north = steady_north
         if not np.dot(normal_vector, normal_vector) > 0:
             mylog.error("Normal vector is null")

diff -r a1857fbd7d50ee6060bb8e2b0a74ceb6baf118a7 -r 6912d9a2ce191dea530405370cb3ca47879d420a yt/visualization/volume_rendering/camera.py
--- a/yt/visualization/volume_rendering/camera.py
+++ b/yt/visualization/volume_rendering/camera.py
@@ -90,12 +90,18 @@
 
     def position():
         doc = '''The position is the location of the camera in
-               the coordinate system of the simulation.'''
+               the coordinate system of the simulation. This needs
+               to be either a YTArray or a numpy array. If it is a 
+               numpy array, it is assumed to be in code units. If it
+               is a YTArray, it will be converted to code units 
+               automatically. '''
 
         def fget(self):
             return self._position
 
         def fset(self, value):
+            if isinstance(value, YTArray):
+                value = value.in_units("code_length")
             self._position = value
             self.switch_orientation()
 
@@ -105,12 +111,17 @@
     position = property(**position())
 
     def width():
-        doc = '''The width of the image that will be produced. '''
+        doc = '''The width of the region that will be seen in the image. 
+               This needs to be either a YTArray or a numpy array. If it 
+               is a numpy array, it is assumed to be in code units. If it
+               is a YTArray, it will be converted to code units automatically. '''
 
         def fget(self):
             return self._width
 
         def fset(self, value):
+            if isinstance(value, YTArray):
+                value = value.in_units("code_length")
             self._width = value
             self.switch_orientation()
 
@@ -121,12 +132,18 @@
     width = property(**width())
 
     def focus():
-        doc = '''The focus defines the point the Camera is pointed at. '''
+        doc = '''The focus defines the point the Camera is pointed at. This needs
+               to be either a YTArray or a numpy array. If it is a 
+               numpy array, it is assumed to be in code units. If it
+               is a YTArray, it will be converted to code units 
+               automatically. '''
 
         def fget(self):
             return self._focus
 
         def fset(self, value):
+            if isinstance(value, YTArray):
+                value = value.in_units("code_length")
             self._focus = value
             self.switch_orientation()

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