[yt-svn] commit/yt: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Apr 14 10:39:12 PDT 2017
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/15ab2e67f57a/
Changeset: 15ab2e67f57a
Branch: yt
User: ngoldbaum
Date: 2017-03-27 19:48:01+00:00
Summary: Explicitly specify the field type for radius field calculation
Affected #: 3 files
diff -r e265191afc164152ef482e861826d6dc877e6893 -r 15ab2e67f57ad15a346e5c992c29be732f78565b yt/fields/field_functions.py
--- a/yt/fields/field_functions.py
+++ b/yt/fields/field_functions.py
@@ -18,12 +18,12 @@
from yt.utilities.lib.geometry_utils import \
obtain_rvec
-def get_radius(data, field_prefix):
+def get_radius(data, field_prefix, ftype):
unit_system = data.ds.unit_system
center = data.get_field_parameter("center").in_base(unit_system.name)
DW = (data.ds.domain_right_edge - data.ds.domain_left_edge).in_base(unit_system.name)
# This is in cm**2 so it can be the destination for our r later.
- radius2 = data.ds.arr(np.zeros(data[field_prefix+"x"].shape,
+ radius2 = data.ds.arr(np.zeros(data[ftype, field_prefix+"x"].shape,
dtype='float64'), 'cm**2')
r = radius2.copy()
if any(data.ds.periodicity):
@@ -31,7 +31,7 @@
for i, ax in enumerate('xyz'):
# This will coerce the units, so we don't need to worry that we copied
# it from a cm**2 array.
- np.subtract(data["%s%s" % (field_prefix, ax)].in_base(unit_system.name),
+ np.subtract(data[ftype, "%s%s" % (field_prefix, ax)].in_base(unit_system.name),
center[i], r)
if data.ds.periodicity[i] is True:
np.abs(r, r)
diff -r e265191afc164152ef482e861826d6dc877e6893 -r 15ab2e67f57ad15a346e5c992c29be732f78565b yt/fields/geometric_fields.py
--- a/yt/fields/geometric_fields.py
+++ b/yt/fields/geometric_fields.py
@@ -44,7 +44,7 @@
Relative to the coordinate system defined by the *center* field
parameter.
"""
- return get_radius(data, "")
+ return get_radius(data, "", field.name[0])
registry.add_field(("index", "radius"), sampling_type="cell",
function=_radius,
diff -r e265191afc164152ef482e861826d6dc877e6893 -r 15ab2e67f57ad15a346e5c992c29be732f78565b yt/fields/particle_fields.py
--- a/yt/fields/particle_fields.py
+++ b/yt/fields/particle_fields.py
@@ -347,7 +347,7 @@
Relative to the coordinate system defined by the *normal* vector,
and *center* field parameters.
"""
- return get_radius(data, "particle_position_")
+ return get_radius(data, "particle_position_", field.name[0])
registry.add_field(
(ptype, "particle_radius"),
https://bitbucket.org/yt_analysis/yt/commits/9e188aa057c9/
Changeset: 9e188aa057c9
Branch: yt
User: ngoldbaum
Date: 2017-04-14 17:39:08+00:00
Summary: Merged in ngoldbaum/yt (pull request #2562)
Explicitly specify the field type for radius field calculation
Approved-by: Britton Smith <brittonsmith at gmail.com>
Approved-by: Kacper Kowalik <xarthisius.kk at gmail.com>
Approved-by: John ZuHone <jzuhone at gmail.com>
Affected #: 3 files
diff -r f119d6d90c9fe228901b95375b145438c08b8481 -r 9e188aa057c91b6ff79c5c7e0b9680af6de17517 yt/fields/field_functions.py
--- a/yt/fields/field_functions.py
+++ b/yt/fields/field_functions.py
@@ -18,12 +18,12 @@
from yt.utilities.lib.geometry_utils import \
obtain_rvec
-def get_radius(data, field_prefix):
+def get_radius(data, field_prefix, ftype):
unit_system = data.ds.unit_system
center = data.get_field_parameter("center").in_base(unit_system.name)
DW = (data.ds.domain_right_edge - data.ds.domain_left_edge).in_base(unit_system.name)
# This is in cm**2 so it can be the destination for our r later.
- radius2 = data.ds.arr(np.zeros(data[field_prefix+"x"].shape,
+ radius2 = data.ds.arr(np.zeros(data[ftype, field_prefix+"x"].shape,
dtype='float64'), 'cm**2')
r = radius2.copy()
if any(data.ds.periodicity):
@@ -31,7 +31,7 @@
for i, ax in enumerate('xyz'):
# This will coerce the units, so we don't need to worry that we copied
# it from a cm**2 array.
- np.subtract(data["%s%s" % (field_prefix, ax)].in_base(unit_system.name),
+ np.subtract(data[ftype, "%s%s" % (field_prefix, ax)].in_base(unit_system.name),
center[i], r)
if data.ds.periodicity[i] is True:
np.abs(r, r)
diff -r f119d6d90c9fe228901b95375b145438c08b8481 -r 9e188aa057c91b6ff79c5c7e0b9680af6de17517 yt/fields/geometric_fields.py
--- a/yt/fields/geometric_fields.py
+++ b/yt/fields/geometric_fields.py
@@ -44,7 +44,7 @@
Relative to the coordinate system defined by the *center* field
parameter.
"""
- return get_radius(data, "")
+ return get_radius(data, "", field.name[0])
registry.add_field(("index", "radius"), sampling_type="cell",
function=_radius,
diff -r f119d6d90c9fe228901b95375b145438c08b8481 -r 9e188aa057c91b6ff79c5c7e0b9680af6de17517 yt/fields/particle_fields.py
--- a/yt/fields/particle_fields.py
+++ b/yt/fields/particle_fields.py
@@ -347,7 +347,7 @@
Relative to the coordinate system defined by the *normal* vector,
and *center* field parameters.
"""
- return get_radius(data, "particle_position_")
+ return get_radius(data, "particle_position_", field.name[0])
registry.add_field(
(ptype, "particle_radius"),
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