From 63b50efa6e6ce535b45bb302b310b5734fb7a48d Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Tue, 5 Aug 2014 12:40:28 +0200 Subject: [PATCH] Improvements to syntax --- wcsaxes/coordinate_helpers.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/wcsaxes/coordinate_helpers.py b/wcsaxes/coordinate_helpers.py index c4c6490..dc93ec2 100644 --- a/wcsaxes/coordinate_helpers.py +++ b/wcsaxes/coordinate_helpers.py @@ -573,12 +573,13 @@ def _update_grid_lines(self): self.grid_lines = [] for iw, w in enumerate(tick_world_coordinates_values): + subset = slice(iw * n_samples, (iw + 1) * n_samples) if self.coord_index == 0: - xy_world[iw * n_samples:(iw + 1) * n_samples, 0] = np.repeat(w, n_samples) - xy_world[iw * n_samples:(iw + 1) * n_samples, 1] = np.linspace(coord_range[1][0], coord_range[1][1], n_samples) + xy_world[subset, 0] = np.repeat(w, n_samples) + xy_world[subset, 1] = np.linspace(coord_range[1][0], coord_range[1][1], n_samples) else: - xy_world[iw * n_samples:(iw + 1) * n_samples, 0] = np.linspace(coord_range[0][0], coord_range[0][1], n_samples) - xy_world[iw * n_samples:(iw + 1) * n_samples, 1] = np.repeat(w, n_samples) + xy_world[subset, 0] = np.linspace(coord_range[0][0], coord_range[0][1], n_samples) + xy_world[subset, 1] = np.repeat(w, n_samples) # We now convert all the world coordinates to pixel coordinates in a # single go rather than doing this in the gridline to path conversion @@ -591,9 +592,8 @@ def _update_grid_lines(self): xy_world_round = self.transform.transform(pixel) for iw in range(n_coord): - self.grid_lines.append(self._get_gridline(xy_world[iw * n_samples:(iw + 1) * n_samples], - pixel[iw * n_samples:(iw + 1) * n_samples], - xy_world_round[iw * n_samples:(iw + 1) * n_samples])) + subset = slice(iw * n_samples, (iw + 1) * n_samples) + self.grid_lines.append(self._get_gridline(xy_world[subset], pixel[subset], xy_world_round[subset])) def _get_gridline(self, xy_world, pixel, xy_world_round): if self.coord_type == 'scalar':