[yt-svn] commit/yt: gsiisg: updated doc string to explain tilt in hopefully a clearer way, prevent user from inputting A<B or B<C by raising an exception, mentions that the new e0 will be normalized automatically

Bitbucket commits-noreply at bitbucket.org
Wed Oct 24 17:29:21 PDT 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/1922fd7145ac/
changeset:   1922fd7145ac
branch:      yt
user:        gsiisg
date:        2012-10-25 02:10:34
summary:     updated doc string to explain tilt in hopefully a clearer way, prevent user from inputting A<B or B<C by raising an exception, mentions that the new e0 will be normalized automatically
affected #:  2 files

diff -r 6794b2798b5a9c46cc505bd0d7cd271e65c82f0c -r 1922fd7145acd17f277eadc9f00220f81294a673 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -3528,10 +3528,38 @@
                  pf=None, **kwargs):
         """
         By providing a *center*,*A*,*B*,*C*,*e0*,*tilt* we
-        can define a ellipsoid of any proportion.  Only cells whose centers are
-        within the ellipsoid will be selected.
+        can define a ellipsoid of any proportion.  Only cells whose
+        centers are within the ellipsoid will be selected.
+
+        Parameters
+        ----------
+        center : array_like
+            The center of the ellipsoid.
+        A : float
+            The magnitude of the largest semi-major axis of the ellipsoid.
+        B : float
+            The magnitude of the medium semi-major axis of the ellipsoid.
+        C : float
+            The magnitude of the smallest semi-major axis of the ellipsoid.
+        e0 : array_like (automatically normalized)
+            the direction of the largest semi-major axis of the ellipsoid
+        tilt : float
+            After the rotation about the z-axis to allign e0 to x in the x-y
+            plane, and then rotating about the y-axis to align e0 completely
+            to the x-axis, tilt is the angle in radians remaining to
+            rotate about the x-axis to align both e1 to the y-axis and e2 to
+            the z-axis.
+        Examples
+        --------
+        >>> pf = load("DD####/DD####")
+        >>> c = [0.5,0.5,0.5]
+        >>> ell = pf.h.ellipsoid(c, 0.1, 0.1, 0.1, np.array([0.1, 0.1, 0.1]), 0.2)
         """
+
         AMR3DData.__init__(self, np.array(center), fields, pf, **kwargs)
+        # make sure the magnitudes of semi-major axes are in order
+        if A<B or B<C:
+            raise YTEllipsoidOrdering(pf, A, B, C)
         # make sure the smallest side is not smaller than dx
         if C < self.hierarchy.get_smallest_dx():
             raise YTSphereTooSmall(pf, C, self.hierarchy.get_smallest_dx())


diff -r 6794b2798b5a9c46cc505bd0d7cd271e65c82f0c -r 1922fd7145acd17f277eadc9f00220f81294a673 yt/utilities/exceptions.py
--- a/yt/utilities/exceptions.py
+++ b/yt/utilities/exceptions.py
@@ -162,3 +162,13 @@
     def __str__(self):
         return "There is no old answer available.\n" + \
                str(self.path)
+
+class YTEllipsoidOrdering(YTException):
+    def __init__(self, pf, A, B, C):
+        YTException.__init__(self, pf)
+        self._A = A
+        self._B = B
+        self._C = C
+
+    def __str__(self):
+        return "Must have A>=B>=C"

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