GithubHelp home page GithubHelp logo

tne-lab / crossing-detector Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 14.0 821 KB

Plugin to detect when signals rise or fall across thresholds, for the Open Ephys GUI.

License: GNU General Public License v3.0

C++ 94.15% Makefile 0.54% MATLAB 2.67% CMake 2.64%

crossing-detector's Introduction

Crossing Detector Plugin DOI

This plugin for the Open Ephys GUI fires a TTL event when a specified input data channel crosses a specified threshold level; the criteria for detection and the output are highly customizable. It does not modify the data channels. Each instance only processes one data channel, but multiple instances can be chained together or placed in parallel.

Cite this code using the DOI above!

Settings:

Main panel

  • Basic operation: When the In data channel Rises and/or Falls across the Threshold level, an event turns on on the Out event channel.

  • Timeout controls the minimum time between two consecutive events (i.e. for this number of milliseconds after an event fires, no more crossings can be detected).

Additional settings (in visualizer window)

  • Threshold type:

    • Constant is the default.

    • "Optimize correlated indicator from event channel" (adaptive): This allows you to use a simple optimization algorithm to automatically adjust the threshold. Given a binary event channel, it assumes that the values of events from this channel are correlated with the threshold, and adjusts the threshold according to the learning rate to try to move the event values closer to the specified target. See the tooltips on each setting for more information.

    • Random (chooses a new threshold for each event, uniformly at random within the provided range)

    • Continuous channel (compared with the input channel sample-by-sample to identify crossings)

  • Event criteria:

    • Cross-threshold jump size limit (does not fire an event if the difference across threshold is too large in magnitude; useful for filtering out wrapped phase jumps, for example)

    • Sample voting (make detection more robust to noise by requiring a larger span of samples before or after t0 to be on the correct side)

  • Event duration (in ms)

Installation using CMake

This plugin can now be built outside of the main GUI file tree using CMake. In order to do so, it must be in a sibling directory to plugin-GUI* and the main GUI must have already been compiled.

You should use this branch if you are already using CMake to build the main GUI (in development as of writing). Otherwise, use the master branch.

See CrossingDetector/CMAKE_README.txt and/or the wiki page here for build instructions.

* If you have the GUI built somewhere else, you can specify its location by setting the environment variable GUI_BASE_DIR or defining it when calling cmake with the option -DGUI_BASE_DIR=<location>.

Currently maintained by Mark Schatza ([email protected])

crossing-detector's People

Contributors

cjthomas-opensource avatar ethanbb avatar fjkdasilva avatar markschatza avatar sumedhnagrale avatar toritavo avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

crossing-detector's Issues

Reading output in matlab?

HI
can you give us a link to some matlab (even python) code that reads the broadcasted events?
I am stuck between jeromq, tcp ip sockets etc...
thx if you can

Fails to compile: EventChannel and MetaDataDescriptorArray not defined, etc

Trying to compile the plugin gives the following errors:

In file included from CrossingDetectorEditor.cpp:24:0:
CrossingDetector.h: At global scope:
CrossingDetector.h:137:5: error: ‘EventChannel’ does not name a type; did you mean ‘pEventChan’?
     EventChannel* eventChannelPtr;
     ^~~~~~~~~~~~
     pEventChan
CrossingDetector.h:138:5: error: ‘MetaDataDescriptorArray’ does not name a type
     MetaDataDescriptorArray eventMetaDataDescriptors;
     ^~~~~~~~~~~~~~~~~~~~~~~
CrossingDetector.h:75:10: error: ‘void CrossingDetector::createEventChannels()’ marked ‘override’, but does not override
     void createEventChannels() override;
          ^~~~~~~~~~~~~~~~~~~
CrossingDetector.h:77:10: error: ‘void CrossingDetector::process(juce::AudioSampleBuffer&)’ marked ‘override’, but does not override
     void process(AudioSampleBuffer& continuousBuffer) override;

This is with plugin-GUI commit 7289059d (v0.4.2), on linux. Grep agrees that EventChannel, MetaDataDescriptorArray and createEventChannels don't appear anywhere else in the plugin-GUI source.

Thanks for contributing this plugin, it looks very useful and I'm excited to try it out!

Planning to extend the plugin

As a heads-up, I'm planning to add at least two things to this plugin; I'll submit a pull request when I have a local version tested and working.

Planned changes:

  • Adding a "N standard deviations" threshold option.
  • Augmenting the input channel selector to include the names of channels in addition to their number (and the stream number, since the mag-plus-phase detector makes a new stream).

There's a lot more than I'd like to polish, but I'm under significant time constraints, so for now it'll just be the changes above. Let me know if there's anything specific that you want me to take into account when doing this.

TTL out?

Hello
this may sound like a stupid question but how do we now it works?
when open-ephys receives TTLS, it displays a colored band on the LFP display. I am asking this for two reasons:
-I am using the rhd2000 from intan and I have access to 16 digial out and 8 analog out channels. so when you show 8 TTL channels I get confused to which channel we are talking about. I just downloaded the plugin from the last version of open-ephys.
my goal is to send a TTL pulse to initiate a matlab driven sequence of behavioral events.
-what are the units for the threshold detection ? Volts seem rather big since most of us have a max of 1mV range of data
Thank you for your help and this nice plugin
Pepe

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.