old_contents: #!/usr/bin/python
  # 5/17/2010
  
  #import modules
  from numpy import asarray, ones
  from copy import copy, deepcopy
  
  class ModelArray(object):
      """
      """
      ### Shape Property ###
      def _getshape(self):
          """
          Gives the shape of the tensor array
  
          """
  
          return self.model_params.shape[:-1]
  
      def _setshape(self, shape):
          """
          Sets the shape of the tensor array
  
          """
          self.model_params.shape = shape + self.model_params.shape[-1]
  
      shape = property(_getshape, _setshape, doc = "Shape of model array")
  
      ### Ndim Property ###
      @property
      def ndim(self):
          return self.model_params.ndim - 1
  
      @property
      def mask(self):
          if hasattr(self.model_params, 'mask'):
              return self.model_params.mask
          else:
              return ones(self.shape, 'bool')
  
      ### Getitem Property ###
      def __getitem__(self, index):
          """
          Returns part of the model array
  
          """
          if type(index) is not tuple:
              index = (index,)
          if len(index) > self.ndim:
              raise IndexError('invalid index')
          for ii, slc in enumerate(index):
              if slc is Ellipsis:
                  n_ellipsis = len(self.shape) - len(index) + 1
                  index = index[:ii] + n_ellipsis*(slice(None),) + index[ii+1:]
                  break
  
          new_model = copy(self)
          new_model.model_params = self.model_params[index]
          return new_model
  
      def _get_model_params(self):
          return self._model_params
  
      def _set_model_params(self, params):
          self._model_params = params
  
      model_params = property(_get_model_params, _set_model_params)
  
  
  
new_contents: #!/usr/bin/python
  # 5/17/2010
  
  #import modules
  from numpy import asarray, ones
  from copy import copy, deepcopy
  
  class ModelArray(object):
      """
      """
      ### Shape Property ###
      def _getshape(self):
          """
          Gives the shape of the tensor array
  
          """
  
          return self.model_params.shape[:-1]
  
      def _setshape(self, shape):
          """
          Sets the shape of the tensor array
  
          """
          if type(shape) is not tuple:
              shape = (shape,)
          self.model_params.shape = shape + self.model_params.shape[-1:]
  
      shape = property(_getshape, _setshape, doc = "Shape of model array")
  
      ### Ndim Property ###
      @property
      def ndim(self):
          return self.model_params.ndim - 1
  
      @property
      def mask(self):
          if hasattr(self.model_params, 'mask'):
              return self.model_params.mask
          else:
              return ones(self.shape, 'bool')
  
      ### Getitem Property ###
      def __getitem__(self, index):
          """
          Returns part of the model array
  
          """
          if type(index) is not tuple:
              index = (index,)
          if len(index) > self.ndim:
              raise IndexError('invalid index')
          for ii, slc in enumerate(index):
              if slc is Ellipsis:
                  n_ellipsis = len(self.shape) - len(index) + 1
                  index = index[:ii] + n_ellipsis*(slice(None),) + index[ii+1:]
                  break
  
          new_model = copy(self)
          new_model.model_params = self.model_params[index]
          return new_model
  
      def _get_model_params(self):
          return self._model_params
  
      def _set_model_params(self, params):
          self._model_params = params
  
      model_params = property(_get_model_params, _set_model_params)
  
  
  
subject: TEST - added modelarray tests