# Difficulties with defining source space src, when I change spacing to ico5

**URL:** <https://mne.discourse.group/t/difficulties-with-defining-source-space-src-when-i-change-spacing-to-ico5/3860>\
**Category:** Support & Discussions\
**Tags:** ﻿source-localization\
**Created:** [October 26, 2021, 12:10pm UTC](https://mne.discourse.group/t/difficulties-with-defining-source-space-src-when-i-change-spacing-to-ico5/3860 "2021-10-26T12:10:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mirrabella](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@Mirrabella](https://mne.discourse.group/u/Mirrabella)\
**Post date:** [October 26, 2021, 12:10pm UTC](https://mne.discourse.group/t/difficulties-with-defining-source-space-src-when-i-change-spacing-to-ico5/3860/1 "2021-10-26T12:10:01Z")

</div>

**I have a difficulties with defining source space src, when I change spacing to ico5. It is no group analysis, I defining source space for one subject only**

- MNE-Python version: 0.22.0
- operating system: Linux Ubuntu

```python
os.environ['SUBJECTS_DIR'] = '/net/server/data/Archive/prob_learn/freesurfer'
subject='P045'
src = mne.setup_source_space(subject = subject, spacing='ico5', add_dist=False )

```

Gives an error message:

```python
setting up the source space with the following parameters:

SUBJECTS_DIR = /net/server/data/Archive/prob_learn/freesurfer
Subject = P045
Surface = white
Icosahedron subdivision grade 5

>>> 1. Creating the source space...

Doing the icosahedral vertex picking...
Loading /net/server/data/Archive/prob_learn/freesurfer/P045/surf/lh.white...
Mapping lh P045 -> ico (5) ...
    Triangle neighbors and vertex normals...
Loading geometry from /net/server/data/Archive/prob_learn/freesurfer/P045/surf/lh.sphere...
    Source space vertex moved from 54910 to 56106 because of double occupation

```

```python
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-9-df604f17014f> in <module>
----> 1 src = mne.setup_source_space(subject =subject, spacing='ico5', add_dist=False )

<decorator-gen-116> in setup_source_space(subject, spacing, surface, subjects_dir, add_dist, n_jobs, verbose)

/opt/anaconda3/envs/py37/lib/python3.7/site-packages/mne/source_space.py in setup_source_space( ***failed resolving arguments*** )
   1531 % (hemi, subject, stype, sval))
   1532 s = _create_surf_spacing(surf, hemi, subject, stype, ico_surf,
-> 1533 subjects_dir)
   1534 logger.info('loaded %s %d/%d selected to source space (%s)'
   1535 % (op.split(surf)[1], s['nuse'], s['np'], src_type_str))

/opt/anaconda3/envs/py37/lib/python3.7/site-packages/mne/surface.py in _create_surf_spacing(surf, hemi, subject, stype, ico_surf, subjects_dir)
    970 if len(inds) == 0:
    971 raise RuntimeError('Could not find neighbor for vertex '
--> 972 '%d / %d' % (k, nmap))
    973 else:
    974 mmap[k] = neigh[inds[-1]]

RuntimeError: Could not find neighbor for vertex 4395 / 10242.

```

Could you help me with the problem?

Another quistion, how I can change amount of sources in fsaverage (by default it is 20484). But if I use spacing = oct6 (in mne.setup\_source\_space by default), the amount of sources for subject is 8196, and Icannot morph it with fsaverage, I suppose.

Thank you in advance

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [October 26, 2021, 12:28pm UTC](https://mne.discourse.group/t/difficulties-with-defining-source-space-src-when-i-change-spacing-to-ico5/3860/2 "2021-10-26T12:28:42Z")

</div>

Hello @Mirrabella and welcome to the forum!

Please fill in the requested information (MNE-Python version, operating system) in the post template (you can edit your existing posting). Also, we will need much more information on what you have been trying to do and what exactly isn’t working. Otherwise it’s close to impossible to help you. Please provide code snippets and ideally a minimal working example.

Thanks,  
Richard

---

<div class="post-metadata">

**Author:** ![mmagnuski](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mmagnuski/32/153_2.png) [@mmagnuski](https://mne.discourse.group/u/mmagnuski)\
**Post date:** [October 26, 2021, 4:17pm UTC](https://mne.discourse.group/t/difficulties-with-defining-source-space-src-when-i-change-spacing-to-ico5/3860/3 "2021-10-26T16:17:27Z")

</div>

@Mirrabella I’ve edited your post for clarity, you can take a look at the edits to be able to format the code and exceptions nicely next time 🙂

---

<div class="post-metadata">

**Author:** ![Mirrabella](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@Mirrabella](https://mne.discourse.group/u/Mirrabella)\
**Post date:** [October 27, 2021, 3:58pm UTC](https://mne.discourse.group/t/difficulties-with-defining-source-space-src-when-i-change-spacing-to-ico5/3860/4 "2021-10-27T15:58:12Z")

</div>

thank you very much 🙂
