def __getitem__(self, key):
        """
        TODO: add documentation
        """

        # TODO: split this stuff into the correct classes/subclasses

        if isinstance(key, str):
            if hasattr(self, key):
                return getattr(self, key)
            elif hasattr(self, '_observables') and key in self._observables.keys():
                # applicable only for Mesh, not ProtoMesh
                return self._observables[key]
            else:
                raise KeyError("{} is not a valid key".format(key))
        elif isinstance(key, np.ndarray):
            raise KeyError("use mesh.take(bool_per_triangle, bool_per_vertex) to split mesh")
def __getitem__ ( self , key ) : if isinstance ( key , str ) : if hasattr ( self , key ) : return getattr ( self , key ) elif hasattr ( self , '_observables' ) and key in self . _observables . keys ( ) : return self . _observables [ key ] else : raise KeyError ( "{} is not a valid key" . format ( key ) ) elif isinstance ( key , np . ndarray ) : raise KeyError ( "use mesh.take(bool_per_triangle, bool_per_vertex) to split mesh" )
TODO: add documentation