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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Jul 18 18:36:19 PDT 2013


7 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/4432c4c71f3a/
Changeset:   4432c4c71f3a
Branch:      yt
User:        John Forbes
Date:        2013-07-10 04:53:00
Summary:     Add NumberDensity field to FLASH frontend
Affected #:  1 file

diff -r 0f59ef0d7dc696a4c8fdab557eb544ca87942b6c -r 4432c4c71f3a0856d4627933b0b28945d1208b52 yt/frontends/flash/fields.py
--- a/yt/frontends/flash/fields.py
+++ b/yt/frontends/flash/fields.py
@@ -368,3 +368,15 @@
 def _abar(field, data):
     return 1.0 / data['sumy']
 add_field('abar', function=_abar, take_log=False)
+	
+
+def _NumberDensity(fields,data) :
+    try:
+        return data["nele"]+data["nion"]
+    except:
+        pass
+    return data['pres']/(data['temp']*Na*kboltz*mh)
+add_field("NumberDensity", function=_NumberDensity,
+        units=r'\rm{cm}^{-3}')
+
+


https://bitbucket.org/yt_analysis/yt/commits/e0adb33d174b/
Changeset:   e0adb33d174b
Branch:      yt
User:        John Forbes
Date:        2013-07-10 04:59:32
Summary:     Use correct proton mass to calculate NumberDensity.
Affected #:  1 file

diff -r 4432c4c71f3a0856d4627933b0b28945d1208b52 -r e0adb33d174bad2a9283fbb642a404f96e910834 yt/frontends/flash/fields.py
--- a/yt/frontends/flash/fields.py
+++ b/yt/frontends/flash/fields.py
@@ -375,7 +375,7 @@
         return data["nele"]+data["nion"]
     except:
         pass
-    return data['pres']/(data['temp']*Na*kboltz*mh)
+    return data['pres']/(data['temp']*Na*kboltz*mh/1.00794)
 add_field("NumberDensity", function=_NumberDensity,
         units=r'\rm{cm}^{-3}')
 


https://bitbucket.org/yt_analysis/yt/commits/695225600c5b/
Changeset:   695225600c5b
Branch:      yt
User:        John Forbes
Date:        2013-07-10 06:14:03
Summary:     Eliminate unexplained numerical constant from NumberDensity calculation.
Affected #:  1 file

diff -r e0adb33d174bad2a9283fbb642a404f96e910834 -r 695225600c5b10177bedecbe44e04e36ad425d26 yt/frontends/flash/fields.py
--- a/yt/frontends/flash/fields.py
+++ b/yt/frontends/flash/fields.py
@@ -375,7 +375,7 @@
         return data["nele"]+data["nion"]
     except:
         pass
-    return data['pres']/(data['temp']*Na*kboltz*mh/1.00794)
+    return data['pres']/(data['temp']*kboltz)
 add_field("NumberDensity", function=_NumberDensity,
         units=r'\rm{cm}^{-3}')
 


https://bitbucket.org/yt_analysis/yt/commits/c9739ccc55d3/
Changeset:   c9739ccc55d3
Branch:      yt
User:        jforbes
Date:        2013-07-16 19:04:14
Summary:     Merged yt_analysis/yt into yt
Affected #:  5 files

diff -r 695225600c5b10177bedecbe44e04e36ad425d26 -r c9739ccc55d3b5e3154886b32791a085782941fe yt/config.py
--- a/yt/config.py
+++ b/yt/config.py
@@ -62,7 +62,7 @@
     notebook_password = '',
     answer_testing_tolerance = '3',
     answer_testing_bitwise = 'False',
-    gold_standard_filename = 'gold008',
+    gold_standard_filename = 'gold009',
     local_standard_filename = 'local001',
     sketchfab_api_key = 'None'
     )

diff -r 695225600c5b10177bedecbe44e04e36ad425d26 -r c9739ccc55d3b5e3154886b32791a085782941fe yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -57,7 +57,12 @@
     def __new__(cls, filename=None, *args, **kwargs):
         if not isinstance(filename, types.StringTypes):
             obj = object.__new__(cls)
-            obj.__init__(filename, *args, **kwargs)
+            # The Stream frontend uses a StreamHandler object to pass metadata
+            # to __init__.
+            is_stream = (hasattr(filename, 'get_fields') and
+                         hasattr(filename, 'get_particle_type'))
+            if not is_stream:
+                obj.__init__(filename, *args, **kwargs)
             return obj
         apath = os.path.abspath(filename)
         if not os.path.exists(apath): raise IOError(filename)

