Skip to main content

Tools for processing and analyzing neurophysiological signals recorded in-vivo.

Project description

ivneuro

Tools for processing and analyzing neurophysiological signals recorded in-vivo.

ivneuro provides tools for analyzing neural signals recorded in-vivo during behavior. It focus on time series analyses of continuous variables such as Local Field Potentials and is optimized to process either single signals in a single condition as well as multiple signals in multiple conditions simultaneously. It also provides a subpackage for extracting data from Nex files.


Installation

To install use:

pip install ivneuro

Documentation

Documentation can be found here.

Contributing

All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are strongly appreciated. To contribute, please review the guidelines at the CONTRIBUTING section.

Quick examples

Peri-event histograms

>>> import ivneuro as ivn
>>> import pandas as pd

>>> # Create events
>>> burst = [*range(30,300, 30)]
>>> control = [*range(45,300, 30)]
>>> events={'burst':burst,'control':control}

>>> # Generate signals
>>> signal1 = ivn.generate_signal(300, burst, 2, burst_duration = 0.5, burst_amplitude=1)
>>> signal2 = ivn.generate_signal(300, burst, 0.5, burst_duration = 2, burst_amplitude=1.5, seed = 21)
>>> signal = pd.concat([signal1, signal2], axis = 1)


>>> # Make peri-event histogram
>>> hist=ivn.peh(signal, events, lower_lim = -5, higher_lim = 5)

>>> hist.plot()

image


Peri-event spectograms

>>> import ivneuro as ivn
>>> import pandas as pd

>>> # Create events
>>> burst = [*range(30,300, 30)]
>>> control = [*range(45,300, 30)]
>>> events={'burst':burst,'control':control}

>>> # Generate signals
>>> signal1 = ivn.generate_signal(300, burst, 30, burst_amplitude=0.06)
>>> signal2 = ivn.generate_signal(300, burst, 32, burst_amplitude=0.13)
>>> signal3 = ivn.generate_signal(300, burst, 80, burst_amplitude=0.05)
>>> signals = pd.concat([signal1, signal2, signal3], axis = 1)

>>> # Calculate peri-event spectogram
>>> pes = ivn.peri_event_spectogram(signals, events, -10, 10, higher_freq=100)
>>> pes.normalize().plot()

image


Difference in power spectral between an experimental condition and its baseline, for 2 signals

>>> import ivneuro as ivn
>>> import pandas as pd

>>> # Create event
>>> burst = [*range(30,300, 30)]

>>> # Make intervals
>>> burst_intervals = ivn.make_intervals(burst, 0, 2)
>>> baseline_intervals = ivn.make_intervals(burst, -6, -4)

>>> # Generate signals
>>> signal1 = ivn.generate_signal(300, burst, 30, burst_amplitude=0.06, seed=15)
>>> signal2 = ivn.generate_signal(300, burst, 80, burst_amplitude=0.05, seed = 50)
>>> signals = pd.concat([signal1, signal2], axis = 1)


>>> # Calculate change in power spectral
>>> power_burst, power_baseline, delta_power = ivn.delta_power_spectral(signals, burst_intervals, baseline_intervals, lowest_freq = 0, highest_freq = 100)
>>> delta_power.plot(xlabel = 'Frequency (Hz)', ylabel = 'Normalized power difference', title = 'Normalized difference in power spectral (burst - baseline)')

image


Positions in which an event occurs

>>> import numpy as np
>>> import ivneuro as ivn

>>> # Create coordinates and timestamps for an oval trajectory
>>> x = 10 * np.cos(np.linspace(0, 2*np.pi, 100)) + 10
>>> y = 20 * np.sin(np.linspace(0, 2*np.pi, 100)) + 20 
>>> timestamps = np.linspace(0,20,100).round(1)

>>> # Create event
>>> np.random.seed(24)
>>> event = np.random.choice(timestamps[(timestamps>10) & (timestamps<15)], size=5, replace = False)

>>> # Make EventPosition object and plot
>>> pos = ivn.EventPosition(x, y, timestamps, event)
>>> pos.plot()

image


License

The codes are released under MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ivneuro-0.1.3.tar.gz (42.0 kB view hashes)

Uploaded Source

Built Distribution

ivneuro-0.1.3-py3-none-any.whl (46.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page