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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sat Jun 28 09:55:25 PDT 2014


12 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/3879b168a621/
Changeset:   3879b168a621
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-06-25 21:28:00
Summary:     Getting rid of error from division by zero.
Affected #:  1 file

diff -r 35cecc8a0a24bbf074956ef320f70e0e686478a7 -r 3879b168a621fc297f39053931b28dd598d58d33 yt/data_objects/profiles.py
--- a/yt/data_objects/profiles.py
+++ b/yt/data_objects/profiles.py
@@ -811,6 +811,8 @@
         blank = ~temp_storage.used
         self.used = temp_storage.used
         if self.weight_field is not None:
+            # This is unnecessary, but it will suppress division errors.
+            temp_storage.weight_values[blank] = 1e-30
             temp_storage.values /= temp_storage.weight_values[...,None]
             self.weight = temp_storage.weight_values[...,None]
             self.weight[blank] = 0.0


https://bitbucket.org/yt_analysis/yt/commits/225232ca2dc8/
Changeset:   225232ca2dc8
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-06-25 21:40:07
Summary:     Update to new API for profiles.  STD still not functional.
Affected #:  1 file

diff -r 3879b168a621fc297f39053931b28dd598d58d33 -r 225232ca2dc8ed9fb531f4bbefc21982c40ffce5 doc/source/cookbook/profile_with_variance.py
--- a/doc/source/cookbook/profile_with_variance.py
+++ b/doc/source/cookbook/profile_with_variance.py
@@ -16,17 +16,15 @@
 
 # Create a 1D profile object for profiles over radius
 # and add a velocity profile.
-prof = yt.ProfilePlot(sp, 'radius', 'velocity_magnitude', 
-                      weight_field='cell_mass')
-prof.set_unit('radius', 'kpc')
-prof.set_xlim(0.1, 1000)
+prof = yt.create_profile(sp, 'radius', 'velocity_magnitude',
+                         units = {'radius': 'kpc'},
+                         extrema = {'radius': ((0.1, 'kpc'), (1000.0, 'kpc'))},
+                         weight_field='cell_mass')
 
 # Plot the average velocity magnitude.
-plt.loglog(prof['radius'], prof['velocity_magnitude'],
-              label='Mean')
+plt.loglog(prof.x, prof['velocity_magnitude'], label='Mean')
 # Plot the variance of the velocity madnitude.
-plt.loglog(prof['radius'], prof['velocity_magnitude_std'],
-              label='Standard Deviation')
+plt.loglog(prof.x, prof['velocity_magnitude_std'], label='Standard Deviation')
 plt.xlabel('r [kpc]')
 plt.ylabel('v [cm/s]')
 plt.legend()


https://bitbucket.org/yt_analysis/yt/commits/df34a428999c/
Changeset:   df34a428999c
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-06-25 21:45:27
Summary:     Updating rad_velocity.
Affected #:  1 file

diff -r 225232ca2dc8ed9fb531f4bbefc21982c40ffce5 -r df34a428999cb3208607fe6c390e630d7f539241 doc/source/cookbook/rad_velocity.py
--- a/doc/source/cookbook/rad_velocity.py
+++ b/doc/source/cookbook/rad_velocity.py
@@ -21,18 +21,15 @@
 
 # Radial profile without correction
 
-rp0 = yt.ProfilePlot(sp0, 'radius', 'radial_velocity')
-rp0.set_unit('radius', 'kpc')
-rp0.set_log('radius', False)
+rp0 = yt.create_profile(sp0, 'radius', 'radial_velocity',
+        units = {'radius': 'kpc'},
+        logs = {'radius': False})
 
 # Radial profile with correction for bulk velocity
 
-rp1 = yt.ProfilePlot(sp1, 'radius', 'radial_velocity')
-rp1.set_unit('radius', 'kpc')
-rp1.set_log('radius', False)
-
-#rp0.save('radial_velocity_profile_uncorrected.png')
-#rp1.save('radial_velocity_profile_corrected.png')
+rp1 = yt.create_profile(sp1, 'radius', 'radial_velocity',
+        units = {'radius': 'kpc'},
+        logs = {'radius': False})
 
 # Make a plot using matplotlib
 