diff -r 695225600c5b10177bedecbe44e04e36ad425d26 -r c9739ccc55d3b5e3154886b32791a085782941fe yt/utilities/lib/misc_utilities.pyx
--- a/yt/utilities/lib/misc_utilities.pyx
+++ b/yt/utilities/lib/misc_utilities.pyx
@@ -127,7 +127,7 @@
     cdef int nx = image.shape[0]
     cdef int ny = image.shape[1]
     cdef int nl = xs.shape[0]
-    cdef np.float64_t alpha[4]
+    cdef np.float64_t alpha[4], outa
     cdef int i, j
     cdef int dx, dy, sx, sy, e2, err
     cdef np.int64_t x0, x1, y0, y1
@@ -158,17 +158,21 @@
             elif (x0 >= nx-thick+1 and sx == 1): break
             elif (y0 < thick and sy == -1): break
             elif (y0 >= ny-thick+1 and sy == 1): break
-            if (x0 >=thick and x0 < nx-thick and y0 >= thick and y0 < ny-thick):
-                if has_alpha:
-                    for i in range(4):
-                        image[x0-thick/2:x0+(1+thick)/2, 
-                              y0-thick/2:y0+(1+thick)/2,i] = \
-                                (1.-alpha[3])*image[x0,y0,i] + alpha[i]
-                else:
-                    for i in range(3):
-                        image[x0-thick/2:x0+(1+thick)/2, 
-                              y0-thick/2:y0+(1+thick)/2,i] = \
-                                (1.-alpha[i])*image[x0,y0,i] + alpha[i]
+            if x0 >= thick and x0 < nx-thick and y0 >= thick and y0 < ny-thick:
+                for xi in range(x0-thick/2, x0+(1+thick)/2):
+                    for yi in range(y0-thick/2, y0+(1+thick)/2):
+                        if has_alpha:
+                            image[xi, yi, 3] = outa = alpha[3] + image[xi, yi, 3]*(1-alpha[3])
+                            if outa != 0.0:
+                                outa = 1.0/outa
+                            for i in range(3):
+                                image[xi, yi, i] = \
+                                        ((1.-alpha[3])*image[xi, yi, i]*image[xi, yi, 3]
+                                         + alpha[3]*alpha[i])*outa
+                        else:
+                            for i in range(3):
+                                image[xi, yi, i] = \
+                                        (1.-alpha[i])*image[xi,yi,i] + alpha[i]
 
             if (x0 == x1 and y0 == y1):
                 break

diff -r 695225600c5b10177bedecbe44e04e36ad425d26 -r c9739ccc55d3b5e3154886b32791a085782941fe yt/utilities/physical_constants.py
--- a/yt/utilities/physical_constants.py
+++ b/yt/utilities/physical_constants.py
@@ -1,15 +1,16 @@
 #
 # Physical Constants and Units Conversion Factors
 #
-# Values for these constants are drawn from IAU and IUPAC data 
-# unless otherwise noted:
+# Values for these constants, unless otherwise noted, are drawn from IAU,
+# IUPAC, and NIST data, whichever is newer.
 # http://maia.usno.navy.mil/NSFA/IAU2009_consts.html
 # http://goldbook.iupac.org/list_goldbook_phys_constants_defs.html
+# http://physics.nist.gov/cuu/Constants/index.html
 
 # Masses
-mass_hydrogen_cgs = 1.674534e-24  # g
-mass_electron_cgs = 9.1093898e-28  # g
-amu_cgs           = 1.6605402e-24  # g
+mass_electron_cgs = 9.109382-28  # g
+amu_cgs           = 1.660538921e-24  # g
+mass_hydrogen_cgs = 1.007947*amu_cgs  # g
 mass_sun_cgs = 1.98841586e33  # g
 # Velocities
 speed_of_light_cgs = 2.99792458e10  # cm/s, exact
@@ -22,10 +23,10 @@
 charge_proton_cgs = 4.8032056e-10  # esu = 1.602176487e-19  Coulombs
 
 # Physical Constants
