Code Monkey home page Code Monkey logo

ephys-viz's Introduction

ephys-viz

Neurophysiology visualization components deployable to the notebook, web, or desktop.

This project is at an early stage of development.

A live preview of these widgets can be found here: [link coming soon].

Installation

See installation instructions.

Usage

See the notebook_examples and desktop_examples directories for usage examples.

It is possible to view the widgets in JupyterLab, Jupyter Notebook, Google Colaboratory, or on a hosted webpage. See the installation instructions for more information on enabling these methods.

Tests

Some docker tests are available in the generated/tests directory.

ephys-viz's People

Contributors

magland avatar rgerkin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ephys-viz's Issues

VTK import error and solution

For conda installations of Python, VTK (required by ephys-viz) does not import successfully on some architectures. The conda team acknowledges that they are not providing the low-level libraries needs to fix this. One solution (for some architectures) is: apt install libgl1-mesa-glx which provides the libraries required for VTK (and hence ephys-viz) to import. This instruction may be added to a future conda-flavored set of install instructions or Dockerfile.

install error

(reactopya) Bens-MacBook-Pro-2:axel-lab-to-nwb bendichter$ pip install --upgrade git+https://github.com/flatironinstitute/reactopya
Collecting git+https://github.com/flatironinstitute/reactopya
  Cloning https://github.com/flatironinstitute/reactopya to /private/var/folders/cg/mhhypnc14wn9kz5ydllymyc00000gp/T/pip-req-build-3pzbtolf
  Running command git clone -q https://github.com/flatironinstitute/reactopya /private/var/folders/cg/mhhypnc14wn9kz5ydllymyc00000gp/T/pip-req-build-3pzbtolf
Requirement already satisfied, skipping upgrade: jinja2 in /anaconda3/envs/reactopya/lib/python3.7/site-packages (from reactopya==0.2.8) (2.10.1)
Requirement already satisfied, skipping upgrade: numpy in /anaconda3/envs/reactopya/lib/python3.7/site-packages (from reactopya==0.2.8) (1.16.4)
Requirement already satisfied, skipping upgrade: MarkupSafe>=0.23 in /anaconda3/envs/reactopya/lib/python3.7/site-packages (from jinja2->reactopya==0.2.8) (1.1.1)
Building wheels for collected packages: reactopya
  Building wheel for reactopya (setup.py) ... done
  Stored in directory: /private/var/folders/cg/mhhypnc14wn9kz5ydllymyc00000gp/T/pip-ephem-wheel-cache-c_cu6ji4/wheels/9f/7c/89/e33159959737f7faf9b3030530f4ea76e60a8c76a59a7e1788
Successfully built reactopya
Installing collected packages: reactopya
  Found existing installation: reactopya 0.2.5
    Uninstalling reactopya-0.2.5:
      Successfully uninstalled reactopya-0.2.5
Successfully installed reactopya-0.2.8



(reactopya) Bens-MacBook-Pro-2:ephys-viz bendichter$ reactopya install-jupyter-extension
Reactopya: Generating code...
Removing directory: generated/ephys_viz_jup/__pycache__
Traceback (most recent call last):
  File "/anaconda3/envs/reactopya/bin/reactopya", line 259, in <module>
    main()
  File "/anaconda3/envs/reactopya/bin/reactopya", line 35, in main
    commands[command](config, args=args)
  File "/anaconda3/envs/reactopya/bin/reactopya", line 116, in _install_jupyter_extension
    _generate(config=config, args=args)
  File "/anaconda3/envs/reactopya/bin/reactopya", line 143, in _generate
    reactopya_templates_directory(), 'generated', config=config)
  File "/anaconda3/envs/reactopya/bin/reactopya", line 225, in _generate_directory
    do_render=do_render
  File "/anaconda3/envs/reactopya/bin/reactopya", line 214, in _generate_directory
    txt2 = Template(txt).render(config)
  File "/anaconda3/envs/reactopya/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/anaconda3/envs/reactopya/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/anaconda3/envs/reactopya/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/anaconda3/envs/reactopya/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 13, in top-level template code
  File "/anaconda3/envs/reactopya/lib/python3.7/site-packages/jinja2/environment.py", line 430, in getattr
    return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'setup_py' is undefined

probe channel mapping and traces are upside down

It would be nice to see the bottom of the probe being mapped to the bottom of the screen. Currently, this display order is flipped. As the y-coordinate value increases, it should be displayed at a higher position on the monitor.

'vtkOpenGLKitPython' Module Not Found Error

