Uploaded image for project: 'The Virtual Brain'
  1. The Virtual Brain
  2. TVB-3012

MEG monitor creating wrong size projection matrices when considering subcortical regions.

    XMLWordPrintable

Details

    Description

      Please see the pull request: https://github.com/the-virtual-brain/tvb-root/pull/553

      The bug:

      in monitors.py file in line 559 when the gain matrix for the MEG monitor is specified (when running region-wise simulation) 
       
      the code is:
      >>> gain = numpy.zeros((self.gain.shape[0], conn.number_of_regions))
       
      this causes the gain matrix shape to have shape[1] equal to the number of regions regardless of whether they are cortical or subcortical. The resulting gain matrix has shape:  
      [number of sources,  number of regions]
       
      A few lines later in line 569, when considering subcortical regions (if they are specified in the connectome), they are stacked onto the gain matrix again, causing the matrix to have the shape of:
      [number of sources,  number of regions + number of subcortical regions]

      When running the simulation this causes an error related to the mismatch in the shape of the specified and resulting outputs of the monitor.
       
      I have changed the line 559 to adjust the shape[1] of the gain matrix:
       
      >>> gain = numpy.zeros((self.gain.shape[0], conn.number_of_regions -len(numpy.where(~conn.cortical)[0]))) 
       
      and this created correct outputs. 
       
      I have tested this on the default 192 regions connectivity. The code still throws RunTimeWarnings pertaining to the divisions by zero - resulting from the fact that distances and sensors positions are sometimes set to 0 (in the input files), but the resulting shape of the projection matrix (gain matrix) and output of test simulations seem to be correct.

      Gliffy Diagrams

        Attachments

          Issue Links

            Activity

              People

                marmaduke.woodman Marmaduke Woodman
                jan.stasinski Jan Stasinski
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:

                  Time Tracking

                    Estimated:
                    Original Estimate - 2 days
                    2d
                    Remaining:
                    Remaining Estimate - 2 days
                    2d
                    Logged:
                    Time Spent - Not Specified
                    Not Specified