[yt-svn] commit/yt: xarthisius: Make YTPlotCmd actually utilize --unit option

Bitbucket commits-noreply at bitbucket.org
Tue Jul 10 15:21:54 PDT 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/1e873c3a790e/
changeset:   1e873c3a790e
branch:      yt
user:        xarthisius
date:        2012-07-11 00:17:58
summary:     Make YTPlotCmd actually utilize --unit option
affected #:  1 file

diff -r 6d45f89c2d8609edf398edf11cbbc731332da964 -r 1e873c3a790ea268506465f8c6134e4601f7b011 yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -1137,15 +1137,24 @@
             axes = range(3)
         else:
             axes = [args.axis]
+
+        unit = args.unit
+        if unit is None:
+            unit = '1'
+        width = args.width
+        if width is None:
+            width = 0.5*(pf.domain_right_edge - pf.domain_left_edge)
+        width /= pf[unit]
+
         for ax in axes:
             mylog.info("Adding plot for axis %i", ax)
             if args.projection:
                 plt = ProjectionPlot(pf, ax, args.field, center=center,
-                                     width=args.width,
+                                     width=width,
                                      weight_field=args.weight)
             else:
                 plt = SlicePlot(pf, ax, args.field, center=center,
-                                width=args.width)
+                                width=width)
             if args.grids:
                 plt.draw_grids()
             if args.time:

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