Skip to content

Commit

Permalink
Fix bugs in implementing new API for crop_by_extra_coord.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanRyanIrish committed Dec 11, 2018
1 parent e25da89 commit ad5e31d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ndcube/ndcube.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def crop_by_extra_coord(self, coord_name, min_coord_value, max_coord_value):
result: `ndcube.NDCube`
"""
if isinstance(coord_name, str):
if not isinstance(coord_name, str):
raise TypeError("The API for this function has changed. "
"Please give coord_name, min_coord_value, max_coord_value")
extra_coord_dict = self.extra_coords[coord_name]
Expand All @@ -512,7 +512,7 @@ def crop_by_extra_coord(self, coord_name, min_coord_value, max_coord_value):
else:
extra_coord_values = np.asarray(extra_coord_dict["value"])
w = np.logical_and(extra_coord_values >= min_coord_value,
extra_coord_values < min_coord_value + interval_width)
extra_coord_values < max_coord_value)
w = np.arange(len(extra_coord_values))[w]
item = [slice(None)]*len(self.dimensions)
item[extra_coord_dict["axis"]] = slice(w[0], w[1]+1)
Expand Down

0 comments on commit ad5e31d

Please sign in to comment.