def __getitem__(self, key):
        """Define indexing and slicing."""
        if self.isscalar:
            raise IndexError('Scalar PixCoord cannot be indexed or sliced.')

        # Let Numpy do the slicing
        x = self.x[key]
        y = self.y[key]
        return PixCoord(x=x, y=y)
def __getitem__ ( self , key ) : if self . isscalar : raise IndexError ( 'Scalar PixCoord cannot be indexed or sliced.' ) x = self . x [ key ] y = self . y [ key ] return PixCoord ( x = x , y = y )
Define indexing and slicing.