class_docstr: A composite class to hold many data sets which can be iterated over.
  
  This wraps/extends the `vtkMultiBlockDataSet
  <https://vtk.org/doc/nightly/html/classvtkMultiBlockDataSet.html>`_ class
  so that we can easily plot these data sets and use the composite in a
  Pythonic manner.
  
  You can think of ``MultiBlock`` like a list as we
  can iterate over this data structure by index.  It has some dictionary
  features as we can also access blocks by their string name.
  
  .. versionchanged:: 0.36.0
     ``MultiBlock`` adheres more closely to being list like, and inherits
     from :class:`collections.abc.MutableSequence`.  Multiple nonconforming
     behaviors were removed or modified.
  
  Parameters
  ----------
  *args : dict, optional
      Data object dictionary.
  
  **kwargs : dict, optional
      See :func:`pyvista.read` for additional options.
  
  Examples
  --------
  >>> import pyvista as pv
  
  Create an empty composite dataset.
  
  >>> blocks = pv.MultiBlock()
  
  Add a dataset to the collection.
  
  >>> sphere = pv.Sphere()
  >>> blocks.append(sphere)
  
  Add a named block.
  
  >>> blocks["cube"] = pv.Cube()
  
  Instantiate from a list of objects.
  
  >>> data = [
  ...     pv.Sphere(center=(2, 0, 0)),
  ...     pv.Cube(center=(0, 2, 0)),
  ...     pv.Cone(),
  ... ]
  >>> blocks = pv.MultiBlock(data)
  >>> blocks.plot()
  
  Instantiate from a dictionary.
  
  >>> data = {
  ...     "cube": pv.Cube(),
  ...     "sphere": pv.Sphere(center=(2, 2, 0)),
  ... }
  >>> blocks = pv.MultiBlock(data)
  >>> blocks.plot()
  
  Iterate over the collection.
  
  >>> for name in blocks.keys():
  ...     block = blocks[name]
  ...
  
  >>> for block in blocks:
  ...     # Do something with each dataset
  ...     surf = block.extract_surface()
  ...
class_docstr_tok: ["A","composite","class","to","hold","many","data","sets","which","can","be","iterated","over",".","This","wraps\/extends","the","`","vtkMultiBlockDataSet","<","https",":","\/\/vtk.org\/doc\/nightly\/html\/classvtkMultiBlockDataSet.html",">","`","_","class","so","that","we","can","easily","plot","these","data","sets","and","use","the","composite","in","a","Pythonic","manner",".","You","can","think","of","``","MultiBlock","``","like","a","list","as","we","can","iterate","over","this","data","structure","by","index",".","It","has","some","dictionary","features","as","we","can","also","access","blocks","by","their","string","name",".","..","versionchanged",":",":","0.36.0","``","MultiBlock","``","adheres","more","closely","to","being","list","like",",","and","inherits","from",":","class",":","`","collections.abc.MutableSequence","`",".","Multiple","nonconforming","behaviors","were","removed","or","modified",".","Parameters","--","--","--","--","--","*","args",":","dict",",","optional","Data","object","dictionary",".","*","*","kwargs",":","dict",",","optional","See",":","func",":","`","pyvista.read","`","for","additional","options",".","Examples","--","--","--","--",">",">",">","import","pyvista","as","pv","Create","an","empty","composite","dataset",".",">",">",">","blocks","=","pv.MultiBlock","(",")","Add","a","dataset","to","the","collection",".",">",">",">","sphere","=","pv.Sphere","(",")",">",">",">","blocks.append","(","sphere",")","Add","a","named","block",".",">",">",">","blocks","[","``","cube","''","]","=","pv.Cube","(",")","Instantiate","from","a","list","of","objects",".",">",">",">","data","=","[","...","pv.Sphere","(","center=","(","2",",","0",",","0",")",")",",","...","pv.Cube","(","center=","(","0",",","2",",","0",")",")",",","...","pv.Cone","(",")",",","...","]",">",">",">","blocks","=","pv.MultiBlock","(","data",")",">",">",">","blocks.plot","(",")","Instantiate","from","a","dictionary",".",">",">",">","data","=","{","...","``","cube","''",":","pv.Cube","(",")",",","...","``","sphere","''",":","pv.Sphere","(","center=","(","2",",","2",",","0",")",")",",","...","}",">",">",">","blocks","=","pv.MultiBlock","(","data",")",">",">",">","blocks.plot","(",")","Iterate","over","the","collection",".",">",">",">","for","name","in","blocks.keys","(",")",":","...","block","=","blocks","[","name","]","...",">",">",">","for","block","in","blocks",":","...","#","Do","something","with","each","dataset","...","surf","=","block.extract_surface","(",")","..."]
docstr: Convert multi-component scalars to a single component.
docstr_tok: ["Convert","multi-component","scalars","to","a","single","component","."]
code: def _convert_to_single_component(
      self,
      data_attr: str,
      scalars_name: str,
      component: Union[None, str],
  ) -> str:
      """Convert multi-component scalars to a single component."""
      if component is None:
          for block in self:
              if isinstance(block, MultiBlock):
                  block._convert_to_single_component(
                      data_attr, scalars_name, component
                  )
              elif block is not None:
                  scalars = getattr(block, data_attr).get(
                      scalars_name, None
                  )
                  if scalars is not None:
                      scalars = np.linalg.norm(scalars, axis=1)
                      dattr = getattr(block, data_attr)
                      dattr[f"{scalars_name}-normed"] = scalars
                      dattr.active_scalars_name = (
                          f"{scalars_name}-normed"
                      )
          return f"{scalars_name}-normed"
  
      for block in self:
          if isinstance(block, MultiBlock):
              block._convert_to_single_component(
                  data_attr, scalars_name, component
              )
          elif block is not None:
              scalars = getattr(block, data_attr).get(
                  scalars_name, None
              )
              if scalars is not None:
                  dattr = getattr(block, data_attr)
                  dattr[f"{scalars_name}-{component}"] = scalars[
                      :, component
                  ]
                  dattr.active_scalars_name = (
                      f"{scalars_name}-{component}"
                  )
      return f"{scalars_name}-{component}"
  
imports: import collections.abc
  from itertools import zip_longest
  import pathlib
  from typing import Any, Iterable, List, Optional, Set, Tuple, Union, cast, overload
  import numpy
  import pyvista
  from .None import _vtk_core
  from ._typing_core import BoundsLike
  from .dataset import DataObject, DataSet
  from .filters import CompositeFilters
  from .pyvista_ndarray import pyvista_ndarray
  from .utilities.arrays import FieldAssociation
  from .utilities.geometric_objects import Box
  from .utilities.helpers import is_pyvista_dataset, wrap
label_desc: Use image node_id 47 for calling the MultiBlock obj's underlying member method code with example usage: obj._convert_to_single_component(data_attr, scalars_name, component) and returns: scalars_name, str, component, scalars_name, str