[yt-svn] commit/yt: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Apr 29 10:18:55 PDT 2016
3 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/ea94b8f736c2/
Changeset: ea94b8f736c2
Branch: yt
User: xarthisius
Date: 2016-04-26 20:04:40+00:00
Summary: Create vector fields for magnetic_field. Closes #1213
Affected #: 4 files
diff -r 77db965d0a537a9884d6db3c5ad7595dc3070ba0 -r ea94b8f736c2f92adf3c625c677bd07418bb2cf6 yt/fields/field_aliases.py
--- a/yt/fields/field_aliases.py
+++ b/yt/fields/field_aliases.py
@@ -79,8 +79,8 @@
("TangentialVelocity", "tangential_velocity"),
("CuttingPlaneVelocityX", "cutting_plane_velocity_x"),
("CuttingPlaneVelocityY", "cutting_plane_velocity_y"),
- ("CuttingPlaneBX", "cutting_plane_bx"),
- ("CuttingPlaneBy", "cutting_plane_by"),
+ ("CuttingPlaneBX", "cutting_plane_magnetic_field_x"),
+ ("CuttingPlaneBy", "cutting_plane_magnetic_field_y"),
("MeanMolecularWeight", "mean_molecular_weight"),
("particle_density", "particle_density"),
("ThermalEnergy", "thermal_energy"),
diff -r 77db965d0a537a9884d6db3c5ad7595dc3070ba0 -r ea94b8f736c2f92adf3c625c677bd07418bb2cf6 yt/fields/fluid_fields.py
--- a/yt/fields/fluid_fields.py
+++ b/yt/fields/fluid_fields.py
@@ -54,6 +54,7 @@
unit_system = registry.ds.unit_system
create_vector_fields(registry, "velocity", unit_system["velocity"], ftype, slice_info)
+ create_vector_fields(registry, "magnetic_field", unit_system["magnetic_field"], ftype, slice_info)
def _cell_mass(field, data):
return data[ftype, "density"] * data[ftype, "cell_volume"]
diff -r 77db965d0a537a9884d6db3c5ad7595dc3070ba0 -r ea94b8f736c2f92adf3c625c677bd07418bb2cf6 yt/fields/vector_operations.py
--- a/yt/fields/vector_operations.py
+++ b/yt/fields/vector_operations.py
@@ -183,13 +183,15 @@
def _cp_vectors(ax):
def _cp_val(field, data):
vec = data.get_field_parameter("cp_%s_vec" % (ax))
- bv = data.get_field_parameter("bulk_%s" % basename)
- if bv is None: bv = np.zeros(3)
- tr = (data[xn] - bv[0]) * vec[0]
- tr += (data[yn] - bv[1]) * vec[1]
- tr += (data[zn] - bv[2]) * vec[2]
+ bv = data.get_field_parameter("bulk_%s" % basename, None)
+ if bv is None:
+ bv = data.ds.arr(np.zeros(3), data[xn].units)
+ tr = (data[xn] - bv[0]) * vec.d[0]
+ tr += (data[yn] - bv[1]) * vec.d[1]
+ tr += (data[zn] - bv[2]) * vec.d[2]
return tr
return _cp_val
+
registry.add_field((ftype, "cutting_plane_%s_x" % basename),
function=_cp_vectors('x'),
units=field_units)
diff -r 77db965d0a537a9884d6db3c5ad7595dc3070ba0 -r ea94b8f736c2f92adf3c625c677bd07418bb2cf6 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -309,8 +309,8 @@
def __call__(self, plot):
# Instantiation of these is cheap
if plot._type_name == "CuttingPlane":
- qcb = CuttingQuiverCallback("cutting_plane_bx",
- "cutting_plane_by",
+ qcb = CuttingQuiverCallback("cutting_plane_magnetic_field_x",
+ "cutting_plane_magnetic_field_y",
self.factor)
else:
xax = plot.data.ds.coordinates.x_axis[plot.data.axis]
https://bitbucket.org/yt_analysis/yt/commits/ac0037c4877b/
Changeset: ac0037c4877b
Branch: yt
User: xarthisius
Date: 2016-04-26 20:22:50+00:00
Summary: Add tests for vel/B fields annotation for off axis slices
Affected #: 1 file
diff -r ea94b8f736c2f92adf3c625c677bd07418bb2cf6 -r ac0037c4877be1e617a625eb3c02a7e72c729200 yt/visualization/tests/test_callbacks.py
--- a/yt/visualization/tests/test_callbacks.py
+++ b/yt/visualization/tests/test_callbacks.py
@@ -246,11 +246,15 @@
p = SlicePlot(ds, ax, "density")
p.annotate_velocity()
yield assert_fname, p.save(prefix)[0]
+ # Test for OffAxis Slice
+ p = SlicePlot(ds, [1, 1, 0], 'density', north_vector=[0, 0, 1])
+ p.annotate_velocity(factor=40, normalize=True)
+ yield assert_fname, p.save(prefix)[0]
# Now we'll check a few additional minor things
p = SlicePlot(ds, "x", "density")
p.annotate_velocity(factor=8, scale=0.5, scale_units="inches",
normalize = True)
- p.save(prefix)
+ yield assert_fname, p.save(prefix)[0]
def test_magnetic_callback():
with _cleanup_fname() as prefix:
@@ -263,11 +267,15 @@
p = SlicePlot(ds, ax, "density")
p.annotate_magnetic_field()
yield assert_fname, p.save(prefix)[0]
+ # Test for OffAxis Slice
+ p = SlicePlot(ds, [1, 1, 0], 'density', north_vector=[0, 0, 1])
+ p.annotate_magnetic_field(factor=40, normalize=True)
+ yield assert_fname, p.save(prefix)[0]
# Now we'll check a few additional minor things
p = SlicePlot(ds, "x", "density")
p.annotate_magnetic_field(factor=8, scale=0.5,
scale_units="inches", normalize = True)
- p.save(prefix)
+ yield assert_fname, p.save(prefix)[0]
def test_quiver_callback():
with _cleanup_fname() as prefix:
@@ -289,7 +297,7 @@
scale_units="inches", normalize = True,
bv_x = 0.5 * u.cm / u.s,
bv_y = 0.5 * u.cm / u.s)
- p.save(prefix)
+ yield assert_fname, p.save(prefix)[0]
def test_contour_callback():
with _cleanup_fname() as prefix:
https://bitbucket.org/yt_analysis/yt/commits/e3f37d2893ac/
Changeset: e3f37d2893ac
Branch: yt
User: atmyers
Date: 2016-04-29 17:18:37+00:00
Summary: Merged in xarthisius/yt (pull request #2146)
Create vector fields for magnetic_field. Closes #1213
Affected #: 5 files
diff -r 0daf747c5d006d087f132b62d750c61874a76e19 -r e3f37d2893ac2696f4836980cfc0679f5ed7c399 yt/fields/field_aliases.py
--- a/yt/fields/field_aliases.py
+++ b/yt/fields/field_aliases.py
@@ -79,8 +79,8 @@
("TangentialVelocity", "tangential_velocity"),
("CuttingPlaneVelocityX", "cutting_plane_velocity_x"),
("CuttingPlaneVelocityY", "cutting_plane_velocity_y"),
- ("CuttingPlaneBX", "cutting_plane_bx"),
- ("CuttingPlaneBy", "cutting_plane_by"),
+ ("CuttingPlaneBX", "cutting_plane_magnetic_field_x"),
+ ("CuttingPlaneBy", "cutting_plane_magnetic_field_y"),
("MeanMolecularWeight", "mean_molecular_weight"),
("particle_density", "particle_density"),
("ThermalEnergy", "thermal_energy"),
diff -r 0daf747c5d006d087f132b62d750c61874a76e19 -r e3f37d2893ac2696f4836980cfc0679f5ed7c399 yt/fields/fluid_fields.py
--- a/yt/fields/fluid_fields.py
+++ b/yt/fields/fluid_fields.py
@@ -54,6 +54,7 @@
unit_system = registry.ds.unit_system
create_vector_fields(registry, "velocity", unit_system["velocity"], ftype, slice_info)
+ create_vector_fields(registry, "magnetic_field", unit_system["magnetic_field"], ftype, slice_info)
def _cell_mass(field, data):
return data[ftype, "density"] * data[ftype, "cell_volume"]
diff -r 0daf747c5d006d087f132b62d750c61874a76e19 -r e3f37d2893ac2696f4836980cfc0679f5ed7c399 yt/fields/vector_operations.py
--- a/yt/fields/vector_operations.py
+++ b/yt/fields/vector_operations.py
@@ -183,13 +183,15 @@
def _cp_vectors(ax):
def _cp_val(field, data):
vec = data.get_field_parameter("cp_%s_vec" % (ax))
- bv = data.get_field_parameter("bulk_%s" % basename)
- if bv is None: bv = np.zeros(3)
- tr = (data[xn] - bv[0]) * vec[0]
- tr += (data[yn] - bv[1]) * vec[1]
- tr += (data[zn] - bv[2]) * vec[2]
+ bv = data.get_field_parameter("bulk_%s" % basename, None)
+ if bv is None:
+ bv = data.ds.arr(np.zeros(3), data[xn].units)
+ tr = (data[xn] - bv[0]) * vec.d[0]
+ tr += (data[yn] - bv[1]) * vec.d[1]
+ tr += (data[zn] - bv[2]) * vec.d[2]
return tr
return _cp_val
+
registry.add_field((ftype, "cutting_plane_%s_x" % basename),
function=_cp_vectors('x'),
units=field_units)
diff -r 0daf747c5d006d087f132b62d750c61874a76e19 -r e3f37d2893ac2696f4836980cfc0679f5ed7c399 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -309,8 +309,8 @@
def __call__(self, plot):
# Instantiation of these is cheap
if plot._type_name == "CuttingPlane":
- qcb = CuttingQuiverCallback("cutting_plane_bx",
- "cutting_plane_by",
+ qcb = CuttingQuiverCallback("cutting_plane_magnetic_field_x",
+ "cutting_plane_magnetic_field_y",
self.factor)
else:
xax = plot.data.ds.coordinates.x_axis[plot.data.axis]
diff -r 0daf747c5d006d087f132b62d750c61874a76e19 -r e3f37d2893ac2696f4836980cfc0679f5ed7c399 yt/visualization/tests/test_callbacks.py
--- a/yt/visualization/tests/test_callbacks.py
+++ b/yt/visualization/tests/test_callbacks.py
@@ -246,11 +246,15 @@
p = SlicePlot(ds, ax, "density")
p.annotate_velocity()
yield assert_fname, p.save(prefix)[0]
+ # Test for OffAxis Slice
+ p = SlicePlot(ds, [1, 1, 0], 'density', north_vector=[0, 0, 1])
+ p.annotate_velocity(factor=40, normalize=True)
+ yield assert_fname, p.save(prefix)[0]
# Now we'll check a few additional minor things
p = SlicePlot(ds, "x", "density")
p.annotate_velocity(factor=8, scale=0.5, scale_units="inches",
normalize = True)
- p.save(prefix)
+ yield assert_fname, p.save(prefix)[0]
def test_magnetic_callback():
with _cleanup_fname() as prefix:
@@ -263,11 +267,15 @@
p = SlicePlot(ds, ax, "density")
p.annotate_magnetic_field()
yield assert_fname, p.save(prefix)[0]
+ # Test for OffAxis Slice
+ p = SlicePlot(ds, [1, 1, 0], 'density', north_vector=[0, 0, 1])
+ p.annotate_magnetic_field(factor=40, normalize=True)
+ yield assert_fname, p.save(prefix)[0]
# Now we'll check a few additional minor things
p = SlicePlot(ds, "x", "density")
p.annotate_magnetic_field(factor=8, scale=0.5,
scale_units="inches", normalize = True)
- p.save(prefix)
+ yield assert_fname, p.save(prefix)[0]
def test_quiver_callback():
with _cleanup_fname() as prefix:
@@ -289,7 +297,7 @@
scale_units="inches", normalize = True,
bv_x = 0.5 * u.cm / u.s,
bv_y = 0.5 * u.cm / u.s)
- p.save(prefix)
+ yield assert_fname, p.save(prefix)[0]
def test_contour_callback():
with _cleanup_fname() as prefix:
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160429/41e617c4/attachment.html>
More information about the yt-svn
mailing list