@@ -40,8 +37,8 @@
 ax = fig.add_subplot(111)
 
 # Here we scale the velocities by 1.0e5 to get into km/s
-ax.plot(rad_profile0["Radiuskpc"], rad_profile0["RadialVelocity"]/1.0e5,
-		rad_profile1["Radiuskpc"], rad_profile1["RadialVelocity"]/1.0e5)
+ax.plot(rp0.x, rp0["radial_velocity"].in_units("km/s"),
+		rp1.x, rp1["radial_velocity"].in_units("km/s"))
 
 ax.set_xlabel(r"$\mathrm{r\ (kpc)}$")
 ax.set_ylabel(r"$\mathrm{v_r\ (km/s)}$")


https://bitbucket.org/yt_analysis/yt/commits/659dad5d403a/
Changeset:   659dad5d403a
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-06-25 21:49:51
Summary:     Updating radial profile styles.
Affected #:  1 file

diff -r df34a428999cb3208607fe6c390e630d7f539241 -r 659dad5d403a707a8395ab6ff9d6cac2cdac7649 doc/source/cookbook/radial_profile_styles.py
--- a/doc/source/cookbook/radial_profile_styles.py
+++ b/doc/source/cookbook/radial_profile_styles.py
@@ -15,8 +15,9 @@
 #rp = BinnedProfile1D(sphere, 100, "Radiuskpc", 0.0, 500., log_space=False)
 #rp.add_fields("density","temperature")
 rp = yt.ProfilePlot(sp, 'radius', ['density', 'temperature'])
-rp.set_unit('radius', 'kpc')
-rp.set_log('radius', False)
+rp = yt.create_profile(sp, 'radius', ['density', 'temperature'],
+                       units = {'radius': 'kpc'},
+                       logs = {'radius': False})
 
 # Make plots using matplotlib
 
@@ -24,7 +25,7 @@
 ax = fig.add_subplot(111)
 
 # Plot the density as a log-log plot using the default settings
-dens_plot = ax.loglog(rp["Radiuskpc"], rp["density"])
+dens_plot = ax.loglog(rp.x, rp["density"])
 
 # Here we set the labels of the plot axes
 
@@ -52,15 +53,3 @@
 dens_plot[0].set_markersize(10)
 
 fig.savefig("density_profile_thick_with_xs.png")
-
-# Now get rid of the line on the axes plot
-
-ax.lines = []
-
-# Since the radial profile object also includes the standard deviation in each bin,
-# we'll use these as errorbars. We have to make a new plot for this:
-
-dens_err_plot = ax.errorbar(pr["Radiuskpc"], rp["density"],
-                            yerr=rp["Density_std"])
-                                                        
-fig.savefig("density_profile_with_errorbars.png")


https://bitbucket.org/yt_analysis/yt/commits/67881d543010/
Changeset:   67881d543010
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-06-25 21:52:57
Summary:     Turn off logging to make profile continuous.
Affected #:  1 file

diff -r 659dad5d403a707a8395ab6ff9d6cac2cdac7649 -r 67881d5430109cc014aa732f7ad87d47a39a0697 doc/source/cookbook/simple_profile.py
--- a/doc/source/cookbook/simple_profile.py
+++ b/doc/source/cookbook/simple_profile.py
@@ -12,6 +12,7 @@
 sphere = ds.sphere("c", (100., "kpc"))
 plot = yt.ProfilePlot(sphere, "density", ["temperature", "velocity_x"],
                       weight_field="cell_mass")
+plot.set_log("velocity_x", False)
 
 # Save the image.
 # Optionally, give a string as an argument


https://bitbucket.org/yt_analysis/yt/commits/b2b07705b2c9/
Changeset:   b2b07705b2c9
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-06-25 22:06:59
Summary:     We can clear our axes in advance.  Otherwise we wipe out time series.
Affected #:  1 file

