Inquiry about error in tutorial_s5_ModelingRestingStateNetworks.ipynb

9 views
Skip to first unread message

Chuyue Zhao

unread,
Jan 18, 2025, 11:31:22 PMJan 18
to TVB Users

Dear TVB Team,

I am learning to use TVB for brain network simulations. While running your tutorial file tutorial_s5_ModelingRestingStateNetworks.ipynb, I encountered the following issue:

When I execute:

for reg in 'lM1 rPFCVL rPCS'.split():
    plot_roi_corr_map(reg)

I get this error:

TraitAttributeError                       Traceback (most recent call last)
Cell In[8], line 2
      1 for reg in 'lM1 rPFCVL rPCS'.split():
----> 2     plot_roi_corr_map(reg)

Cell In[7], line 4
      2 roi = list(conn.ordered_labels).index(reg_name)
      3 cs_m = cs[2:].mean(axis=0)
----> 4 rm = utils.cortex.region_mapping
      5 utils.multiview(cs_m[roi][rm], shaded=False, suptitle=reg_name, figsize=(10, 5))

File c:\Users\MSI-NB\miniconda3\envs\tvb\Lib\site-packages\tvb\datatypes\cortex.py:70, in Cortex.region_mapping(self)
     68     return self._regmap
     69 rm = self.region_mapping_data.array_data
---> 70 unmapped = self.region_mapping_data.connectivity.unmapped_indices(rm)
     71 self._regmap = numpy.r_[rm, unmapped]
     72 return self._regmap

File c:\Users\MSI-NB\miniconda3\envs\tvb\Lib\site-packages\tvb\basic\neotraits\_attr.py:164, in Attr.__get__(self, instance, owner)
    162 value = instance.__dict__[self.field_name]
    163 if self.required and value is None:
--> 164     raise TraitAttributeError('required attribute referenced before assignment. '
    165                               'Use a default or assign a value before reading it', attr=self)
    166 return value

TraitAttributeError: required attribute referenced before assignment. Use a default or assign a value before reading it
  attribute tvb.datatypes.region_mapping.RegionMapping.connectivity = Attr(field_type=<class 'tvb.datatypes.connectivity.Connectivity'>, default=None, required=True).

From the traceback, it appears that cortex.region_mapping is being accessed before the region_mapping_data.connectivity attribute is properly initialized. I suspect I need to assign a valid Connectivity object to ctx.region_mapping_data.connectivity (or load it from a file), but I'm not entirely sure how to do this correctly for this tutorial.

Could you please advise me on the proper steps or configuration needed to resolve this error? Any guidance or reference to relevant documentation would be greatly appreciated.

Thank you very much for your time and support.

Sincerely,
Chuyue

WOODMAN Michael

unread,
Jan 20, 2025, 4:37:20 AMJan 20
to TVB Users
Hi,

Here’s an example notebook you can work from


cheers,
Marmaduke



On 19 Jan 2025, at 05:31, Chuyue Zhao <zhaoch...@gmail.com> wrote:

Ce mail provient de l'extérieur, restons vigilants

--
You received this message because you are subscribed to the Google Groups "TVB Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tvb-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/tvb-users/6b4c0727-aded-46b8-a5be-97d51eb0af84n%40googlegroups.com.

Chuyue Zhao

unread,
Jan 21, 2025, 2:37:45 AMJan 21
to tvb-...@googlegroups.com
Hi Marmaduke,
Thank you for your reply and the provided notebook, I'll try it.

Best,
Chuyue

Reply all
Reply to author
Forward
0 new messages