Code Monkey home page Code Monkey logo

meautility's Introduction

Build Status PyPI version

MEAutility

Python package for multi-electrode array (MEA) handling and stimulation.

Installation

To install run: pip install MEAutility

If you want to install from sources and be updated with the latest development you can install with:

git clone https://github.com/alejoe91/MEAutility
cd MEAutility
python setup.py install (or develop)

The package can then imported in Python with:

import MEAutility as MEA

Requirements

  • numpy
  • pyyaml
  • matplotlib

Documentation

Please refer to https://meautility.readthedocs.io/en/latest/

Contact

For any questions or comments, please contact Alessio Buccino: [email protected]

meautility's People

Contributors

alejoe91 avatar espenhgn avatar torbjone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

meautility's Issues

trying to set currents errors

/media/terror/code/source/MEAutility/MEAutility/core.py in reset_currents(self, amp)
324 else:
325 currents = amp*np.ones(self.number_electrode)
--> 326 self.currents(currents)
327
328

TypeError: 'numpy.ndarray' object is not callable


/media/terror/code/source/MEAutility/MEAutility/core.py in set_current_matrix(self, currents)
503 # for zz in range(self.dim):
504 # current_array[self.dim * yy + zz] = currents[zz, yy]
--> 505 self.set_currents(currents=np.reshape(currents, self.dim))
506
507

AttributeError: 'RectMEA' object has no attribute 'set_currents'

mea plot 3d green? plane not moved in z-axis

Yes. No need to say more. Security issue. Defcon 1.

I believe it is somehow related to mea.move(). The green plane is displayed at z=0, the electrode plane is where it should be. x and y displacement look fine.
Why?

DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead

Running the test suite now results in some DeprecationWarning in MEAutility:

/Users/espenhagen/miniforge3/envs/lfpy/lib/python3.9/site-packages/MEAutility/core.py:23: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if StrictVersion(yaml.__version__) >= StrictVersion('5.0.0'):

This was with (truncated list):

matplotlib                3.5.1           py310hb6292c7_0    conda-forge
meautility                1.5.0                    pypi_0    pypi
numpy                     1.22.2          py310h567df17_0    conda-forge
packaging                 21.3               pyhd8ed1ab_0    conda-forge
pytest                    7.0.0           py310hbe9552e_0    conda-forge
python                    3.10.2          h38ef502_3_cpython    conda-forge

electrodes and probe misaligned when mea.move()

after a mea.move([0, 2000, 50]) and a mea.plot_probe_3d() the electrodes (correctly at -2000) are not overlapped by the probe (seems to be at -4000).
Furthermore, the x and y axes (I had set the range of the z axis) are huge: x:[0, -8000] and y:[0, -10000] even though there does not seem to be anything there.

DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`

Hi @alejoe91 ;
The LFPy tests now throws a bunch of DeprecationWarnings from numpy (>v1.20) via MEAutility. np.float should just be float presumably:

  /Users/ehagen/anaconda3/envs/lfpy/lib/python3.9/site-packages/MEAutility/core.py:542: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    if isinstance(current_value, (float, int, np.float, np.integer)):

mea.plot_probe_3d

Catastrophic failure!!!! I have been hacked! VIRUS!

when using negative currents, then all the electrodes are plotted as negative, even the ones set to 0.
It is terrible.

Save me.

plot_3d

when I assign new positions to the electrodes, like
for i in range(bisc.get_electrodes_number()): bisc.electrodes[i].current = params.sim['ampere'] bisc.electrodes[i].position[2] = pia_height
and I then ask for:
mea.plot_probe_3d(bisc, ax=ax1, xlim=[-300, 300], ylim=[-300, 300], zlim=[np.min(cell.zmid) - 50, 200])
the green plane is not aligned (still at z=0) with the electrode plane (correctly at z=pia_height)

Problem with 3D electrode grids?

Hi,
in LFPy, I got an error when I tried to make a 3D grid of electrodes:

"
....
File "/home/tone/work/LFPykit/lfpykit/models.py", line 841, in init
self.probe = mu.MEA(positions=positions, info=probe_info,
File "/home/tone/.local/lib/python3.8/site-packages/MEAutility/core.py", line 379, in init
normal /= np.linalg.norm(normal)
TypeError: ufunc 'true_divide' output (typecode 'd') could not be coerced to provided output parameter (typecode 'l') according to the casting rule ''same_kind''
"
I'm not sure what is causing the error, but an easy fix seems to be to change from
normal /= np.linalg.norm(normal)
to
normal = normal / np.linalg.norm(normal)
at this line:

normal /= np.linalg.norm(normal)

Here is a notebook example that reproduces the error locally:
https://www.dropbox.com/s/k22jnskumzi9o9k/LFPy-example-02-Copy1.ipynb?dl=0

Do you also have this issue?

Finite size electrodes

We should extend the code to include finite size electrodes such as, at least, squares.

make electrode definition more flexible

  • allow to pass positions in the yaml file
  • (alternatively) pass plane (xy, yz, xz), dim [2D]
  • do not hard-code get_elcoords: this should be independent on the electrode type (some sample electrode design could be included)
  • command line interface to add a user defined yaml MEA file

improve mea class

easy access to pitch, dimension, position and possibility to create "standard" MEA in one line.

e.g.

mea = MEAutility.create_mea('Neuronexus-32')

plotting electrodes

Would not it be fantastic if the MEA plot would color the active electrodes differently from the inactive ones?
currents == 0 Vs currents!= 0
I believe it would be amazing.

About 3D grid electrodes

Hi,
Could I build a 3D electrodes in LFPy through MEA? I have read the documentation, but I only found the way of 2D electrodes building which means that put electrodes on same plane.
An idea come to me is build multiple 2D electrodes(xy plane), put them to different position on z-axis and superpose it.
Does it work or can I build 3D directly?
Thanks.

port methods from neuroplot

copy and organize methods for:

  • plotting recordings/waveforms
  • rotate probe in 3d
  • 2D and 3d plot of the probe

Create arbitrary electrode layout

I am trying to create a MEArec file, but I first want to define my MEA geometry with arbitrary locations (no regular pattern). I can not figure out how to create this in MEAutility from the documentation. I was wondering if you might have any insights into how to make this? Would it be possible to import a list of points?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.