Skip to content

[Bug] ValueError: Number of signals and coords is not same #550

@rcpeene

Description

@rcpeene

Describe the bug
I'm attempting to use elephant to perform CSD analysis. In a Jupyter notebook, I have implemented the temporary fix mentioned here in my usage. However, the output is not produced and I get an error (traceback below). Is this a failure of my usage? Or a bug in the code? I'm not fully sure what the error output means.

To Reproduce

  1. Run the following code after importing the relevant elephant namespaces:
xs = np.array(nwb.electrodes.x)
xs = xs.reshape(xs.shape[0],1)
ys = np.array(nwb.electrodes.x)
ys = ys.reshape(ys.shape[0],1)

lfp = generate_lfp(small_source_2D, xs, ys)
estimate_csd(lfp, method="KCSD2D")

where nwb.electrodes.x and nwb.electrodes.y are arrays of length 2304.

Expected behavior
A resulting CSD array is expected to be outputted.

Environment
Windows 10:
Installed elephant with pip install elephant:
Python version: 3.9.10
neo==0.12.0
numpy==1.21.5
elephant==0.12.0

Traceback

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In [43], line 7
      4 ys = ys.reshape(ys.shape[0],1)
      6 lfp = generate_lfp(small_source_2D, xs, ys)
----> 7 estimate_csd(lfp, method="KCSD2D")

File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\elephant\utils.py:80, in deprecated_alias.<locals>.deco.<locals>.wrapper(*args, **kwargs)
     77 @wraps(func)
     78 def wrapper(*args, **kwargs):
     79     _rename_kwargs(func.__name__, kwargs, aliases)
---> 80     return func(*args, **kwargs)

File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\elephant\current_source_density.py:137, in estimate_csd(lfp, coordinates, method, process_estimate, **kwargs)
    135     raise ValueError('Must specify a method of CSD implementation')
    136 if len(coordinates) != lfp.shape[1]:
--> 137     raise ValueError('Number of signals and coords is not same')
    138 for ii in coordinates:  # CHECK for Dimensionality of electrodes
    139     if len(ii) > 3:

ValueError: Number of signals and coords is not same

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviordocumentationIndicates a need for improvements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions