Skip to content

Commit 9ca6b36

Browse files
Addressed perrygreenfield's comments.
1 parent f4b9772 commit 9ca6b36

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

‎astropy/modeling/bounding_box.py‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,15 @@ class BoundingBox(object):
139139
order : optional, str
140140
The ordering that is assumed for the tuple representation of this
141141
bounding_box.
142+
Options:
143+
'C': C/Python order, e.g. z, y, x. (default)
144+
'F': Fortran/mathematical notation order, e.g. x, y, z.
142145
143146
Methods
144147
-------
145148
validate :
146-
Contructs a valid bounding_box.
149+
Constructs a valid bounding_box from any of the allowed
150+
respresentations of a bounding_box.
147151
148152
bounding_box :
149153
Contructs a tuple respresentation
@@ -369,7 +373,7 @@ def domain(self, resolution, order: str = None):
369373

370374
return [self[input_name].domain(resolution) for input_name in inputs]
371375

372-
def _nan_index(self, input_shape, inputs):
376+
def _outside(self, input_shape, inputs):
373377
"""
374378
Get all the input positions which are outside the bounding_box,
375379
so that the corresponding outputs can be filled with NaNs.
@@ -423,7 +427,7 @@ def _valid_index(self, input_shape, inputs):
423427
all_out : bool
424428
if all of the inputs are outside the bounding_box
425429
"""
426-
nan_index, all_out = self._nan_index(input_shape, inputs)
430+
nan_index, all_out = self._outside(input_shape, inputs)
427431

428432
valid_index = np.atleast_1d(np.logical_not(nan_index)).nonzero()
429433
if len(valid_index[0]) == 0:

‎astropy/modeling/tests/test_bounding_box.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ def test_domain(self):
864864
with pytest.raises(ValueError):
865865
bounding_box.domain(0.25, order)
866866

867-
def test__nan_index(self):
867+
def test__outside(self):
868868
intervals = {0: Interval(-1, 1), 1: Interval(0, 2)}
869869
model = Gaussian2D()
870870
bounding_box = BoundingBox.validate(model, intervals)
@@ -874,7 +874,7 @@ def test__nan_index(self):
874874
y = np.linspace(0, 2, 13)
875875
input_shape = x.shape
876876
inputs = (x, y)
877-
nan_index, all_out = bounding_box._nan_index(input_shape, inputs)
877+
nan_index, all_out = bounding_box._outside(input_shape, inputs)
878878
assert (nan_index == [False for _ in range(13)]).all()
879879
assert not all_out and isinstance(all_out, bool)
880880

@@ -883,7 +883,7 @@ def test__nan_index(self):
883883
y = np.linspace(0, 3, 13)
884884
input_shape = x.shape
885885
inputs = (x, y)
886-
nan_index, all_out = bounding_box._nan_index(input_shape, inputs)
886+
nan_index, all_out = bounding_box._outside(input_shape, inputs)
887887
assert (nan_index ==
888888
[True, True, True, True,
889889
False, False, False, False, False,
@@ -895,21 +895,21 @@ def test__nan_index(self):
895895
y = np.linspace(-2, -1, 13)
896896
input_shape = x.shape
897897
inputs = (x, y)
898-
nan_index, all_out = bounding_box._nan_index(input_shape, inputs)
898+
nan_index, all_out = bounding_box._outside(input_shape, inputs)
899899
assert (nan_index == [True for _ in range(13)]).all()
900900
assert not all_out and isinstance(all_out, bool)
901901

902902
# Scalar input inside bounding_box
903903
inputs = (0.5, 0.5)
904904
input_shape = (1,)
905-
nan_index, all_out = bounding_box._nan_index(input_shape, inputs)
905+
nan_index, all_out = bounding_box._outside(input_shape, inputs)
906906
assert (nan_index == [False]).all()
907907
assert not all_out and isinstance(all_out, bool)
908908

909909
# Scalar input outside bounding_box
910910
inputs = (2, -1)
911911
input_shape = (1,)
912-
nan_index, all_out = bounding_box._nan_index(input_shape, inputs)
912+
nan_index, all_out = bounding_box._outside(input_shape, inputs)
913913
assert (nan_index == [True]).all()
914914
assert all_out and isinstance(all_out, bool)
915915

0 commit comments

Comments
 (0)