-boltzmann_constant_cgs = 1.3806504e-16  # erg K^-1
-gravitational_constant_cgs  = 6.67428e-8  # cm^3 g^-1 s^-2
-planck_constant_cgs   = 6.62606896e-27  # erg s
-stefan_boltzmann_constant_cgs = 5.67051e-5 # erg cm^-2 s^-1 K^-4
+boltzmann_constant_cgs = 1.3806488e-16  # erg K^-1
+gravitational_constant_cgs  = 6.67384e-8  # cm^3 g^-1 s^-2
+planck_constant_cgs   = 6.62606957e-27  # erg s
+stefan_boltzmann_constant_cgs = 5.670373e-5 # erg cm^-2 s^-1 K^-4
 # The following value was calcualted assuming H = 100 km/s/Mpc.
 # To get the correct value for your cosmological parameters, 
 # you'll need to multiply through by h^2
@@ -69,16 +70,17 @@
 cm_per_pc     = 1.0 / pc_per_cm
 
 # time
+# "IAU Style Manual" by G.A. Wilkins, Comm. 5, in IAU Transactions XXB (1989)
 sec_per_Gyr  = 31.5576e15
 sec_per_Myr  = 31.5576e12
 sec_per_kyr  = 31.5576e9
-sec_per_year = 31.5576e6   # "IAU Style Manual" by G.A. Wilkins, Comm. 5, in IAU Transactions XXB (1989)
+sec_per_year = 31.5576e6
 sec_per_day  = 86400.0
 sec_per_hr   = 3600.0
 day_per_year = 365.25
 
 # temperature / energy
-erg_per_eV = 1.602176487e-12 # http://goldbook.iupac.org/E02014.html
+erg_per_eV = 1.602176562e-12
 erg_per_keV = erg_per_eV * 1.0e3
 K_per_keV = erg_per_keV / boltzmann_constant_cgs
 keV_per_K = 1.0 / K_per_keV

diff -r 695225600c5b10177bedecbe44e04e36ad425d26 -r c9739ccc55d3b5e3154886b32791a085782941fe yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -37,11 +37,9 @@
 from functools import wraps
 from numbers import Number
 
-from ._mpl_imports import \
-    FigureCanvasAgg, FigureCanvasPdf, FigureCanvasPS
+from ._mpl_imports import FigureCanvasAgg
 from .color_maps import yt_colormaps, is_colormap
-from .image_writer import \
-    write_image, apply_colormap
+from .image_writer import apply_colormap
 from .fixed_resolution import \
     FixedResolutionBuffer, \
     ObliqueFixedResolutionBuffer, \
@@ -52,21 +50,20 @@
 from .base_plot_types import ImagePlotMPL
 
 from yt.utilities.delaunay.triangulate import Triangulation as triang
-from yt.config import ytcfg
 from yt.funcs import \
     mylog, defaultdict, iterable, ensure_list, \
     fix_axis, get_image_suffix
 from yt.utilities.lib import write_png_to_string
 from yt.utilities.definitions import \
-    x_dict, x_names, \
-    y_dict, y_names, \
+    x_dict, y_dict, \
     axis_names, axis_labels, \
     formatted_length_unit_names
 from yt.utilities.math_utils import \
     ortho_find
-from yt.utilities.parallel_tools.parallel_analysis_interface import \
-    GroupOwnership
-from yt.utilities.exceptions import YTUnitNotRecognized, YTInvalidWidthError
+from yt.utilities.exceptions import \
+     YTUnitNotRecognized, YTInvalidWidthError, YTCannotParseUnitDisplayName, \
+     YTNotInsideNotebook
+
 from yt.data_objects.time_series import \
     TimeSeriesData
 
@@ -539,12 +536,6 @@
             self.center = new_center
         self.set_window(self.bounds)
 
-    @property
-    def width(self):
-        Wx = self.xlim[1] - self.xlim[0]
-        Wy = self.ylim[1] - self.ylim[0]
-        return (Wx, Wy)
-
     @invalidate_data
     def set_antialias(self,aa):
         self.antialias = aa
@@ -839,10 +830,6 @@
         return xc, yc
 
     def _setup_plots(self):
-        if self._current_field is not None:
-            fields = [self._current_field]
-        else:
-            fields = self._frb.keys()
         self._colorbar_valid = True
         for f in self.fields:
             axis_index = self.data_source.axis
@@ -1081,13 +1068,15 @@
 
     def _send_zmq(self):
         try:
-            # pre-IPython v0.14
+            # pre-IPython v1.0
             from IPython.zmq.pylab.backend_inline import send_figure as display
         except ImportError:
-            # IPython v0.14+
+            # IPython v1.0+
             from IPython.core.display import display
         for k, v in sorted(self.plots.iteritems()):
