docs: def add_analysis_dataset(self, group_name, dataset_name, data, attrs=None):
          """ Add a dataset to the specified group.
          
          :param group_name: The path of the group the dataset will be added to,
              relative to the "Analyses" group.
          :param dataset_name: The name of the new dataset.
          :param data: A numpy array representing the data to be written.
          :param attrs: A dictionary of attributes to be added to the dataset.
          :raises KeyError: If dataset is being added to non-existant group or
              if file is not open for writing.
          """
          self.assert_writeable()
          group_path = 'Analyses/{}'.format(group_name)
          if group_path not in self.handle:
              msg = 'Dataset cannot be added to non-existent group: Analyses/{} in {}'
              raise KeyError(msg.format(group_name, self.filename))
  
          sanitized_data = _sanitize_data_for_writing(data)
          if np.shape(sanitized_data) == ():  # We can't compress scalar datasets
              self.handle[group_path].create_dataset(dataset_name,
                                                     data=sanitized_data)
          else:
              self.handle[group_path].create_dataset(dataset_name,
                                                     data=sanitized_data,
                                                     compression='gzip')
          if attrs is not None:
              path = '{}/{}'.format(group_path, dataset_name)
              self._add_attributes(path, attrs)