I can't seem to install/import ephys-viz. I'm getting a No module named 'vtkOpenGLKitPython' error. I installed following the installation instructions and attempted the VTK import error and solution #6 from issues.

Any suggestions?

image
image
image

jupyter lab install error

$ jupyter labextension install ephyz_viz_jup
An error occured.
ValueError: "ephyz_viz_jup" is not a valid npm package
See the log file for details:  /var/folders/cg/mhhypnc14wn9kz5ydllymyc00000gp/T/jupyterlab-debug-tl0n8trb.log
$ cat /var/folders/cg/mhhypnc14wn9kz5ydllymyc00000gp/T/jupyterlab-debug-tl0n8trb.log
Node v12.7.0

> /usr/local/bin/npm pack ephyz_viz_jup
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/ephyz_viz_jup - Not found
npm ERR! 404 
npm ERR! 404  'ephyz_viz_jup@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/bendichter/.npm/_logs/2019-08-25T22_03_14_425Z-debug.log

Traceback (most recent call last):

  File "/anaconda3/envs/pynwb/lib/python3.7/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

  File "/anaconda3/envs/pynwb/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 82, in start
    ans = self.run_task()

  File "/anaconda3/envs/pynwb/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 103, in run_task
    for arg in self.extra_args

  File "/anaconda3/envs/pynwb/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 103, in <listcomp>
    for arg in self.extra_args

  File "/anaconda3/envs/pynwb/lib/python3.7/site-packages/jupyterlab/commands.py", line 316, in install_extension
    return handler.install_extension(extension)

  File "/anaconda3/envs/pynwb/lib/python3.7/site-packages/jupyterlab/commands.py", line 517, in install_extension
    info = self._install_extension(extension, tempdir)

  File "/anaconda3/envs/pynwb/lib/python3.7/site-packages/jupyterlab/commands.py", line 1373, in _install_extension
    info = self._extract_package(extension, tempdir)

  File "/anaconda3/envs/pynwb/lib/python3.7/site-packages/jupyterlab/commands.py", line 1444, in _extract_package
    raise ValueError(msg % source)

ValueError: "ephyz_viz_jup" is not a valid npm package

Exiting application: jupyter

LFP plot bugs

  • When you increase/decrease the amplitude the wave order changes

place fields

@magland The new widget looks awesome!

A few minor usability points about the widget:

  • Could you include a spatial scale? How big is the maze?
  • The checkboxes imply that you can select multiple. Could you either make them a dropdown instead to imply single selection or actually allow multiple selection and have them show up as different colors?
  • It looks like this is sped up, not played in real time. Could you indicate the time axis as well? How much is it sped up?
  • Could you allow for selecting different epochs?

Autocorrelograms labels

It would be great of the Autocorrelograms widget included:

  • A title for each plot indicating which unit it is
  • Axis labels on one of the subplots I would suggest "time (ms)" or "lag (ms)" for the x axis on the bottom left subplot, and "correlation" on the y-axis also on the bottom left, but the precise label and placement don't matter much.

request: trialized visualizations

It would be great to see these visualizations trial-aligned. The code to access trials is here. These methods were never merged, but the internals should work if you implement these functions yourself.

spike raster bugs

  • the raster should start at the first spike time, not at 0
  • the raster should not load all spikes in the beginning, but dynamically load them as requested
  • it looks like there is a slight misalignment of the spikes which is causing unit 0 to be rendered above the upper axis spine

example returning an error

Error running the ephys_viz_example in the notebook_examples directory.

The error comes from the second cell in the notebook. environment and exception details below (click to expand).

Docker Environment
FROM jupyter/datascience-notebook:7a0c7325e470
FROM jupyter/minimal-notebook:7a0c7325e470

RUN pip install ephys_viz
RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager
RUN pip install reactopya_jup==0.9.1
RUN jupyter labextension install [email protected]
RUN jupyter nbextension install --sys-prefix --py reactopya_jup
RUN jupyter nbextension enable reactopya_jup --py --sys-prefix

WORKDIR $HOME
RUN git clone --depth 1 https://github.com/flatironinstitute/ephys-viz.git
Notebook error
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-4-9ef080a15349> in <module>
      3 recording, sorting = se.example_datasets.toy_example(num_channels=12, K=12)
      4 ev.TimeseriesView(
----> 5     recording=recording
      6 ).show()

/opt/conda/lib/python3.7/site-packages/ephys_viz/BaseWidget.py in show(self, **kwargs)
    189                 for child_id in self._child_ids
    190             ],
--> 191             props=self._props
    192         )
    193         if init_info['mode'] == 'colab':