-            canvas = FigureCanvasAgg(v.figure)
+            # Due to a quirk in the matplotlib API, we need to create
+            # a dummy canvas variable here that is never used.
+            canvas = FigureCanvasAgg(v.figure)  # NOQA
             display(v.figure)
 
     def show(self):


https://bitbucket.org/yt_analysis/yt/commits/8d7f5c67ba8e/
Changeset:   8d7f5c67ba8e
Branch:      yt
User:        John Forbes
Date:        2013-07-16 19:17:44
Summary:     Making abar slightly more robust.
Affected #:  1 file

diff -r 695225600c5b10177bedecbe44e04e36ad425d26 -r 8d7f5c67ba8ee7743618e07d6a1cd63cbd3dacef yt/frontends/flash/fields.py
--- a/yt/frontends/flash/fields.py
+++ b/yt/frontends/flash/fields.py
@@ -366,7 +366,11 @@
 add_field('nion', function=_nion, take_log=True, units=r"\rm{cm}^{-3}")
 
 def _abar(field, data):
-    return 1.0 / data['sumy']
+    try:
+        return 1.0 / data['sumy']
+    except:
+        pass
+    return data['dens']*Na*kboltz*data['temp']/data['pres']
 add_field('abar', function=_abar, take_log=False)
 	
 


https://bitbucket.org/yt_analysis/yt/commits/27125ca05478/
Changeset:   27125ca05478
Branch:      yt
User:        John Forbes
Date:        2013-07-16 19:18:44
Summary:     Merging
Affected #:  5 files

diff -r 8d7f5c67ba8ee7743618e07d6a1cd63cbd3dacef -r 27125ca054789df6869c96f378085486f39c58dc yt/config.py
--- a/yt/config.py
+++ b/yt/config.py
@@ -62,7 +62,7 @@
     notebook_password = '',
     answer_testing_tolerance = '3',
     answer_testing_bitwise = 'False',
-    gold_standard_filename = 'gold008',
+    gold_standard_filename = 'gold009',
     local_standard_filename = 'local001',
     sketchfab_api_key = 'None'
     )

diff -r 8d7f5c67ba8ee7743618e07d6a1cd63cbd3dacef -r 27125ca054789df6869c96f378085486f39c58dc yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -57,7 +57,12 @@
     def __new__(cls, filename=None, *args, **kwargs):
         if not isinstance(filename, types.StringTypes):
             obj = object.__new__(cls)
-            obj.__init__(filename, *args, **kwargs)
+            # The Stream frontend uses a StreamHandler object to pass metadata
+            # to __init__.
+            is_stream = (hasattr(filename, 'get_fields') and
+                         hasattr(filename, 'get_particle_type'))
+            if not is_stream:
+                obj.__init__(filename, *args, **kwargs)
             return obj
         apath = os.path.abspath(filename)
         if not os.path.exists(apath): raise IOError(filename)

diff -r 8d7f5c67ba8ee7743618e07d6a1cd63cbd3dacef -r 27125ca054789df6869c96f378085486f39c58dc yt/utilities/lib/misc_utilities.pyx
--- a/yt/utilities/lib/misc_utilities.pyx
+++ b/yt/utilities/lib/misc_utilities.pyx
@@ -127,7 +127,7 @@
     cdef int nx = image.shape[0]
     cdef int ny = image.shape[1]
     cdef int nl = xs.shape[0]
-    cdef np.float64_t alpha[4]
+    cdef np.float64_t alpha[4], outa
     cdef int i, j
     cdef int dx, dy, sx, sy, e2, err
     cdef np.int64_t x0, x1, y0, y1
@@ -158,17 +158,21 @@
             elif (x0 >= nx-thick+1 and sx == 1): break
             elif (y0 < thick and sy == -1): break
             elif (y0 >= ny-thick+1 and sy == 1): break
