[yt-svn] commit/yt: 4 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Mar 30 11:28:26 PDT 2016
4 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/edf7d8fb0a2d/
Changeset: edf7d8fb0a2d
Branch: yt
User: ngoldbaum
Date: 2016-03-24 22:58:51+00:00
Summary: Re-enable max_level for projections, ProjectionPlot, and OffAxisProjectionPlot. Closes #1049
Affected #: 3 files
diff -r a776e67368c5629296b1e365dfca0b68b41ef1d5 -r edf7d8fb0a2d844f9f9f7bfdae44463d92e8c21d yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -221,7 +221,7 @@
def __init__(self, field, axis, weight_field = None,
center = None, ds = None, data_source = None,
style = None, method = "integrate",
- field_parameters = None):
+ field_parameters = None, max_level = None):
YTSelectionContainer2D.__init__(self, axis, ds, field_parameters)
# Style is deprecated, but if it is set, then it trumps method
# keyword. TODO: Remove this keyword and this check at some point in
@@ -243,6 +243,8 @@
self._set_center(center)
self._projected_units = {}
if data_source is None: data_source = self.ds.all_data()
+ if max_level is not None:
+ data_source.max_level = max_level
for k, v in data_source.field_parameters.items():
if k not in self.field_parameters or \
self._is_default_field_parameter(k):
diff -r a776e67368c5629296b1e365dfca0b68b41ef1d5 -r edf7d8fb0a2d844f9f9f7bfdae44463d92e8c21d yt/visualization/fixed_resolution.py
--- a/yt/visualization/fixed_resolution.py
+++ b/yt/visualization/fixed_resolution.py
@@ -569,11 +569,13 @@
width = self.ds.arr((self.bounds[1] - self.bounds[0],
self.bounds[3] - self.bounds[2],
self.bounds[5] - self.bounds[4]))
- buff = off_axis_projection(dd.ds, dd.center, dd.normal_vector,
+ buff = off_axis_projection(dd.dd, dd.center, dd.normal_vector,
width, dd.resolution, item,
weight=dd.weight_field, volume=dd.volume,
- no_ghost=dd.no_ghost, interpolated=dd.interpolated,
- north_vector=dd.north_vector, method=dd.method)
+ no_ghost=dd.no_ghost,
+ interpolated=dd.interpolated,
+ north_vector=dd.north_vector,
+ method=dd.method)
ia = ImageArray(buff.swapaxes(0,1), info=self._get_info(item))
self[item] = ia
return ia
diff -r a776e67368c5629296b1e365dfca0b68b41ef1d5 -r edf7d8fb0a2d844f9f9f7bfdae44463d92e8c21d yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -1407,7 +1407,8 @@
else:
proj = ds.proj(fields, axis, weight_field=weight_field,
center=center, data_source=data_source,
- field_parameters = field_parameters, method = method)
+ field_parameters=field_parameters, method=method,
+ max_level=max_level)
PWViewerMPL.__init__(self, proj, bounds, fields=fields, origin=origin,
fontsize=fontsize, window_size=window_size,
aspect=aspect)
@@ -1640,6 +1641,8 @@
center_rot, ds, normal, oap_width, fields, interpolated,
weight=weight_field, volume=volume, no_ghost=no_ghost,
le=le, re=re, north_vector=north_vector, method=method)
+ if max_level is not None:
+ OffAxisProj.dd.max_level = max_level
# If a non-weighted, integral projection, assure field-label reflects that
if weight_field is None and OffAxisProj.method == "integrate":
self.projected = True
https://bitbucket.org/yt_analysis/yt/commits/e301c446aed5/
Changeset: e301c446aed5
Branch: yt
User: ngoldbaum
Date: 2016-03-24 22:59:30+00:00
Summary: Clarify that data_source for off_axis_projections can be a data object
Affected #: 1 file
diff -r edf7d8fb0a2d844f9f9f7bfdae44463d92e8c21d -r e301c446aed53518bf06bbf019f61e7736ab80bd yt/visualization/volume_rendering/off_axis_projection.py
--- a/yt/visualization/volume_rendering/off_axis_projection.py
+++ b/yt/visualization/volume_rendering/off_axis_projection.py
@@ -38,8 +38,8 @@
Parameters
----------
- data_source : `~yt.data_objects.api.Dataset`
- This is the dataset to volume render.
+ data_source : `~yt.data_objects.static_output.Dataset` or `~yt.data_objects.data_containers.YTSelectionDataContainer`
+ This is the dataset or data object to volume render.
center : array_like
The current 'center' of the view port -- the focal point for the
camera.
https://bitbucket.org/yt_analysis/yt/commits/6597de44fa2e/
Changeset: 6597de44fa2e
Branch: yt
User: ngoldbaum
Date: 2016-03-24 23:10:05+00:00
Summary: Add a test for projection max levels
Affected #: 1 file
diff -r e301c446aed53518bf06bbf019f61e7736ab80bd -r 6597de44fa2e83bf2604d111816a699b389486de yt/data_objects/tests/test_projection.py
--- a/yt/data_objects/tests/test_projection.py
+++ b/yt/data_objects/tests/test_projection.py
@@ -1,6 +1,9 @@
import numpy as np
from yt.testing import \
- fake_random_ds, assert_equal, assert_rel_equal
+ fake_random_ds, \
+ assert_equal, \
+ assert_rel_equal, \
+ fake_amr_ds
from yt.units.unit_object import Unit
import os
import tempfile
@@ -111,3 +114,12 @@
v2 = (LENGTH_UNIT * dd["density"] * dd["d%s" % an]).sum()
yield assert_rel_equal, v1, v2, 10
teardown_func(fns)
+
+
+def test_max_level():
+ ds = fake_amr_ds()
+ proj = ds.proj('Density', 2, method='mip', max_level=2)
+ assert proj['grid_level'].max() == 2
+
+ proj = ds.proj('Density', 2, method='mip')
+ assert proj['grid_level'].max() == ds.index.max_level
https://bitbucket.org/yt_analysis/yt/commits/9625fb44ed87/
Changeset: 9625fb44ed87
Branch: yt
User: xarthisius
Date: 2016-03-30 18:28:17+00:00
Summary: Merged in ngoldbaum/yt (pull request #2080)
Re-enable max_level for projections, ProjectionPlot, and OffAxisProjectionPlot. Closes #1049
Affected #: 5 files
diff -r a98dd29e4e93fef8002811e9e05e34810574b9cd -r 9625fb44ed8778de289dd42d501dc9bedc1ee1c4 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -221,7 +221,7 @@
def __init__(self, field, axis, weight_field = None,
center = None, ds = None, data_source = None,
style = None, method = "integrate",
- field_parameters = None):
+ field_parameters = None, max_level = None):
YTSelectionContainer2D.__init__(self, axis, ds, field_parameters)
# Style is deprecated, but if it is set, then it trumps method
# keyword. TODO: Remove this keyword and this check at some point in
@@ -243,6 +243,8 @@
self._set_center(center)
self._projected_units = {}
if data_source is None: data_source = self.ds.all_data()
+ if max_level is not None:
+ data_source.max_level = max_level
for k, v in data_source.field_parameters.items():
if k not in self.field_parameters or \
self._is_default_field_parameter(k):
diff -r a98dd29e4e93fef8002811e9e05e34810574b9cd -r 9625fb44ed8778de289dd42d501dc9bedc1ee1c4 yt/data_objects/tests/test_projection.py
--- a/yt/data_objects/tests/test_projection.py
+++ b/yt/data_objects/tests/test_projection.py
@@ -1,6 +1,9 @@
import numpy as np
from yt.testing import \
- fake_random_ds, assert_equal, assert_rel_equal
+ fake_random_ds, \
+ assert_equal, \
+ assert_rel_equal, \
+ fake_amr_ds
from yt.units.unit_object import Unit
import os
import tempfile
@@ -111,3 +114,12 @@
v2 = (LENGTH_UNIT * dd["density"] * dd["d%s" % an]).sum()
yield assert_rel_equal, v1, v2, 10
teardown_func(fns)
+
+
+def test_max_level():
+ ds = fake_amr_ds()
+ proj = ds.proj('Density', 2, method='mip', max_level=2)
+ assert proj['grid_level'].max() == 2
+
+ proj = ds.proj('Density', 2, method='mip')
+ assert proj['grid_level'].max() == ds.index.max_level
diff -r a98dd29e4e93fef8002811e9e05e34810574b9cd -r 9625fb44ed8778de289dd42d501dc9bedc1ee1c4 yt/visualization/fixed_resolution.py
--- a/yt/visualization/fixed_resolution.py
+++ b/yt/visualization/fixed_resolution.py
@@ -569,11 +569,13 @@
width = self.ds.arr((self.bounds[1] - self.bounds[0],
self.bounds[3] - self.bounds[2],
self.bounds[5] - self.bounds[4]))
- buff = off_axis_projection(dd.ds, dd.center, dd.normal_vector,
+ buff = off_axis_projection(dd.dd, dd.center, dd.normal_vector,
width, dd.resolution, item,
weight=dd.weight_field, volume=dd.volume,
- no_ghost=dd.no_ghost, interpolated=dd.interpolated,
- north_vector=dd.north_vector, method=dd.method)
+ no_ghost=dd.no_ghost,
+ interpolated=dd.interpolated,
+ north_vector=dd.north_vector,
+ method=dd.method)
ia = ImageArray(buff.swapaxes(0,1), info=self._get_info(item))
self[item] = ia
return ia
diff -r a98dd29e4e93fef8002811e9e05e34810574b9cd -r 9625fb44ed8778de289dd42d501dc9bedc1ee1c4 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -1407,7 +1407,8 @@
else:
proj = ds.proj(fields, axis, weight_field=weight_field,
center=center, data_source=data_source,
- field_parameters = field_parameters, method = method)
+ field_parameters=field_parameters, method=method,
+ max_level=max_level)
PWViewerMPL.__init__(self, proj, bounds, fields=fields, origin=origin,
fontsize=fontsize, window_size=window_size,
aspect=aspect)
@@ -1640,6 +1641,8 @@
center_rot, ds, normal, oap_width, fields, interpolated,
weight=weight_field, volume=volume, no_ghost=no_ghost,
le=le, re=re, north_vector=north_vector, method=method)
+ if max_level is not None:
+ OffAxisProj.dd.max_level = max_level
# If a non-weighted, integral projection, assure field-label reflects that
if weight_field is None and OffAxisProj.method == "integrate":
self.projected = True
diff -r a98dd29e4e93fef8002811e9e05e34810574b9cd -r 9625fb44ed8778de289dd42d501dc9bedc1ee1c4 yt/visualization/volume_rendering/off_axis_projection.py
--- a/yt/visualization/volume_rendering/off_axis_projection.py
+++ b/yt/visualization/volume_rendering/off_axis_projection.py
@@ -38,8 +38,8 @@
Parameters
----------
- data_source : `~yt.data_objects.api.Dataset`
- This is the dataset to volume render.
+ data_source : `~yt.data_objects.static_output.Dataset` or `~yt.data_objects.data_containers.YTSelectionDataContainer`
+ This is the dataset or data object to volume render.
center : array_like
The current 'center' of the view port -- the focal point for the
camera.
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/20160330/8de286ea/attachment.html>
More information about the yt-svn
mailing list