Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for MEG monitor - corrected projection shape #553

Closed
wants to merge 1 commit into from

Conversation

JanStasin
Copy link

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 was:

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.

fix for MEG monitor - corrected projection shape
@dionperd dionperd requested review from liadomide and maedoc April 26, 2022 12:51
@maedoc
Copy link
Member

maedoc commented Apr 26, 2022

Thanks for your effort on this one. Please ensure tests are passing and that you considered other cases handled by this method as well.

@JanStasin
Copy link
Author

JanStasin commented Apr 27, 2022 via email

@maedoc
Copy link
Member

maedoc commented Apr 28, 2022

I get that, no problem, but the fix cannot be merged like this. Please re-open when ready. In the meantime, I'll note this as a bug #556

@maedoc maedoc closed this Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants