Adds a named column of metadata values.

    Args:
      column_name: Name of the column.
      column_values: 1D array/list/iterable holding the column values. Must be
          of length `num_points`. The i-th value corresponds to the i-th point.

    Raises:
      ValueError: If `column_values` is not 1D array, or of length `num_points`,
          or the `name` is already used.

def add_column(self, column_name, column_values):
    """Adds a named column of metadata values.

    Args:
      column_name: Name of the column.
      column_values: 1D array/list/iterable holding the column values. Must be
          of length `num_points`. The i-th value corresponds to the i-th point.

    Raises:
      ValueError: If `column_values` is not 1D array, or of length `num_points`,
          or the `name` is already used.
    """
    # Sanity checks.
    if isinstance(column_values, list) and isinstance(column_values[0], list):
      raise ValueError('"column_values" must be a flat list, but we detected '
                       'that its first entry is a list')

    if isinstance(column_values, np.ndarray) and column_values.ndim != 1:
      raise ValueError('"column_values" should be of rank 1, '
                       'but is of rank %d' % column_values.ndim)
    if len(column_values) != self.num_points:
      raise ValueError('"column_values" should be of length %d, but is of '
                       'length %d' % (self.num_points, len(column_values)))
    if column_name in self.name_to_values:
      raise ValueError('The column name "%s" is already used' % column_name)

    self.column_names.append(column_name)
    self.name_to_values[column_name] = column_values