docs: def load_probe_file(recording, probe_file, channel_map=None, channel_groups=None):
      '''Loads channel information into recording extractor. If a .prb file is given,
      then 'location' and 'group' information for each channel is stored. If a .csv
      file is given, then it will only store 'location'
  
      Parameters
      ----------
      recording: RecordingExtractor
          The recording extractor to channel information
      probe_file: str
          Path to probe file. Either .prb or .csv
      Returns
      ---------
      subRecordingExtractor
      '''
      probe_file = Path(probe_file)
      if probe_file.suffix == '.prb':
          probe_dict = read_python(probe_file)
          if 'channel_groups' in probe_dict.keys():
              ordered_channels = np.array([], dtype=int)
              groups = sorted(probe_dict['channel_groups'].keys())
              for cgroup_id in groups:
                  cgroup = probe_dict['channel_groups'][cgroup_id]
                  for key_prop, prop_val in cgroup.items():
                      if key_prop == 'channels':
                          ordered_channels = np.concatenate((ordered_channels, prop_val))
  
              if list(ordered_channels) == recording.get_channel_ids():
                  subrecording = recording
              else:
                  if not np.all([chan in recording.get_channel_ids() for chan in ordered_channels]):
                      print('Some channel in PRB file are in original recording')
                  present_ordered_channels = [chan for chan in ordered_channels if chan in recording.get_channel_ids()]
                  subrecording = SubRecordingExtractor(recording, channel_ids=present_ordered_channels)
              for cgroup_id in groups:
                  cgroup = probe_dict['channel_groups'][cgroup_id]
                  if 'channels' not in cgroup.keys() and len(groups) > 1:
                      raise Exception("If more than one 'channel_group' is in the probe file, the 'channels' field"
                                      "for each channel group is required")
                  elif 'channels' not in cgroup.keys():
                      channels_in_group = subrecording.get_num_channels()
                  else:
                      channels_in_group = len(cgroup['channels'])
                  for key_prop, prop_val in cgroup.items():
                      if key_prop == 'channels':
                          for i_ch, prop in enumerate(prop_val):
                              if prop in subrecording.get_channel_ids():
                                  subrecording.set_channel_property(prop, 'group', int(cgroup_id))
                      elif key_prop == 'geometry' or key_prop == 'location':
                          if isinstance(prop_val, dict):
                              if len(prop_val.keys()) == channels_in_group:
                                  print('geometry in PRB have not the same length as channel in group')
                              for (i_ch, prop) in prop_val.items():
                                  if i_ch in subrecording.get_channel_ids():
                                      subrecording.set_channel_property(i_ch, 'location', prop)
                          elif isinstance(prop_val, (list, np.ndarray)) and len(prop_val) == channels_in_group:
                              for (i_ch, prop) in zip(subrecording.get_channel_ids(), prop_val):
                                  if i_ch in subrecording.get_channel_ids():
                                      subrecording.set_channel_property(i_ch, 'location', prop)
                      else:
                          if isinstance(prop_val, dict) and len(prop_val.keys()) == channels_in_group:
                              for (i_ch, prop) in prop_val.items():
                                  if i_ch in subrecording.get_channel_ids():
                                      subrecording.set_channel_property(i_ch, key_prop, prop)
                          elif isinstance(prop_val, (list, np.ndarray)) and len(prop_val) == channels_in_group:
                              for (i_ch, prop) in zip(subrecording.get_channel_ids(), prop_val):
                                  if i_ch in subrecording.get_channel_ids():
                                      subrecording.set_channel_property(i_ch, key_prop, prop)
                  # create dummy locations
                  if 'geometry' not in cgroup.keys() and 'location' not in cgroup.keys():
                      for i, chan in enumerate(subrecording.get_channel_ids()):
                          subrecording.set_channel_property(chan, 'location', [i, 0])
          else:
              raise AttributeError("'.prb' file should contain the 'channel_groups' field")
  
      elif probe_file.suffix == '.csv':
          if channel_map is not None:
              assert np.all([chan in channel_map for chan in recording.get_channel_ids()]), \
                  "all channel_ids in 'channel_map' must be in the original recording channel ids"
              subrecording = SubRecordingExtractor(recording, channel_ids=channel_map)
          else:
              subrecording = recording
          with probe_file.open() as csvfile:
              posreader = csv.reader(csvfile)
              row_count = 0
              loaded_pos = []
              for pos in (posreader):
                  row_count += 1
                  loaded_pos.append(pos)
              assert len(subrecording.get_channel_ids()) == row_count, "The .csv file must contain as many " \
                                                                     "rows as the number of channels in the recordings"
              for i_ch, pos in zip(subrecording.get_channel_ids(), loaded_pos):
                  if i_ch in subrecording.get_channel_ids():
                      subrecording.set_channel_property(i_ch, 'location', list(np.array(pos).astype(float)))
              if channel_groups is not None and len(channel_groups) == len(subrecording.get_channel_ids()):
                  for i_ch, chg in zip(subrecording.get_channel_ids(), channel_groups):
                      if i_ch in subrecording.get_channel_ids():
                          subrecording.set_channel_property(i_ch, 'group', chg)
      else:
          raise NotImplementedError("Only .csv and .prb probe files can be loaded.")
  
      return subrecording