-            if (x0 >=thick and x0 < nx-thick and y0 >= thick and y0 < ny-thick):
-                if has_alpha:
-                    for i in range(4):
-                        image[x0-thick/2:x0+(1+thick)/2, 
-                              y0-thick/2:y0+(1+thick)/2,i] = \
-                                (1.-alpha[3])*image[x0,y0,i] + alpha[i]
-                else:
-                    for i in range(3):
-                        image[x0-thick/2:x0+(1+thick)/2, 
-                              y0-thick/2:y0+(1+thick)/2,i] = \
-                                (1.-alpha[i])*image[x0,y0,i] + alpha[i]
+            if x0 >= thick and x0 < nx-thick and y0 >= thick and y0 < ny-thick:
+                for xi in range(x0-thick/2, x0+(1+thick)/2):
+                    for yi in range(y0-thick/2, y0+(1+thick)/2):
+                        if has_alpha:
+                            image[xi, yi, 3] = outa = alpha[3] + image[xi, yi, 3]*(1-alpha[3])
+                            if outa != 0.0:
+                                outa = 1.0/outa
+                            for i in range(3):
+                                image[xi, yi, i] = \
+                                        ((1.-alpha[3])*image[xi, yi, i]*image[xi, yi, 3]
+                                         + alpha[3]*alpha[i])*outa
+                        else:
+                            for i in range(3):
+                                image[xi, yi, i] = \
+                                        (1.-alpha[i])*image[xi,yi,i] + alpha[i]
 
             if (x0 == x1 and y0 == y1):
                 break

diff -r 8d7f5c67ba8ee7743618e07d6a1cd63cbd3dacef -r 27125ca054789df6869c96f378085486f39c58dc yt/utilities/physical_constants.py
--- a/yt/utilities/physical_constants.py
+++ b/yt/utilities/physical_constants.py
@@ -1,15 +1,16 @@
 #
 # Physical Constants and Units Conversion Factors
 #
-# Values for these constants are drawn from IAU and IUPAC data 
-# unless otherwise noted:
+# Values for these constants, unless otherwise noted, are drawn from IAU,
+# IUPAC, and NIST data, whichever is newer.
 # http://maia.usno.navy.mil/NSFA/IAU2009_consts.html
 # http://goldbook.iupac.org/list_goldbook_phys_constants_defs.html
+# http://physics.nist.gov/cuu/Constants/index.html
 
 # Masses
-mass_hydrogen_cgs = 1.674534e-24  # g
-mass_electron_cgs = 9.1093898e-28  # g
-amu_cgs           = 1.6605402e-24  # g
+mass_electron_cgs = 9.109382-28  # g
+amu_cgs           = 1.660538921e-24  # g
+mass_hydrogen_cgs = 1.007947*amu_cgs  # g
 mass_sun_cgs = 1.98841586e33  # g
 # Velocities
 speed_of_light_cgs = 2.99792458e10  # cm/s, exact
@@ -22,10 +23,10 @@
 charge_proton_cgs = 4.8032056e-10  # esu = 1.602176487e-19  Coulombs
 
 # Physical Constants
-boltzmann_constant_cgs = 1.3806504e-16  # erg K^-1
-gravitational_constant_cgs  = 6.67428e-8  # cm^3 g^-1 s^-2
-planck_constant_cgs   = 6.62606896e-27  # erg s
-stefan_boltzmann_constant_cgs = 5.67051e-5 # erg cm^-2 s^-1 K^-4
+boltzmann_constant_cgs = 1.3806488e-16  # erg K^-1
+gravitational_constant_cgs  = 6.67384e-8  # cm^3 g^-1 s^-2
+planck_constant_cgs   = 6.62606957e-27  # erg s
+stefan_boltzmann_constant_cgs = 5.670373e-5 # erg cm^-2 s^-1 K^-4
 # The following value was calcualted assuming H = 100 km/s/Mpc.
 # To get the correct value for your cosmological parameters, 
 # you'll need to multiply through by h^2
@@ -69,16 +70,17 @@
 cm_per_pc     = 1.0 / pc_per_cm
 
 # time
+# "IAU Style Manual" by G.A. Wilkins, Comm. 5, in IAU Transactions XXB (1989)
 sec_per_Gyr  = 31.5576e15
 sec_per_Myr  = 31.5576e12
 sec_per_kyr  = 31.5576e9
-sec_per_year = 31.5576e6   # "IAU Style Manual" by G.A. Wilkins, Comm. 5, in IAU Transactions XXB (1989)
+sec_per_year = 31.5576e6
 sec_per_day  = 86400.0
 sec_per_hr   = 3600.0
 day_per_year = 365.25
 
 # temperature / energy
-erg_per_eV = 1.602176487e-12 # http://goldbook.iupac.org/E02014.html
+erg_per_eV = 1.602176562e-12
 erg_per_keV = erg_per_eV * 1.0e3
 K_per_keV = erg_per_keV / boltzmann_constant_cgs
 keV_per_K = 1.0 / K_per_keV

