[yt-svn] commit/yt: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Sun Mar 23 14:08:58 PDT 2014
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/f9ceb2063deb/
Changeset: f9ceb2063deb
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-23 20:12:52
Summary: Fixing an issue with fix_length not behaving correctly when given a YTQuantity.
Closes #810
Affected #: 3 files
diff -r e53ed159da4c5c808f6196d79f603fe9c918072b -r f9ceb2063debc39dd91386fa65bd6fa2d2520d0d yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -605,6 +605,8 @@
else:
registry = None
if isinstance(length, YTArray):
+ if registry is not None:
+ length.units.registry = registry
return length.in_units("code_length")
if isinstance(length, numeric_type):
return YTArray(length, 'code_length', registry=registry)
diff -r e53ed159da4c5c808f6196d79f603fe9c918072b -r f9ceb2063debc39dd91386fa65bd6fa2d2520d0d yt/testing.py
--- a/yt/testing.py
+++ b/yt/testing.py
@@ -145,7 +145,7 @@
ndims, peak_value = 1.0,
fields = ("density", "velocity_x", "velocity_y", "velocity_z"),
units = ('g/cm**3', 'cm/s', 'cm/s', 'cm/s'),
- negative = False, nprocs = 1, particles = 0):
+ negative = False, nprocs = 1, particles = 0, length_unit=1.0):
from yt.data_objects.api import data_object_registry
from yt.frontends.stream.api import load_uniform_grid
if not iterable(ndims):
@@ -175,7 +175,7 @@
data[f] = (np.random.random(size = particles) - 0.5, 'cm/s')
data['particle_mass'] = (np.random.random(particles), 'g')
data['number_of_particles'] = particles
- ug = load_uniform_grid(data, ndims, 1.0, nprocs=nprocs)
+ ug = load_uniform_grid(data, ndims, length_unit=length_unit, nprocs=nprocs)
return ug
def fake_amr_pf(fields = ("Density",)):
diff -r e53ed159da4c5c808f6196d79f603fe9c918072b -r f9ceb2063debc39dd91386fa65bd6fa2d2520d0d yt/units/tests/test_ytarray.py
--- a/yt/units/tests/test_ytarray.py
+++ b/yt/units/tests/test_ytarray.py
@@ -391,10 +391,10 @@
"""
Test fixing the length of an array. Used in spheres and other data objects
"""
- pf = fake_random_pf(64, nprocs=1)
+ pf = fake_random_pf(64, nprocs=1, length_unit=10)
length = pf.quan(1.0,'code_length')
new_length = fix_length(length, pf=pf)
- yield assert_equal, length, new_length
+ yield assert_equal, YTQuantity(10, 'cm'), new_length
def test_ytarray_pickle():
pf = fake_random_pf(64, nprocs=1)
https://bitbucket.org/yt_analysis/yt/commits/4646247054fb/
Changeset: 4646247054fb
Branch: yt-3.0
User: MatthewTurk
Date: 2014-03-23 22:08:51
Summary: Merged in ngoldbaum/yt/yt-3.0 (pull request #741)
Fixing an issue with fix_length not behaving correctly when given a YTQuantity.
Affected #: 3 files
diff -r 233a27edec6ff7a1855b36aa096b05361ebd7759 -r 4646247054fb995eb10d56ea41af868479098bdb yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -605,6 +605,8 @@
else:
registry = None
if isinstance(length, YTArray):
+ if registry is not None:
+ length.units.registry = registry
return length.in_units("code_length")
if isinstance(length, numeric_type):
return YTArray(length, 'code_length', registry=registry)
diff -r 233a27edec6ff7a1855b36aa096b05361ebd7759 -r 4646247054fb995eb10d56ea41af868479098bdb yt/testing.py
--- a/yt/testing.py
+++ b/yt/testing.py
@@ -145,7 +145,7 @@
ndims, peak_value = 1.0,
fields = ("density", "velocity_x", "velocity_y", "velocity_z"),
units = ('g/cm**3', 'cm/s', 'cm/s', 'cm/s'),
- negative = False, nprocs = 1, particles = 0):
+ negative = False, nprocs = 1, particles = 0, length_unit=1.0):
from yt.data_objects.api import data_object_registry
from yt.frontends.stream.api import load_uniform_grid
if not iterable(ndims):
@@ -175,7 +175,7 @@
data[f] = (np.random.random(size = particles) - 0.5, 'cm/s')
data['particle_mass'] = (np.random.random(particles), 'g')
data['number_of_particles'] = particles
- ug = load_uniform_grid(data, ndims, 1.0, nprocs=nprocs)
+ ug = load_uniform_grid(data, ndims, length_unit=length_unit, nprocs=nprocs)
return ug
def fake_amr_pf(fields = ("Density",)):
diff -r 233a27edec6ff7a1855b36aa096b05361ebd7759 -r 4646247054fb995eb10d56ea41af868479098bdb yt/units/tests/test_ytarray.py
--- a/yt/units/tests/test_ytarray.py
+++ b/yt/units/tests/test_ytarray.py
@@ -391,10 +391,10 @@
"""
Test fixing the length of an array. Used in spheres and other data objects
"""
- pf = fake_random_pf(64, nprocs=1)
+ pf = fake_random_pf(64, nprocs=1, length_unit=10)
length = pf.quan(1.0,'code_length')
new_length = fix_length(length, pf=pf)
- yield assert_equal, length, new_length
+ yield assert_equal, YTQuantity(10, 'cm'), new_length
def test_ytarray_pickle():
pf = fake_random_pf(64, nprocs=1)
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