original_docstring: Get the impedance values in kOhm from raw.impedances.
docstring: Get the impedance values in kOhm from raw.impedances.
docstring_tokens: Get the impedance values in kOhm from raw . impedances .
code: def _get_impedances(raw, names):
      """Get the impedance values in kOhm from raw.impedances."""
      if not hasattr(raw, 'impedances'):  # pragma: no cover
          return ['n/a'] * len(names)
      no_info = {'imp': 'n/a', 'imp_unit': 'kOhm'}
      impedance_dicts = [raw.impedances.get(name, no_info) for name in names]
      # If we encounter a unit not defined in `scalings`, return NaN
      scalings = {'kOhm': 1, 'Ohm': 0.001}
      impedances = [
          imp_dict['imp'] * scalings.get(imp_dict['imp_unit'], np.nan)
          for imp_dict in impedance_dicts
      ]
      return impedances
code_tokens: def _get_impedances ( raw , names ) : if not hasattr ( raw , 'impedances' ) : return [ 'n/a' ] * len ( names ) no_info = { 'imp' : 'n/a' , 'imp_unit' : 'kOhm' } impedance_dicts = [ raw . impedances . get ( name , no_info ) for name in names ] scalings = { 'kOhm' : 1 , 'Ohm' : 0.001 } impedances = [ imp_dict [ 'imp' ] * scalings . get ( imp_dict [ 'imp_unit' ] , np . nan ) for imp_dict in impedance_dicts ] return impedances
short_docstring: Get the impedance values in kOhm from raw.impedances.
short_docstring_tokens: Get the impedance values in kOhm from raw . impedances .
comment: """Get the impedance values in kOhm from raw.impedances."""$SEP$# pragma: no cover$SEP$# If we encounter a unit not defined in `scalings`, return NaN