Skip to content

Commit 4849e84

Browse files
authored
Merge pull request #5211 from cphyc/goodbye-sphere-too-small
Removing YTSphereTooSmall
2 parents 490362a + 458ab76 commit 4849e84

File tree

5 files changed

+10
-19
lines changed

5 files changed

+10
-19
lines changed

yt/data_objects/selection_objects/spheroids.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
validate_sequence,
1515
)
1616
from yt.units import YTArray
17-
from yt.utilities.exceptions import YTEllipsoidOrdering, YTException, YTSphereTooSmall
17+
from yt.utilities.exceptions import YTEllipsoidOrdering, YTException
1818
from yt.utilities.logger import ytLogger as mylog
1919
from yt.utilities.math_utils import get_rotation_matrix
2020
from yt.utilities.on_demand_imports import _miniball
@@ -57,12 +57,6 @@ def __init__(
5757
super().__init__(center, ds, field_parameters, data_source)
5858
# Unpack the radius, if necessary
5959
radius = fix_length(radius, self.ds)
60-
if radius < self.index.get_smallest_dx():
61-
raise YTSphereTooSmall(
62-
ds,
63-
radius.in_units("code_length"),
64-
self.index.get_smallest_dx().in_units("code_length"),
65-
)
6660
self.set_field_parameter("radius", radius)
6761
self.set_field_parameter("center", self.center)
6862
self.radius = radius
@@ -187,8 +181,7 @@ def __init__(
187181
self._A = self.ds.quan(A, "code_length")
188182
self._B = self.ds.quan(B, "code_length")
189183
self._C = self.ds.quan(C, "code_length")
190-
if self._C < self.index.get_smallest_dx():
191-
raise YTSphereTooSmall(self.ds, self._C, self.index.get_smallest_dx())
184+
192185
self._e0 = e0 = e0 / (e0**2.0).sum() ** 0.5
193186
self._tilt = tilt
194187

yt/utilities/exceptions.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,6 @@ def __str__(self):
6262
return msg
6363

6464

65-
class YTSphereTooSmall(YTException):
66-
def __init__(self, ds, radius, smallest_cell):
67-
self.ds = ds
68-
self.radius = radius
69-
self.smallest_cell = smallest_cell
70-
71-
def __str__(self):
72-
return f"{self.radius:0.5e} < {self.smallest_cell:0.5e}"
73-
74-
7565
class YTAxesNotOrthogonalError(YTException):
7666
def __init__(self, axes):
7767
self.axes = axes

yt/visualization/volume_rendering/tests/test_composite.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ def tearDown(self):
4444
def test_composite_vr(self):
4545
ds = fake_random_ds(64)
4646
dd = ds.sphere(ds.domain_center, 0.45 * ds.domain_width[0])
47+
48+
# Trigger creation of index
49+
ds.index
4750
ds.field_info[ds.field_list[0]].take_log = False
4851

4952
sc = Scene()

yt/visualization/volume_rendering/tests/test_points.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ def tearDown(self):
4242
def test_points_vr(self):
4343
ds = fake_random_ds(64)
4444
dd = ds.sphere(ds.domain_center, 0.45 * ds.domain_width[0])
45+
46+
# Trigger creation of index
47+
ds.index
4548
ds.field_info[ds.field_list[0]].take_log = False
4649

4750
sc = Scene()

yt/visualization/volume_rendering/tests/test_zbuff.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def tearDown(self):
5353
def test_composite_vr(self):
5454
ds = fake_random_ds(64)
5555
dd = ds.sphere(ds.domain_center, 0.45 * ds.domain_width[0])
56+
# Trigger creation of index
57+
ds.index
5658
ds.field_info[ds.field_list[0]].take_log = False
5759

5860
sc = Scene()

0 commit comments

Comments
 (0)