Skip to content

BUG: empty patches are not handled properly #69

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

Open
ctrltz opened this issue Feb 7, 2025 · 1 comment
Open

BUG: empty patches are not handled properly #69

ctrltz opened this issue Feb 7, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@ctrltz
Copy link
Owner

ctrltz commented Feb 7, 2025

Empty patches lead to an error when combining sources into stc, and the error message is not very descriptive.

 40%|███▉      | 99/250 [2:56:36<4:33:43, 108.76s/it]/data/p_02490/Scripts/meegsim/src/meegsim/sources.py:245: RuntimeWarning: divide by zero encountered in scalar divide
  scaling_factor = 1 / np.sqrt(len(self.vertno))

 40%|███▉      | 99/250 [2:56:47<4:29:39, 107.15s/it]
Traceback (most recent call last):
  File "/data/p_02490/Scripts/roiextract_simulations/scripts/entry_points/simulate.py", line 280, in <module>
    simulate(
  File "/data/p_02490/Scripts/roiextract_simulations/scripts/entry_points/simulate.py", line 205, in simulate
    sc = sim.simulate(
         ^^^^^^^^^^^^^
  File "/data/p_02490/Scripts/meegsim/src/meegsim/simulate.py", line 446, in simulate
    sources, noise_sources = _simulate(
                             ^^^^^^^^^^
  File "/data/p_02490/Scripts/meegsim/src/meegsim/simulate.py", line 513, in _simulate
    _adjust_snr_global(
  File "/data/p_02490/Scripts/meegsim/src/meegsim/snr.py", line 163, in _adjust_snr_global
    stc_signal = _combine_sources_into_stc(sources.values(), src, tstep)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/p_02490/Scripts/meegsim/src/meegsim/sources.py", line 370, in _combine_sources_into_stc
    vertices_stacked = np.vstack(vertices)
                       ^^^^^^^^^^^^^^^^^^^
  File "/data/u_kapralov_software/miniconda3/envs/roiextract_simulations/lib/python3.12/site-packages/numpy/core/shape_base.py", line 289, in vstack
    return _nx.concatenate(arrs, 0, dtype=dtype, casting=casting)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: all the input array dimensions except for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 2 and the array at index 52 has size 0
@ctrltz ctrltz added the bug Something isn't working label Feb 7, 2025
@ctrltz ctrltz added this to the 0.0.2 milestone Feb 7, 2025
@ctrltz
Copy link
Owner Author

ctrltz commented Mar 29, 2025

To solve this, we need to check the locations and waveforms for the second time when generating sources. This problem won't arise if we just drop support for callable locations and waveforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant