Giter Site home page Giter Site logo

thorns's Introduction

thorns and waves

__|________|_____|_|_|___|_____|____||_____|_____|_____|____|_____|___||______
_|_______________________|______|_________|_______|_____|____|__|________|_|__
_____|___|__|_____|_______|____|_________________________|__|_________|_______
___|_______|_____|______|_____|_______|__|___|________|______|___|____________
__|__|_______|_____|__|___|______|________|______|______|_____|_______THORNS__

With thorns you can analyze and display spike trains generated by neurons. It can be useful for the analysis of experimental and simulation data using Python. For example, you can easily calculate peristimulus time histogram (PSTH), interspike time histogram (ISIH), vector strength (VS), entrainment and visualize action potentials with raster plot.

waves is a submodule with some useful signal processing and generation functions, e.g. generate ramped tone, amplitude modulation tone, FFT filter, set level (dB_SPL).

The software was originally developed during my PhD in the group of Werner Hemmert at the TUM. It is oriented towards auditory research, but it could be easily extended.

Usage

Don't forget to check our IPython Notebook DEMO and scripts in the examples directory!

Initialize and load spike trains:

import thorns as th
from thorns.datasets import load_anf_zilany2014

spike_trains = load_anf_zilany2014()

Calculate vector strength:

th.vector_strength(spike_trains, freq=1000)

Raster plot:

th.plot_raster(spike_trains)
th.show()

Generate and plot AM tone:

import thorns.waves as wv

sound = wv.amplitude_modulated_tone(
    fs=48e3,
    fm=100,
    fc=1e3,
    m=0.7,
    duration=0.1,
)

wv.plot_signal(sound, fs=48e3)

wv.show()

You can also browse the API documentation at https://pythonhosted.org/thorns/

Features

  • Analyzes and displays spike trains
  • Uses pandas.DataFrame as the main data container (spike trains, results)
  • Handy signal processing and generating functions: thorns.waves
  • Map implementation with various backend (also parallel) and caching: thorns.util.map()
  • Dumpdb: quickly dump map()'s results in one script and load from another one: thorns.util.dumpdb(), thorns.util.loaddb()
  • Pure Python

Installation

In order to use thorns, you'll need to install the following dependencies first:

  • Python (2.7)
  • Numpy
  • Scipy
  • Pandas
  • PyTables / tables
  • Matplotlib
  • py-notify (optional, enables notifications)

Next, type in your command line:

pip install thorns

Contribute

License

The project is licensed under the GNU General Public License v3 or later (GPLv3+).

thorns's People

Contributors

huitzilo avatar jencke avatar strahl avatar timtammittee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

thorns's Issues

Unclosed files/zombie processes

With python 3.5, using thorns.util.map for multiprocessing generates unclosed files and zombie processes (OSError: [Errno 24] Too many open files).

import thorns as th

def dummy(name):
        print(name)

backend = "multiprocessing"

for i in range(1,100):
        test = th.util.map(func = dummy,
                        space = {"name":"Dummy"},
                        backend = backend,
                        cache = "no",
                        kwargs = {})
        print("Iteration: {}".format(i))

inserting pool.close() into maps._multiprocessing_map() after pooling is done fixes it.

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.