[yt-svn] commit/yt: MatthewTurk: Fixing unnecessary printing when running command line tool. Adding parsing of

Bitbucket commits-noreply at bitbucket.org
Wed Jan 25 07:30:24 PST 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/b1034ab1eccd/
changeset:   b1034ab1eccd
branch:      yt
user:        MatthewTurk
date:        2012-01-25 16:30:15
summary:     Fixing unnecessary printing when running command line tool.  Adding parsing of
tuples of (value, unit) for radius and height in disks.  Ensuring the supplying
"max" to the disk initializer works.
affected #:  3 files

diff -r c3677ac45409130a7e0e2a9c8248d6723e699728 -r b1034ab1eccd1df4630a2e5e114044bdbbb61e7f yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -2955,11 +2955,11 @@
         can define a cylinder of any proportion.  Only cells whose centers are
         within the cylinder will be selected.
         """
-        AMR3DData.__init__(self, na.array(center), fields, pf, **kwargs)
+        AMR3DData.__init__(self, center, fields, pf, **kwargs)
         self._norm_vec = na.array(normal)/na.sqrt(na.dot(normal,normal))
         self.set_field_parameter("height_vector", self._norm_vec)
-        self._height = height
-        self._radius = radius
+        self._height = fix_length(height, self.pf)
+        self._radius = fix_length(radius, self.pf)
         self._d = -1.0 * na.dot(self._norm_vec, self.center)
         self._refresh_data()
 
@@ -3274,9 +3274,7 @@
         """
         AMR3DData.__init__(self, center, fields, pf, **kwargs)
         # Unpack the radius, if necessary
-        if isinstance(radius, (list, tuple)) and len(radius) == 2 and \
-           isinstance(radius[1], types.StringTypes):
-           radius = radius[0]/self.pf[radius[1]]
+        radius = fix_length(radius, self.pf)
         if radius < self.hierarchy.get_smallest_dx():
             raise YTSphereTooSmall(pf, radius, self.hierarchy.get_smallest_dx())
         self.set_field_parameter('radius',radius)


diff -r c3677ac45409130a7e0e2a9c8248d6723e699728 -r b1034ab1eccd1df4630a2e5e114044bdbbb61e7f yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -541,3 +541,8 @@
     # Now we think we have our supplemental repository.
     return supp_path
 
+def fix_length(length, pf):
+    if isinstance(length, (list, tuple)) and len(length) == 2 and \
+       isinstance(length[1], types.StringTypes):
+       length = length[0]/pf[length[1]]
+    return length


diff -r c3677ac45409130a7e0e2a9c8248d6723e699728 -r b1034ab1eccd1df4630a2e5e114044bdbbb61e7f yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -90,7 +90,6 @@
 
 class GetParameterFiles(argparse.Action):
     def __call__(self, parser, namespace, values, option_string = None):
-        print parser, namespace, values, option_string
         if len(values) == 1:
             pfs = values
         elif len(values) == 2 and namespace.basename is not None:

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