diff -r 67881d5430109cc014aa732f7ad87d47a39a0697 -r b2b07705b2c947dd62606eb7938b6734716a6b3d yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -317,10 +317,10 @@
         return ret
 
     def _setup_plots(self):
+        for f in self.axes:
+            self.axes[field].cla()
         for i, profile in enumerate(self.profiles):
             for field, field_data in profile.items():
-                if field in self.axes:
-                    self.axes[field].cla()
                 self.axes[field].plot(np.array(profile.x), np.array(field_data),
                                       label=self.label[i], **self.plot_spec[i])
         


https://bitbucket.org/yt_analysis/yt/commits/e53cdfa6219f/
Changeset:   e53cdfa6219f
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-06-25 23:37:09
Summary:     Correcting typo.
Affected #:  1 file

diff -r b2b07705b2c947dd62606eb7938b6734716a6b3d -r e53cdfa6219f33f7bbb5e4655e33591278e32f15 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -318,7 +318,7 @@
 
     def _setup_plots(self):
         for f in self.axes:
-            self.axes[field].cla()
+            self.axes[f].cla()
         for i, profile in enumerate(self.profiles):
             for field, field_data in profile.items():
                 self.axes[field].plot(np.array(profile.x), np.array(field_data),


https://bitbucket.org/yt_analysis/yt/commits/5a463530b4e4/
Changeset:   5a463530b4e4
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-06-26 00:16:16
Summary:     rvec doesn't need to subtract center.
Affected #:  1 file

diff -r e53cdfa6219f33f7bbb5e4655e33591278e32f15 -r 5a463530b4e4bf599619633e953c3888eab53bb8 yt/fields/angular_momentum.py
--- a/yt/fields/angular_momentum.py
+++ b/yt/fields/angular_momentum.py
@@ -45,28 +45,25 @@
     def _specific_angular_momentum_x(field, data):
         xv, yv, zv = obtain_velocities(data, ftype)
         center = data.get_field_parameter('center')
-        v_vec = obtain_rvec(data)
-        v_vec = np.rollaxis(v_vec, 0, len(v_vec.shape))
-        v_vec = data.pf.arr(v_vec, input_units = data["index", "x"].units)
-        rv = v_vec - center
+        rv = obtain_rvec(data)
+        rv = np.rollaxis(rv, 0, len(rv.shape))
+        rv = data.pf.arr(rv, input_units = data["index", "x"].units)
         return yv * rv[...,2] - zv * rv[...,1]
 
     def _specific_angular_momentum_y(field, data):
         xv, yv, zv = obtain_velocities(data, ftype)
         center = data.get_field_parameter('center')
-        v_vec = obtain_rvec(data)
-        v_vec = np.rollaxis(v_vec, 0, len(v_vec.shape))
-        v_vec = data.pf.arr(v_vec, input_units = data["index", "x"].units)
-        rv = v_vec - center
+        rv = obtain_rvec(data)
+        rv = np.rollaxis(rv, 0, len(rv.shape))
+        rv = data.pf.arr(rv, input_units = data["index", "x"].units)
         return - (xv * rv[...,2] - zv * rv[...,0])
 
     def _specific_angular_momentum_z(field, data):
         xv, yv, zv = obtain_velocities(data, ftype)
         center = data.get_field_parameter('center')
-        v_vec = obtain_rvec(data)
-        v_vec = np.rollaxis(v_vec, 0, len(v_vec.shape))
-        v_vec = data.pf.arr(v_vec, input_units = data["index", "x"].units)
-        rv = v_vec - center
+        rv = obtain_rvec(data)
+        rv = np.rollaxis(rv, 0, len(rv.shape))
+        rv = data.pf.arr(rv, input_units = data["index", "x"].units)
         return xv * rv[...,1] - yv * rv[...,0]
 
     registry.add_field((ftype, "specific_angular_momentum_x"),


https://bitbucket.org/yt_analysis/yt/commits/a5f44879470c/
Changeset:   a5f44879470c
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-06-26 00:17:28
Summary:     Removing save_profiles.
Affected #:  1 file

diff -r 5a463530b4e4bf599619633e953c3888eab53bb8 -r a5f44879470c4e471a70241d7fe6d51092363669 doc/source/cookbook/save_profiles.py
--- a/doc/source/cookbook/save_profiles.py
+++ /dev/null
@@ -1,72 +0,0 @@
-### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
-### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
-
-import yt
-import matplotlib.pyplot as plt
-import h5py as h5
-
-ds = yt.load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
-
-# Get a sphere
-
-sp = ds.sphere(ds.domain_center, (500., "kpc"))
-
-# Radial profile from the sphere
-
-prof = yt.BinnedProfile1D(sp, 100, "Radiuskpc", 0.0, 500., log_space=False)
-prof = yt.ProfilePlot(sp, 'radius', ['density', 'temperature'], weight_field="cell_mass")
-prof.set_unit('radius', 'kpc')
-prof.set_log('radius', False)
-prof.set_xlim(0, 500)
-
-# Write profiles to ASCII file
-
-prof.write_out("%s_profile.dat" % ds, bin_style="center")
-
-# Write profiles to HDF5 file
-
-prof.write_out_h5("%s_profile.h5" % ds, bin_style="center")
-
-# Now we will show how using NumPy, h5py, and Matplotlib the data in these
-# files may be plotted.
-
-# Plot density from ASCII file
-
-# Open the text file using NumPy's "loadtxt" method. In order to get the 
-# separate columns into separate NumPy arrays, it is essential to set unpack=True.
-
-r, dens, std_dens, temp, std_temp = \
-	np.loadtxt("sloshing_nomag2_hdf5_plt_cnt_0150_profile.dat", unpack=True)
-
-fig1 = plt.figure()
-
-ax = fig1.add_subplot(111)
-ax.plot(r, dens)
-ax.set_xlabel(r"$\mathrm{r\ (kpc)}$")
-ax.set_ylabel(r"$\mathrm{\rho\ (g\ cm^{-3})}$")
-ax.set_title("Density vs. Radius")
-fig1.savefig("%s_dens.png" % ds)
-
-# Plot temperature from HDF5 file
-
-# Get the file handle
-
-f = h5py.File("%s_profile.h5" % ds, "r")
-
-# Get the radius and temperature arrays from the file handle
-
-r = f["/Radiuskpc-1d"].attrs["x-axis-Radiuskpc"][:]
-temp = f["/Radiuskpc-1d/temperature"][:]
-
-# Close the file handle
-
-f.close()
-
-fig2 = plt.figure()
-
-ax = fig2.add_subplot(111)
-ax.plot(r, temp)
-ax.set_xlabel(r"$\mathrm{r\ (kpc)}$")
-ax.set_ylabel(r"$\mathrm{T\ (K)}$")
-ax.set_title("temperature vs. Radius")
-fig2.savefig("%s_temp.png" % ds)


https://bitbucket.org/yt_analysis/yt/commits/35a9ad3ee660/
Changeset:   35a9ad3ee660
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-06-26 03:16:58
Summary:     Remove the GZ-requiring field.
Affected #:  1 file

diff -r a5f44879470c4e471a70241d7fe6d51092363669 -r 35a9ad3ee6600e56e437476ebad6fae829b8e48f doc/source/cookbook/simple_slice_with_multiple_fields.py
--- a/doc/source/cookbook/simple_slice_with_multiple_fields.py
+++ b/doc/source/cookbook/simple_slice_with_multiple_fields.py
@@ -7,5 +7,5 @@
 ds = yt.load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
 
 # Create density slices of several fields along the x axis
-yt.SlicePlot(ds, 'x', ['density','temperature','pressure','vorticity_squared'], 
+yt.SlicePlot(ds, 'x', ['density','temperature','pressure'], 
              width = (800.0, 'kpc')).save()


https://bitbucket.org/yt_analysis/yt/commits/e6e621c385c3/
Changeset:   e6e621c385c3
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-06-26 03:52:59
Summary:     Fixing cell count for brick ray casting.
Affected #:  1 file

diff -r 35a9ad3ee6600e56e437476ebad6fae829b8e48f -r e6e621c385c34024232b1c25ba4ee7f49188c152 yt/visualization/volume_rendering/camera.py
--- a/yt/visualization/volume_rendering/camera.py
+++ b/yt/visualization/volume_rendering/camera.py
@@ -581,7 +581,8 @@
         return image
 
     def _render(self, double_check, num_threads, image, sampler):
-        pbar = get_pbar("Ray casting", (self.volume.brick_dimensions + 1).prod(axis=-1).sum())
+        ncells = sum(b.source_mask.size for b in self.volume.bricks)
+        pbar = get_pbar("Ray casting", ncells)
         total_cells = 0
         if double_check:
             for brick in self.volume.bricks:
@@ -592,7 +593,7 @@
         view_pos = self.front_center + self.orienter.unit_vectors[2] * 1.0e6 * self.width[2]
         for brick in self.volume.traverse(view_pos):
             sampler(brick, num_threads=num_threads)
-            total_cells += np.prod(brick.my_data[0].shape)
+            total_cells += brick.source_mask.size
             pbar.update(total_cells)
 
         pbar.finish()


https://bitbucket.org/yt_analysis/yt/commits/395cbbd74d04/
Changeset:   395cbbd74d04
Branch:      yt-3.0
User:        ngoldbaum
Date:        2014-06-28 18:55:17
Summary:     Merged in MatthewTurk/yt/yt-3.0 (pull request #983)

Fix cookbook recipes
Affected #:  10 files

diff -r 15bf4f304a0e8b46658a6a7a1b887e4cc60722bb -r 395cbbd74d0469288a679cc5fa559d4a8b8bad9b doc/source/cookbook/profile_with_variance.py
--- a/doc/source/cookbook/profile_with_variance.py
+++ b/doc/source/cookbook/profile_with_variance.py
@@ -16,17 +16,15 @@
 
 # Create a 1D profile object for profiles over radius
 # and add a velocity profile.
-prof = yt.ProfilePlot(sp, 'radius', 'velocity_magnitude', 
-                      weight_field='cell_mass')
-prof.set_unit('radius', 'kpc')
-prof.set_xlim(0.1, 1000)
+prof = yt.create_profile(sp, 'radius', 'velocity_magnitude',
+                         units = {'radius': 'kpc'},
+                         extrema = {'radius': ((0.1, 'kpc'), (1000.0, 'kpc'))},
+                         weight_field='cell_mass')
 
 # Plot the average velocity magnitude.
-plt.loglog(prof['radius'], prof['velocity_magnitude'],
-              label='Mean')
+plt.loglog(prof.x, prof['velocity_magnitude'], label='Mean')
 # Plot the variance of the velocity madnitude.
-plt.loglog(prof['radius'], prof['velocity_magnitude_std'],
-              label='Standard Deviation')
+plt.loglog(prof.x, prof['velocity_magnitude_std'], label='Standard Deviation')
 plt.xlabel('r [kpc]')
 plt.ylabel('v [cm/s]')
 plt.legend()

diff -r 15bf4f304a0e8b46658a6a7a1b887e4cc60722bb -r 395cbbd74d0469288a679cc5fa559d4a8b8bad9b doc/source/cookbook/rad_velocity.py
--- a/doc/source/cookbook/rad_velocity.py
+++ b/doc/source/cookbook/rad_velocity.py
@@ -21,18 +21,15 @@
 
 # Radial profile without correction
 
-rp0 = yt.ProfilePlot(sp0, 'radius', 'radial_velocity')
-rp0.set_unit('radius', 'kpc')
-rp0.set_log('radius', False)
+rp0 = yt.create_profile(sp0, 'radius', 'radial_velocity',
+        units = {'radius': 'kpc'},
+        logs = {'radius': False})
 
 # Radial profile with correction for bulk velocity
 
-rp1 = yt.ProfilePlot(sp1, 'radius', 'radial_velocity')
-rp1.set_unit('radius', 'kpc')
-rp1.set_log('radius', False)
-
-#rp0.save('radial_velocity_profile_uncorrected.png')
-#rp1.save('radial_velocity_profile_corrected.png')
+rp1 = yt.create_profile(sp1, 'radius', 'radial_velocity',
+        units = {'radius': 'kpc'},
+        logs = {'radius': False})
 
 # Make a plot using matplotlib
 
@@ -40,8 +37,8 @@
 ax = fig.add_subplot(111)
 
 # Here we scale the velocities by 1.0e5 to get into km/s
-ax.plot(rad_profile0["Radiuskpc"], rad_profile0["RadialVelocity"]/1.0e5,
-		rad_profile1["Radiuskpc"], rad_profile1["RadialVelocity"]/1.0e5)
+ax.plot(rp0.x, rp0["radial_velocity"].in_units("km/s"),
+		rp1.x, rp1["radial_velocity"].in_units("km/s"))
 
 ax.set_xlabel(r"$\mathrm{r\ (kpc)}$")
 ax.set_ylabel(r"$\mathrm{v_r\ (km/s)}$")

diff -r 15bf4f304a0e8b46658a6a7a1b887e4cc60722bb -r 395cbbd74d0469288a679cc5fa559d4a8b8bad9b doc/source/cookbook/radial_profile_styles.py
--- a/doc/source/cookbook/radial_profile_styles.py
+++ b/doc/source/cookbook/radial_profile_styles.py
@@ -15,8 +15,9 @@
 #rp = BinnedProfile1D(sphere, 100, "Radiuskpc", 0.0, 500., log_space=False)
 #rp.add_fields("density","temperature")
 rp = yt.ProfilePlot(sp, 'radius', ['density', 'temperature'])
-rp.set_unit('radius', 'kpc')
-rp.set_log('radius', False)
+rp = yt.create_profile(sp, 'radius', ['density', 'temperature'],
+                       units = {'radius': 'kpc'},
+                       logs = {'radius': False})
 
 # Make plots using matplotlib
 
@@ -24,7 +25,7 @@
 ax = fig.add_subplot(111)
 
 # Plot the density as a log-log plot using the default settings
-dens_plot = ax.loglog(rp["Radiuskpc"], rp["density"])
+dens_plot = ax.loglog(rp.x, rp["density"])
 
 # Here we set the labels of the plot axes
 
@@ -52,15 +53,3 @@
 dens_plot[0].set_markersize(10)
 
 fig.savefig("density_profile_thick_with_xs.png")
-
-# Now get rid of the line on the axes plot
-
-ax.lines = []
-
-# Since the radial profile object also includes the standard deviation in each bin,
-# we'll use these as errorbars. We have to make a new plot for this:
-
-dens_err_plot = ax.errorbar(pr["Radiuskpc"], rp["density"],
-                            yerr=rp["Density_std"])
-                                                        
-fig.savefig("density_profile_with_errorbars.png")

diff -r 15bf4f304a0e8b46658a6a7a1b887e4cc60722bb -r 395cbbd74d0469288a679cc5fa559d4a8b8bad9b doc/source/cookbook/save_profiles.py
--- a/doc/source/cookbook/save_profiles.py
+++ /dev/null
@@ -1,72 +0,0 @@
-### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
-### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
-
-import yt
-import matplotlib.pyplot as plt
-import h5py as h5
-
-ds = yt.load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
-
-# Get a sphere
-
-sp = ds.sphere(ds.domain_center, (500., "kpc"))
-
-# Radial profile from the sphere
-
-prof = yt.BinnedProfile1D(sp, 100, "Radiuskpc", 0.0, 500., log_space=False)
-prof = yt.ProfilePlot(sp, 'radius', ['density', 'temperature'], weight_field="cell_mass")
-prof.set_unit('radius', 'kpc')
-prof.set_log('radius', False)
-prof.set_xlim(0, 500)
-
-# Write profiles to ASCII file
-
-prof.write_out("%s_profile.dat" % ds, bin_style="center")
-
-# Write profiles to HDF5 file
-
-prof.write_out_h5("%s_profile.h5" % ds, bin_style="center")
-
-# Now we will show how using NumPy, h5py, and Matplotlib the data in these
-# files may be plotted.
-
-# Plot density from ASCII file
-
-# Open the text file using NumPy's "loadtxt" method. In order to get the 
-# separate columns into separate NumPy arrays, it is essential to set unpack=True.
-
-r, dens, std_dens, temp, std_temp = \
-	np.loadtxt("sloshing_nomag2_hdf5_plt_cnt_0150_profile.dat", unpack=True)
-
-fig1 = plt.figure()
-
-ax = fig1.add_subplot(111)
-ax.plot(r, dens)
-ax.set_xlabel(r"$\mathrm{r\ (kpc)}$")
-ax.set_ylabel(r"$\mathrm{\rho\ (g\ cm^{-3})}$")
-ax.set_title("Density vs. Radius")
-fig1.savefig("%s_dens.png" % ds)
-
-# Plot temperature from HDF5 file
-
-# Get the file handle
-
-f = h5py.File("%s_profile.h5" % ds, "r")
-
-# Get the radius and temperature arrays from the file handle
-
-r = f["/Radiuskpc-1d"].attrs["x-axis-Radiuskpc"][:]
-temp = f["/Radiuskpc-1d/temperature"][:]
-
-# Close the file handle
-
-f.close()
-
-fig2 = plt.figure()
-
-ax = fig2.add_subplot(111)
-ax.plot(r, temp)
-ax.set_xlabel(r"$\mathrm{r\ (kpc)}$")
-ax.set_ylabel(r"$\mathrm{T\ (K)}$")
-ax.set_title("temperature vs. Radius")
-fig2.savefig("%s_temp.png" % ds)

diff -r 15bf4f304a0e8b46658a6a7a1b887e4cc60722bb -r 395cbbd74d0469288a679cc5fa559d4a8b8bad9b doc/source/cookbook/simple_profile.py
--- a/doc/source/cookbook/simple_profile.py
+++ b/doc/source/cookbook/simple_profile.py
@@ -12,6 +12,7 @@
 sphere = ds.sphere("c", (100., "kpc"))
 plot = yt.ProfilePlot(sphere, "density", ["temperature", "velocity_x"],
                       weight_field="cell_mass")
+plot.set_log("velocity_x", False)
 
 # Save the image.
 # Optionally, give a string as an argument

diff -r 15bf4f304a0e8b46658a6a7a1b887e4cc60722bb -r 395cbbd74d0469288a679cc5fa559d4a8b8bad9b doc/source/cookbook/simple_slice_with_multiple_fields.py
--- a/doc/source/cookbook/simple_slice_with_multiple_fields.py
+++ b/doc/source/cookbook/simple_slice_with_multiple_fields.py
@@ -7,5 +7,5 @@
 ds = yt.load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
 
 # Create density slices of several fields along the x axis
-yt.SlicePlot(ds, 'x', ['density','temperature','pressure','vorticity_squared'], 
+yt.SlicePlot(ds, 'x', ['density','temperature','pressure'], 
              width = (800.0, 'kpc')).save()

diff -r 15bf4f304a0e8b46658a6a7a1b887e4cc60722bb -r 395cbbd74d0469288a679cc5fa559d4a8b8bad9b yt/data_objects/profiles.py
--- a/yt/data_objects/profiles.py
+++ b/yt/data_objects/profiles.py
@@ -811,6 +811,8 @@
         blank = ~temp_storage.used
         self.used = temp_storage.used
         if self.weight_field is not None:
+            # This is unnecessary, but it will suppress division errors.
+            temp_storage.weight_values[blank] = 1e-30
             temp_storage.values /= temp_storage.weight_values[...,None]
             self.weight = temp_storage.weight_values[...,None]
             self.weight[blank] = 0.0

diff -r 15bf4f304a0e8b46658a6a7a1b887e4cc60722bb -r 395cbbd74d0469288a679cc5fa559d4a8b8bad9b yt/fields/angular_momentum.py
--- a/yt/fields/angular_momentum.py
+++ b/yt/fields/angular_momentum.py
@@ -45,28 +45,25 @@
     def _specific_angular_momentum_x(field, data):
         xv, yv, zv = obtain_velocities(data, ftype)
         center = data.get_field_parameter('center')
-        v_vec = obtain_rvec(data)
-        v_vec = np.rollaxis(v_vec, 0, len(v_vec.shape))
-        v_vec = data.pf.arr(v_vec, input_units = data["index", "x"].units)
-        rv = v_vec - center
+        rv = obtain_rvec(data)
+        rv = np.rollaxis(rv, 0, len(rv.shape))
+        rv = data.pf.arr(rv, input_units = data["index", "x"].units)
         return yv * rv[...,2] - zv * rv[...,1]
 
     def _specific_angular_momentum_y(field, data):
         xv, yv, zv = obtain_velocities(data, ftype)
         center = data.get_field_parameter('center')
-        v_vec = obtain_rvec(data)
-        v_vec = np.rollaxis(v_vec, 0, len(v_vec.shape))
-        v_vec = data.pf.arr(v_vec, input_units = data["index", "x"].units)
-        rv = v_vec - center
+        rv = obtain_rvec(data)
+        rv = np.rollaxis(rv, 0, len(rv.shape))
+        rv = data.pf.arr(rv, input_units = data["index", "x"].units)
         return - (xv * rv[...,2] - zv * rv[...,0])
 
     def _specific_angular_momentum_z(field, data):
         xv, yv, zv = obtain_velocities(data, ftype)
         center = data.get_field_parameter('center')
-        v_vec = obtain_rvec(data)
-        v_vec = np.rollaxis(v_vec, 0, len(v_vec.shape))
-        v_vec = data.pf.arr(v_vec, input_units = data["index", "x"].units)
-        rv = v_vec - center
+        rv = obtain_rvec(data)
+        rv = np.rollaxis(rv, 0, len(rv.shape))
+        rv = data.pf.arr(rv, input_units = data["index", "x"].units)
         return xv * rv[...,1] - yv * rv[...,0]
 
     registry.add_field((ftype, "specific_angular_momentum_x"),

diff -r 15bf4f304a0e8b46658a6a7a1b887e4cc60722bb -r 395cbbd74d0469288a679cc5fa559d4a8b8bad9b yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -317,10 +317,10 @@
         return ret
 
     def _setup_plots(self):
+        for f in self.axes:
+            self.axes[f].cla()
         for i, profile in enumerate(self.profiles):
             for field, field_data in profile.items():
-                if field in self.axes:
-                    self.axes[field].cla()
                 self.axes[field].plot(np.array(profile.x), np.array(field_data),
                                       label=self.label[i], **self.plot_spec[i])
         

diff -r 15bf4f304a0e8b46658a6a7a1b887e4cc60722bb -r 395cbbd74d0469288a679cc5fa559d4a8b8bad9b yt/visualization/volume_rendering/camera.py
--- a/yt/visualization/volume_rendering/camera.py
+++ b/yt/visualization/volume_rendering/camera.py
@@ -581,7 +581,8 @@
         return image
 
     def _render(self, double_check, num_threads, image, sampler):
-        pbar = get_pbar("Ray casting", (self.volume.brick_dimensions + 1).prod(axis=-1).sum())
+        ncells = sum(b.source_mask.size for b in self.volume.bricks)
+        pbar = get_pbar("Ray casting", ncells)
         total_cells = 0
         if double_check:
             for brick in self.volume.bricks:
@@ -592,7 +593,7 @@
         view_pos = self.front_center + self.orienter.unit_vectors[2] * 1.0e6 * self.width[2]
         for brick in self.volume.traverse(view_pos):
             sampler(brick, num_threads=num_threads)
-            total_cells += np.prod(brick.my_data[0].shape)
+            total_cells += brick.source_mask.size
             pbar.update(total_cells)
 
         pbar.finish()

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