/opt/conda/lib/python3.7/site-packages/reactopya_jup/reactopyajupyterwidget.py in __init__(self, project_name, type, initial_children, props, key)
     43         self.set_trait('_project_name', project_name)
     44         self.set_trait('_type', type)
---> 45         self.set_trait('_props', _json_serialize(props))
     46         self.set_trait('_initial_children', _json_serialize(initial_children))
     47         self.set_trait('_key', key)

/opt/conda/lib/python3.7/site-packages/traitlets/traitlets.py in set_trait(self, name, value)
   1341                                 (cls.__name__, name))
   1342         else:
-> 1343             getattr(cls, name).set(self, value)
   1344 
   1345     @classmethod

/opt/conda/lib/python3.7/site-packages/traitlets/traitlets.py in set(self, obj, value)
    572             # we explicitly compare silent to True just in case the equality
    573             # comparison above returns something other than True/False
--> 574             obj._notify_trait(self.name, old_value, new_value)
    575 
    576     def __set__(self, obj, value):

/opt/conda/lib/python3.7/site-packages/traitlets/traitlets.py in _notify_trait(self, name, old_value, new_value)
   1137             new=new_value,
   1138             owner=self,
-> 1139             type='change',
   1140         ))
   1141 

/opt/conda/lib/python3.7/site-packages/ipywidgets/widgets/widget.py in notify_change(self, change)
    603             if name in self.keys and self._should_send_property(name, getattr(self, name)):
    604                 # Send new state to front-end
--> 605                 self.send_state(key=name)
    606         super(Widget, self).notify_change(change)
    607 

/opt/conda/lib/python3.7/site-packages/ipywidgets/widgets/widget.py in send_state(self, key)
    487             state, buffer_paths, buffers = _remove_buffers(state)
    488             msg = {'method': 'update', 'state': state, 'buffer_paths': buffer_paths}
--> 489             self._send(msg, buffers=buffers)
    490 
    491 

/opt/conda/lib/python3.7/site-packages/ipywidgets/widgets/widget.py in _send(self, msg, buffers)
    735         """Sends a message to the model in the front-end."""
    736         if self.comm is not None and self.comm.kernel is not None:
--> 737             self.comm.send(data=msg, buffers=buffers)
    738 
    739     def _repr_keys(self):

/opt/conda/lib/python3.7/site-packages/ipykernel/comm/comm.py in send(self, data, metadata, buffers)
    121         """Send a message to the frontend-side version of this comm"""
    122         self._publish_msg('comm_msg',
--> 123             data=data, metadata=metadata, buffers=buffers,
    124         )
    125 

/opt/conda/lib/python3.7/site-packages/ipykernel/comm/comm.py in _publish_msg(self, msg_type, data, metadata, buffers, **keys)
     63         data = {} if data is None else data
     64         metadata = {} if metadata is None else metadata
---> 65         content = json_clean(dict(data=data, comm_id=self.comm_id, **keys))
     66         self.kernel.session.send(self.kernel.iopub_socket, msg_type,
     67             content,

/opt/conda/lib/python3.7/site-packages/ipykernel/jsonutil.py in json_clean(obj)
    189         out = {}
    190         for k,v in iteritems(obj):
--> 191             out[unicode_type(k)] = json_clean(v)
    192         return out
    193     if isinstance(obj, datetime):

/opt/conda/lib/python3.7/site-packages/ipykernel/jsonutil.py in json_clean(obj)
    189         out = {}
    190         for k,v in iteritems(obj):
--> 191             out[unicode_type(k)] = json_clean(v)
    192         return out
    193     if isinstance(obj, datetime):

/opt/conda/lib/python3.7/site-packages/ipykernel/jsonutil.py in json_clean(obj)
    189         out = {}
    190         for k,v in iteritems(obj):
--> 191             out[unicode_type(k)] = json_clean(v)
    192         return out
    193     if isinstance(obj, datetime):

/opt/conda/lib/python3.7/site-packages/ipykernel/jsonutil.py in json_clean(obj)
    189         out = {}
    190         for k,v in iteritems(obj):
--> 191             out[unicode_type(k)] = json_clean(v)
    192         return out
    193     if isinstance(obj, datetime):

/opt/conda/lib/python3.7/site-packages/ipykernel/jsonutil.py in json_clean(obj)
    195 
    196     # we don't understand it, it's probably an unserializable object
--> 197     raise ValueError("Can't clean for JSON: %r" % obj)

ValueError: Can't clean for JSON: <spikeextractors.extractors.numpyextractors.numpyextractors.NumpyRecordingExtractor object at 0x7f8d0fcf4240>

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.