diff -r 8d7f5c67ba8ee7743618e07d6a1cd63cbd3dacef -r 27125ca054789df6869c96f378085486f39c58dc yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -37,11 +37,9 @@
 from functools import wraps
 from numbers import Number
 
-from ._mpl_imports import \
-    FigureCanvasAgg, FigureCanvasPdf, FigureCanvasPS
+from ._mpl_imports import FigureCanvasAgg
 from .color_maps import yt_colormaps, is_colormap
-from .image_writer import \
-    write_image, apply_colormap
+from .image_writer import apply_colormap
 from .fixed_resolution import \
     FixedResolutionBuffer, \
     ObliqueFixedResolutionBuffer, \
@@ -52,21 +50,20 @@
 from .base_plot_types import ImagePlotMPL
 
 from yt.utilities.delaunay.triangulate import Triangulation as triang
-from yt.config import ytcfg
 from yt.funcs import \
     mylog, defaultdict, iterable, ensure_list, \
     fix_axis, get_image_suffix
 from yt.utilities.lib import write_png_to_string
 from yt.utilities.definitions import \
-    x_dict, x_names, \
-    y_dict, y_names, \
+    x_dict, y_dict, \
     axis_names, axis_labels, \
     formatted_length_unit_names
 from yt.utilities.math_utils import \
     ortho_find
-from yt.utilities.parallel_tools.parallel_analysis_interface import \
-    GroupOwnership
-from yt.utilities.exceptions import YTUnitNotRecognized, YTInvalidWidthError
+from yt.utilities.exceptions import \
+     YTUnitNotRecognized, YTInvalidWidthError, YTCannotParseUnitDisplayName, \
+     YTNotInsideNotebook
+
 from yt.data_objects.time_series import \
     TimeSeriesData
 
@@ -539,12 +536,6 @@
             self.center = new_center
         self.set_window(self.bounds)
 
-    @property
-    def width(self):
-        Wx = self.xlim[1] - self.xlim[0]
-        Wy = self.ylim[1] - self.ylim[0]
-        return (Wx, Wy)
-
     @invalidate_data
     def set_antialias(self,aa):
         self.antialias = aa
@@ -839,10 +830,6 @@
         return xc, yc
 
     def _setup_plots(self):
-        if self._current_field is not None:
-            fields = [self._current_field]
-        else:
-            fields = self._frb.keys()
         self._colorbar_valid = True
         for f in self.fields:
             axis_index = self.data_source.axis
@@ -1081,13 +1068,15 @@
 
     def _send_zmq(self):
         try:
-            # pre-IPython v0.14
+            # pre-IPython v1.0
             from IPython.zmq.pylab.backend_inline import send_figure as display
         except ImportError:
-            # IPython v0.14+
+            # IPython v1.0+
             from IPython.core.display import display
         for k, v in sorted(self.plots.iteritems()):
-            canvas = FigureCanvasAgg(v.figure)
+            # Due to a quirk in the matplotlib API, we need to create
+            # a dummy canvas variable here that is never used.
+            canvas = FigureCanvasAgg(v.figure)  # NOQA
             display(v.figure)
 
     def show(self):


https://bitbucket.org/yt_analysis/yt/commits/fe5d507ced3d/
Changeset:   fe5d507ced3d
Branch:      yt
User:        jzuhone
Date:        2013-07-19 03:36:14
Summary:     Merged in jforbes/yt (pull request #551)

Add a NumberDensity field to FLASH frontend.
Affected #:  1 file

diff -r f15815e182080e8619efd2636cce42bc6e598b7c -r fe5d507ced3db8b97fe29249b1f3ff2f0055fc3c yt/frontends/flash/fields.py
--- a/yt/frontends/flash/fields.py
+++ b/yt/frontends/flash/fields.py
@@ -366,5 +366,21 @@
 add_field('nion', function=_nion, take_log=True, units=r"\rm{cm}^{-3}")
 
 def _abar(field, data):
-    return 1.0 / data['sumy']
+    try:
+        return 1.0 / data['sumy']
+    except:
+        pass
+    return data['dens']*Na*kboltz*data['temp']/data['pres']
 add_field('abar', function=_abar, take_log=False)
+	
+
+def _NumberDensity(fields,data) :
+    try:
+        return data["nele"]+data["nion"]
+    except:
+        pass
+    return data['pres']/(data['temp']*kboltz)
+add_field("NumberDensity", function=_NumberDensity,
+        units=r'\rm{cm}^{-3}')
+
+

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