[yt-svn] commit/yt: 6 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Oct 13 18:32:07 PDT 2017
6 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/9dbd9448bc98/
Changeset: 9dbd9448bc98
User: brittonsmith
Date: 2017-09-13 00:01:49+00:00
Summary: Check if quantities have units before converting.
Affected #: 1 file
diff -r 92f604cded4654e4d63653cbec574dee30d11d68 -r 9dbd9448bc982710ac32bb9bd8d04dcf4cb60529 yt/analysis_modules/halo_analysis/halo_catalog.py
--- a/yt/analysis_modules/halo_analysis/halo_catalog.py
+++ b/yt/analysis_modules/halo_analysis/halo_catalog.py
@@ -449,7 +449,8 @@
if halo_filter:
for quantity in new_halo.quantities.values():
- quantity.convert_to_base()
+ if hasattr(quantity, "units"):
+ quantity.convert_to_base()
self.catalog.append(new_halo.quantities)
if save_halos and halo_filter:
https://bitbucket.org/yt_analysis/yt/commits/c581327551db/
Changeset: c581327551db
User: brittonsmith
Date: 2017-09-14 17:42:10+00:00
Summary: Adding halo quantity test.
Affected #: 1 file
diff -r 9dbd9448bc982710ac32bb9bd8d04dcf4cb60529 -r c581327551db29866d2395fab28b696552cfaaa4 yt/analysis_modules/halo_analysis/tests/test_halo_catalog.py
--- /dev/null
+++ b/yt/analysis_modules/halo_analysis/tests/test_halo_catalog.py
@@ -0,0 +1,83 @@
+"""
+HaloCatalog answer tests
+
+
+
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2017, yt Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+#-----------------------------------------------------------------------------
+
+import numpy as np
+import os
+import shutil
+import tempfile
+
+from yt.analysis_modules.halo_analysis.api import \
+ HaloCatalog, \
+ add_quantity
+from yt.convenience import \
+ load
+from yt.testing import \
+ assert_equal
+from yt.utilities.answer_testing.framework import \
+ AnswerTestingTest, \
+ data_dir_load, \
+ requires_ds
+
+def _nstars(halo):
+ sp = halo.data_object
+ return (sp["all", "creation_time"] > 0).sum()
+add_quantity("nstars", _nstars)
+
+class HaloQuantityTest(AnswerTestingTest):
+ _type_name = "HaloQuantity"
+ _attrs = ()
+
+ def __init__(self, data_ds, halos_ds):
+ self.data_ds = data_dir_load(data_ds)
+ self.halos_ds = data_dir_load(halos_ds)
+ self.ds = data_ds
+
+ def run(self):
+ curdir = os.getcwd()
+ tmpdir = tempfile.mkdtemp()
+ os.chdir(tmpdir)
+
+ hc = HaloCatalog(
+ data_ds=self.data_ds, halos_ds=self.halos_ds,
+ output_dir=os.path.join(tmpdir, str(self.data_ds)))
+ hc.add_callback("sphere")
+ hc.add_quantity("nstars")
+ hc.create()
+
+ fn = os.path.join(tmpdir, str(self.data_ds),
+ "%s.0.h5" % str(self.data_ds))
+ ds = load(fn)
+ ad = ds.all_data()
+ mi, ma = ad.quantities.extrema("nstars")
+ mean = ad.quantities.weighted_average_quantity(
+ "nstars", "particle_ones")
+
+ os.chdir(curdir)
+ shutil.rmtree(tmpdir)
+
+ return np.array([mean, mi, ma])
+
+ def compare(self, new_result, old_result):
+ assert_equal(new_result, old_result, verbose=True)
+
+rh0 = "rockstar_halos/halos_0.0.bin"
+e64 = "Enzo_64/DD0043/data0043"
+
+ at requires_ds(rh0)
+ at requires_ds(e64)
+def test_halo_quantity():
+ hds = data_dir_load(rh0)
+ dds = data_dir_load(e64)
+ yield HaloQuantityTest(dds, hds)
https://bitbucket.org/yt_analysis/yt/commits/42d4342e4f05/
Changeset: 42d4342e4f05
User: brittonsmith
Date: 2017-09-14 17:45:16+00:00
Summary: Adding new test entry.
Affected #: 1 file
diff -r c581327551db29866d2395fab28b696552cfaaa4 -r 42d4342e4f0510d54700554fd7e0841320dd28c9 tests/tests.yaml
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -35,8 +35,9 @@
local_gizmo_002:
- yt/frontends/gizmo/tests/test_outputs.py
- local_halos_004:
+ local_halos_005:
- yt/analysis_modules/halo_analysis/tests/test_halo_finders.py # [py2]
+ - yt/analysis_modules/halo_analysis/tests/test_halo_catalog.py
- yt/analysis_modules/halo_finding/tests/test_rockstar.py # [py2]
- yt/frontends/ahf/tests/test_outputs.py
- yt/frontends/owls_subfind/tests/test_outputs.py
https://bitbucket.org/yt_analysis/yt/commits/c249947abd3c/
Changeset: c249947abd3c
User: brittonsmith
Date: 2017-10-02 17:49:41+00:00
Summary: Handle dataset loading more carefully.
Affected #: 1 file
diff -r 42d4342e4f0510d54700554fd7e0841320dd28c9 -r c249947abd3c7d287f08c30aa247555c9679d1be yt/analysis_modules/halo_analysis/tests/test_halo_catalog.py
--- a/yt/analysis_modules/halo_analysis/tests/test_halo_catalog.py
+++ b/yt/analysis_modules/halo_analysis/tests/test_halo_catalog.py
@@ -39,25 +39,27 @@
_type_name = "HaloQuantity"
_attrs = ()
- def __init__(self, data_ds, halos_ds):
- self.data_ds = data_dir_load(data_ds)
- self.halos_ds = data_dir_load(halos_ds)
- self.ds = data_ds
+ def __init__(self, data_ds_fn, halos_ds_fn):
+ self.data_ds_fn = data_ds_fn
+ self.halos_ds_fn = halos_ds_fn
+ self.ds = data_dir_load(data_ds_fn)
def run(self):
curdir = os.getcwd()
tmpdir = tempfile.mkdtemp()
os.chdir(tmpdir)
+ dds = data_dir_load(self.data_ds_fn)
+ hds = data_dir_load(self.halos_ds_fn)
hc = HaloCatalog(
- data_ds=self.data_ds, halos_ds=self.halos_ds,
- output_dir=os.path.join(tmpdir, str(self.data_ds)))
+ data_ds=dds, halos_ds=hds,
+ output_dir=os.path.join(tmpdir, str(dds)))
hc.add_callback("sphere")
hc.add_quantity("nstars")
hc.create()
- fn = os.path.join(tmpdir, str(self.data_ds),
- "%s.0.h5" % str(self.data_ds))
+ fn = os.path.join(tmpdir, str(dds),
+ "%s.0.h5" % str(dds))
ds = load(fn)
ad = ds.all_data()
mi, ma = ad.quantities.extrema("nstars")
@@ -78,6 +80,4 @@
@requires_ds(rh0)
@requires_ds(e64)
def test_halo_quantity():
- hds = data_dir_load(rh0)
- dds = data_dir_load(e64)
- yield HaloQuantityTest(dds, hds)
+ yield HaloQuantityTest(e64, rh0)
https://bitbucket.org/yt_analysis/yt/commits/5fd12fcf37fb/
Changeset: 5fd12fcf37fb
User: brittonsmith
Date: 2017-10-02 22:51:01+00:00
Summary: Updating test result number.
Affected #: 1 file
diff -r c249947abd3c7d287f08c30aa247555c9679d1be -r 5fd12fcf37fb99fbe35c07f920f16d315563ba88 tests/tests.yaml
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -35,7 +35,7 @@
local_gizmo_002:
- yt/frontends/gizmo/tests/test_outputs.py
- local_halos_005:
+ local_halos_006:
- yt/analysis_modules/halo_analysis/tests/test_halo_finders.py # [py2]
- yt/analysis_modules/halo_analysis/tests/test_halo_catalog.py
- yt/analysis_modules/halo_finding/tests/test_rockstar.py # [py2]
https://bitbucket.org/yt_analysis/yt/commits/4cbd343c7782/
Changeset: 4cbd343c7782
User: ngoldbaum
Date: 2017-10-14 01:31:53+00:00
Summary: Merge pull request #1558 from brittonsmith/hc
[bugfix] Check for units before converting quantities in HaloCatalog
Affected #: 3 files
diff -r 83e3515e10daea0de17bdb8c6016664389b9aa0d -r 4cbd343c7782c682f00b96fd19ee774a2da28642 tests/tests.yaml
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -35,8 +35,9 @@
local_gizmo_002:
- yt/frontends/gizmo/tests/test_outputs.py
- local_halos_004:
+ local_halos_006:
- yt/analysis_modules/halo_analysis/tests/test_halo_finders.py # [py2]
+ - yt/analysis_modules/halo_analysis/tests/test_halo_catalog.py
- yt/analysis_modules/halo_finding/tests/test_rockstar.py # [py2]
- yt/frontends/ahf/tests/test_outputs.py
- yt/frontends/owls_subfind/tests/test_outputs.py
diff -r 83e3515e10daea0de17bdb8c6016664389b9aa0d -r 4cbd343c7782c682f00b96fd19ee774a2da28642 yt/analysis_modules/halo_analysis/halo_catalog.py
--- a/yt/analysis_modules/halo_analysis/halo_catalog.py
+++ b/yt/analysis_modules/halo_analysis/halo_catalog.py
@@ -449,7 +449,8 @@
if halo_filter:
for quantity in new_halo.quantities.values():
- quantity.convert_to_base()
+ if hasattr(quantity, "units"):
+ quantity.convert_to_base()
self.catalog.append(new_halo.quantities)
if save_halos and halo_filter:
diff -r 83e3515e10daea0de17bdb8c6016664389b9aa0d -r 4cbd343c7782c682f00b96fd19ee774a2da28642 yt/analysis_modules/halo_analysis/tests/test_halo_catalog.py
--- /dev/null
+++ b/yt/analysis_modules/halo_analysis/tests/test_halo_catalog.py
@@ -0,0 +1,83 @@
+"""
+HaloCatalog answer tests
+
+
+
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2017, yt Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+#-----------------------------------------------------------------------------
+
+import numpy as np
+import os
+import shutil
+import tempfile
+
+from yt.analysis_modules.halo_analysis.api import \
+ HaloCatalog, \
+ add_quantity
+from yt.convenience import \
+ load
+from yt.testing import \
+ assert_equal
+from yt.utilities.answer_testing.framework import \
+ AnswerTestingTest, \
+ data_dir_load, \
+ requires_ds
+
+def _nstars(halo):
+ sp = halo.data_object
+ return (sp["all", "creation_time"] > 0).sum()
+add_quantity("nstars", _nstars)
+
+class HaloQuantityTest(AnswerTestingTest):
+ _type_name = "HaloQuantity"
+ _attrs = ()
+
+ def __init__(self, data_ds_fn, halos_ds_fn):
+ self.data_ds_fn = data_ds_fn
+ self.halos_ds_fn = halos_ds_fn
+ self.ds = data_dir_load(data_ds_fn)
+
+ def run(self):
+ curdir = os.getcwd()
+ tmpdir = tempfile.mkdtemp()
+ os.chdir(tmpdir)
+
+ dds = data_dir_load(self.data_ds_fn)
+ hds = data_dir_load(self.halos_ds_fn)
+ hc = HaloCatalog(
+ data_ds=dds, halos_ds=hds,
+ output_dir=os.path.join(tmpdir, str(dds)))
+ hc.add_callback("sphere")
+ hc.add_quantity("nstars")
+ hc.create()
+
+ fn = os.path.join(tmpdir, str(dds),
+ "%s.0.h5" % str(dds))
+ ds = load(fn)
+ ad = ds.all_data()
+ mi, ma = ad.quantities.extrema("nstars")
+ mean = ad.quantities.weighted_average_quantity(
+ "nstars", "particle_ones")
+
+ os.chdir(curdir)
+ shutil.rmtree(tmpdir)
+
+ return np.array([mean, mi, ma])
+
+ def compare(self, new_result, old_result):
+ assert_equal(new_result, old_result, verbose=True)
+
+rh0 = "rockstar_halos/halos_0.0.bin"
+e64 = "Enzo_64/DD0043/data0043"
+
+ at requires_ds(rh0)
+ at requires_ds(e64)
+def test_halo_quantity():
+ yield HaloQuantityTest(e64, rh0)
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