def setData(self, label, data): """Store atomic *data* under *label*, which must: * start with a letter * contain only alphanumeric characters and underscore * not be a reserved word (see :func:`.listReservedWords`) *data* must be a :func:`list` or a :class:`~numpy.ndarray` and its length must be equal to the number of atoms. If the dimension of the *data* array is 1, i.e. ``data.ndim==1``, *label* may be used to make atom selections, e.g. ``"label 1 to 10"`` or ``"label C1 C2"``. Note that, if data with *label* is present, it will be overwritten.""" label = checkLabel(label) if isscalar(data): data = [data] * self._n_csets data = asarray(data) ndim, dtype, shape = data.ndim, data.dtype, data.shape if ndim == 1 and dtype == bool: raise TypeError('1 dimensional boolean arrays are not ' 'accepted, use `setFlags` instead') if len(data) != self._n_csets: raise ValueError('len(data) must match number of coordinate sets') self._data[label] = data