Skip to content
New issue

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

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

Already on GitHub? # to your account

Unit mismatch in MultiUnitSpiking when running LFP tutorial #48

Closed
frthjf opened this issue Apr 24, 2024 · 3 comments · Fixed by #49
Closed

Unit mismatch in MultiUnitSpiking when running LFP tutorial #48

frthjf opened this issue Apr 24, 2024 · 3 comments · Fixed by #49

Comments

@frthjf
Copy link

frthjf commented Apr 24, 2024

Hi!

First, thanks a lot for developing this package, it's excellent and really well documented!

I've been toying around with the Advanced LFP tutorial and I believe there is an issue with the units of the MultiUnitSpiking signal:

  File "simulation.py", line 365, in init
    simulation.inject(
  File "/python3/lib/python3.10/site-packages/cleo/base.py", line 383, in inject
    device.connect_to_neuron_group(ng, **kwparams)
  File "/python3/lib/python3.10/site-packages/cleo/ephys/probes.py", line 158, in connect_to_neuron_group
    signal.connect_to_neuron_group(neuron_group, **kwparams)
  File "/python3/lib/python3.10/site-packages/cleo/ephys/spiking.py", line 209, in connect_to_neuron_group
    neuron_channel_dtct_probs = super(
  File "/python3/lib/python3.10/site-packages/cleo/ephys/spiking.py", line 100, in connect_to_neuron_group
    probs = self._detection_prob_for_distance(distances)
  File "/python3/lib/python3.10/site-packages/cleo/ephys/spiking.py", line 149, in _detection_prob_for_distance
    decaying_p = h / (r - c)
  File "/python3/lib/python3.10/site-packages/brian2/units/fundamentalunits.py", line 1193, in __array_ufunc__
    fail_for_dimension_mismatch(
  File "/python3/lib/python3.10/site-packages/brian2/units/fundamentalunits.py", line 266, in fail_for_dimension_mismatch
    raise DimensionMismatchError(error_message, dim1, dim2)
brian2.units.fundamentalunits.DimensionMismatchError: Cannot calculate [[107.43123428  44.86179886 ... 193.94388688 214.15676509]
 [149.46418226  84.59855499 ... 188.94152985 195.68866257]
 ...
 [226.23937524 204.19338619 ...  36.16518571  97.96112797]
 [254.65660985 220.12370993 ...  32.13300059  49.14026405]] mm^2 subtract 0. m, the units do not match (units are m^2 and m).

Let me know if you can not reproduce this then I can try and come up with a more minimal reproducer.

Thanks!

@kjohnsen
Copy link
Member

kjohnsen commented May 8, 2024

Hi there, sorry for the delay. I actually have seen you on GitHub before due to your Obisdian plugin. Small world!

I am able to reproduce your error--seems that numpy sometimes strips Brian units or sometimes doesn't, depending on the version. I'll get a patch up soon--let me know if it doesn't fix this problem

@kjohnsen
Copy link
Member

kjohnsen commented May 8, 2024

v0.14.3 shouldn't have this problem anymore. Thanks for reporting the bug and let me know if you have any questions as to how Cleo can help you in your research!

@frthjf
Copy link
Author

frthjf commented May 9, 2024

Great, thank you!

Small world!

Indeed! 😄

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants