neuropsychology / neurokit.py Goto Github PK
View Code? Open in Web Editor NEWA Python Toolbox for Statistics and Neurophysiological Signal Processing (EEG, EDA, ECG, EMG...).
Home Page: http://neurokit.rtfd.io
License: MIT License
A Python Toolbox for Statistics and Neurophysiological Signal Processing (EEG, EDA, ECG, EMG...).
Home Page: http://neurokit.rtfd.io
License: MIT License
This would be useful for being able to characterize periods of systole (R-T interval) and diastole. More and more papers (example) suggest that the cardiac phase has an impact on the processing of a stimulus.
We could then add a column within the processed dataframe corresponding to an array of zeros and ones, called for example 'Systole' that would indicate the cardiac phase.
Found some matlab code for the localization of QRS waves that, maybe, could be adapted?
@rhenanbartels do you think that detecting the t wave is complicated?
Hi,
Regarding HRV, I’m using the polar H10 chest strap which works in general very well but I have faced a weird behavior. For example, I have observed the following values:
Timestamp RR-interval
1508770156395 892
1508770157370 905
1508770157370 863
1508770158345 846
The first column is the timestamp in milliseconds (in UNIX time). The second column is the corresponding RR-interval
The polar device sends me one package around every second (with a RR-interval value). As you can see in one package there are two RR values. This happens from time to time. According to the bluetooth protocol this is valid, but it is a bit strange to me. I think the RR interval should approximate real time. 1508770158345– 1508770156395 = 1950ms = 1.950s but when I sum up the RR intervals I’m getting 892 + 905 + 863 + 846 = 3506ms = 3.506s.
I don’t know how to approach this. The ecg_hrv function from neurokit, that computes HRV features, needs R peaks location as input. The step, in theory, before RRi computation. So we have to somehow transform your RRi data back into R peaks location. We can do it by computing the cumulative sum. But this assumes that the rr intervals sums up to real time which seems not to be the case in the above example.
I am giving the data in form of 1D numpy array which is basically i, ii, iii, v1, v2, v3, v4, v5, v6, avr, avl, avf features from PTB database. I call this function nk.bio_process(ecg=ecg_signal[:,i],ecg_quality_model=None). It operates good on several columns but gives error after 2 iterations. Moreover, I have checked data is fine enough in all columns. can anyone please resolve the issue
Recent versions are not being published on PyPI anymore (see https://pypi.org/project/neurokit/#history, most recent there is 0.2.0 which was added Sept 5th 2017), and new versions are not tagged here on GitHub either (see https://github.com/neuropsychology/NeuroKit.py/releases).
Based on current master
, it seems like the latest version is 0.2.7 which corresponds to commit bba8ed9 (since that's where the version bump was done). But that doesn't include the bug fix from 8f166ad which was done shortly after...
Can you please i) tag releases on GitHub, ii) push releases to PyPI?
Letting people install straight from master
without proper versioning results in a lot of confusion, which is easy to avoid by tagging releases.
Hello
I have a 7 minute nature video recording at the beginning of my experiment which I would like to use as baseline for my EDA and RR signal. Currently I'm just using the whole 7 minutes or the last 3 minutes which can be a bad choice because it is possible that a participant relaxes at the beginning but after some minutes starts getting annoyed of the video. I thought about searching the minimum EDA or RR/HR signal of the video baseline and then using for example a 10s window around this minimum as baseline.
Do you know other common possibilities? I did not find very much useful information about baseline correction for this special case.
in order to have bio_eda compatible, in cvxEDA need to change:
frequency = 1/sampling_rate
to
frequency = 1./sampling_rate
I used pip to install neurokit-0.2.7 followed by the installation guide on windows 10 x64 and python 3.7.0. The installation was successful but I encountered this error when importing the library as "import neurokit as nk".
I'm a newbie so I really appreciate every help to fix this.
Exception has occurred: ImportError
DLL load failed: The specified module could not be found.
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap_external>", line 728, in exec_module
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 983, in _find_and_load
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap_external>", line 728, in exec_module
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 983, in _find_and_load
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap_external>", line 728, in exec_module
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 983, in _find_and_load
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap_external>", line 728, in exec_module
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "C:\users\vinhd\desktop\py<frozen importlib._bootstrap>", line 983, in _find_and_load
File "C:\Users\vinhd\Desktop\py\hello.py", line 5, in
import neurokit as nk
gsr_slice.p.zip
Hi,
I'm trying to extract Skin Conductance Responses from a EDA Signal, but I'm getting errors.
Here is some example code and the errors and I'm attaching the file.
import pickle
import neurokit as nk
gsr_slice = pickle.load(open("gsr_slice.p", "rb"))
nk.eda_scr(gsr_slice, 512, method="fast")
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-101-9f5b83c41189> in <module>()
----> 1 nk.eda_scr(gsr_slice, 512, method="fast")
~/anaconda/envs/kohaf/lib/python3.5/site-packages/neurokit/bio/bio_eda.py in eda_scr(signal, sampling_rate, treshold, method)
408 # ====================
409 # Compute rising times
--> 410 risingtimes = peaks-onsets
411 risingtimes = risingtimes/sampling_rate*1000
412
ValueError: operands could not be broadcast together with shapes (1319,) (1309,)
nk.eda_scr(gsr_slice, 512, method="slow")
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-103-cf6859b8848d> in <module>()
----> 1 nk.eda_scr(gsr_slice, 512, method="slow")
~/anaconda/envs/kohaf/lib/python3.5/site-packages/neurokit/bio/bio_eda.py in eda_scr(signal, sampling_rate, treshold, method)
402
403 # Keep only pairs
--> 404 peaks = peaks[peaks > onsets[0]]
405 onsets = onsets[onsets < peaks[-1]]
406
TypeError: only integer scalar arrays can be converted to a scalar index
Instead of this which imposes an Hamilton segmenter, I would suggest to implement the part present in ecg_preprocess
doing the same job in the ecg_find_peaks
method and call it from the ecg_preprocess
method. This would enable the use of other segmenters in ecg_find_peaks
(and be, in my opinion, cleaner implementation 😄 ).
If you agree on that, I can implement it.
Hi--Thanks for developing this repo. I wanted to compare my own dprime/aprime calculations with ones from other repos and found the following:
Should be an easy fix. Thanks!
Hello, I have a problem when trying to analyse EDA. Here is the stacktrace:
File "C:\Users\jaros1024\PycharmProjects\Project1\lib\new_gsr.py", line 13, in __init__ self.data = nk.eda_scr(y, sampling_rate=freq) File "C:\Users\jaros1024\PycharmProjects\Project1\venv3\lib\site-packages\neurokit\bio\bio_eda.py", line 399, in eda_scr peaks, _ = biosppy.tools.find_extrema(signal=signal, mode='max') File "C:\Users\jaros1024\PycharmProjects\Project1\venv3\lib\site-packages\biosppy\signals\tools.py", line 1108, in find_extrema values = signal[extrema] TypeError: only integer scalar arrays can be converted to a scalar index
I tried Python 3.6 and 3.7, both with numpy 1.14.6 and 1.15.2. Same effect for all. As far as I know, something was changed in recent numpy versions, so the syntax that you used is no longer supported.
Could you track it down and try to implement a workaround for this issue?
automated signal quality check
Hey
Do you know if the cvxEDA algorithm already removes linear trends? I think linear trends should not be a problem for phasic components but for tonic components.
Or else should we detrend the raw EDA data before running cvxEDA?
Hi Dominique!
First of all, thanks for answering my earlier question about P2T RSA - you have already been super helpful!!
I have another question now. I've been running my Acqknowledge file through Neurokit trying to extra ECG data, and it seems to be working really well except for the ECG_R_peaks column, which just outputted only nans. Everything else seems to be doing what it's supposed to do. Can you think of a thing I have left out?
Thank you so much!!
Ellie
Hi,
The EDA stuff works but unfortunately I’m getting only peaks for 50% of my stimulus (10s pictures), i.e. in 50% of these 10s windows (picture duration) there is no peak. I have to evaluate a bit more to see the reason behind it (it seems a bit strange to me). Do you have any idea why this happens?
I just wanted to try the features of your neurokit.
I´m using Anaconda installed on Windows 10.
The pip install of neurokit was successful.
Then I copied your following sample code into a Spyder window:
import neurokit as nk
import pandas as pd
import numpy as np
import seaborn as sns
df = pd.read_csv("https://raw.githubusercontent.com/neuropsychology/NeuroKit.py/master/examples/Bio/bio_100Hz.csv")
df.plot()
bio = nk.bio_process(ecg=df["ECG"], rsp=df["RSP"], eda=df["EDA"], add=df["Photosensor"], sampling_rate=100)
nk.z_score(bio["df"]).plot()
pd.DataFrame(bio["ECG"]["Cardiac_Cycles"]).plot(legend=False)
The first part imcuding the first plot runs well until nk.bio_process where I get this error message:
bio = nk.bio_process(ecg=df["ECG"], rsp=df["RSP"], eda=df["EDA"], add=df["Photosensor"], sampling_rate=100)
AttributeError: module 'neurokit' has no attribute 'bio_process'
What went wrong ?
Hi there,
I'm using EDA and HRV features. I'm extracting these features for each stimulus by positioning a window at the start of the stimulus (I think including data before the stimulus does not make sense).
What window size is recommended for EDA and HRV? I've heard that for EDA the response should appear within 5 seconds.
When trying to extract regular HRV indices, I am getting this error message:
NameError Traceback (most recent call last)
in ()
----> 1 print(hrv.keys()) #
NameError: name 'hrv' is not defined
I'm using your Neurokit toolbox for SCR detection. Would it be possible to have the pseudocode or a detailed description of the 'makowski' method that you use for SCR detection in nk.eda_scr? and which method is used when method='fast', as in Gamboa, Kim or Makowski?
Hi
Before applying the cvxEDA algorithm you are filtering the signal. According to the cvxEDA paper this is not necessary: "As a result, the method does not require pre-processing of the observed SC signal (e.g., bandpass filtering) nor post-processing of the inferred phasic and tonic components (e.g., to deal with negative neural activations)."
Hi, I'm using the processed_eda function to extract feature from the raw eda in my research. However, I found that there were some NaNs in the "processed_eda['EDA']['SCR_Recovery_Indexes']". Why these NaNs appear? And how should I deal with these NaNs to get the final feature such as mean of recovery times in your suggestion?
Hi Dominique!
So I ran NeuroKit on some ECG data that I've collected, and I have vastly different orders of magnitude across participants for the output relating to power in the different frequency bands. For most of my subjects, the numbers are in the tens of thousands; for others, it's in the hundreds. I have the same sampling rate for all my subjects. This doesn't affect the average heart rate (which looks biological - between 60 and 90 bpm) or the RSA.
Do you have any idea what I might be doing wrong?
Thank you so much for your help!
Ellie
Increase and enhance testing.
Hello,I have some question,and need your help
I wanted to use Neuropython but it's still failed
I ran the code,and it made error
error
module 'biosppy.signals.ecg' has no attribute 'correct_rpeaks'
I checked the file 'biosppy.signals.ecg', there has function'correct_rpeaks',and already has attribute
Is file "bio_ecg_preprocessing" wrong or file "biosppy.signals.ecg"?
code
import neurokit as nk
import pandas as pd
import numpy as np
import seaborn as snsdf = pd.read_csv("C:/Users/User/Desktop/CH1.csv")
df.plot()bio = nk.ecg_process(ecg=df["ECG1"], rsp=None, sampling_rate=250, filter_type='FIR', filter_band='bandpass', filter_frequency=[3, 45], segmenter='hamilton', quality_model='default', hrv_features=['time', 'frequency'], age=None, sex=None, position=None)
nk.z_score(bio["df"]).plot()
I tried to unistall neurokit ,and upgrade it
but it still wrong>> C:\Users\User\AppData\Local\Temp\pip-j3oj0gb4-build
What can i do?
This is a follow-on from issue #9.
When following the steps in the tutorial, I'm still stuck on the ecg process line (bio = nk.bio_process(ecg=df["ECG"], rsp=df["RSP"], eda=df["EDA"])
).
Full traceback:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/base.py:315: UserWarning: Trying to unpickle estimator LabelBinarizer from version 0.18.1 when using version 0.18.2. This might lead to breaking code or invalid results. Use at your own risk.
UserWarning)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/base.py:315: UserWarning: Trying to unpickle estimator MLPClassifier from version 0.18.1 when using version 0.18.2. This might lead to breaking code or invalid results. Use at your own risk.
UserWarning)
Traceback (most recent call last):
File "<ipython-input-8-be922da6b29f>", line 1, in <module>
bio = nk.bio_process(ecg=df["ECG"], rsp=df["RSP"], eda=df["EDA"])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/neurokit/bio/bio_meta.py", line 112, in bio_process
ecg = ecg_process(ecg=ecg, rsp=rsp, sampling_rate=sampling_rate, resampling_method=resampling_method, quality_model=ecg_quality_model, hrv_segment_length=hrv_segment_length, age=age, sex=sex, position=position)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/neurokit/bio/bio_ecg.py", line 208, in ecg_process
processed_ecg["ECG"]["HRV"] = ecg_hrv(rri, sampling_rate, segment_length=hrv_segment_length)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/neurokit/bio/bio_ecg.py", line 671, in ecg_hrv
hrv["Lyapunov"] = np.max(nolds.lyap_e(rri, emb_dim=58, matrix_dim=4))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nolds/measures.py", line 514, in lyap_e
mat_X -= data[i:i + emb_dim:m]
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/ops.py", line 727, in wrapper
dtype=dtype,
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/ops.py", line 635, in _construct_result
return left._constructor(result, index=index, name=name, dtype=dtype)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/series.py", line 248, in __init__
raise_cast_failure=True)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/series.py", line 3027, in _sanitize_array
raise Exception('Data must be 1-dimensional')
Exception: Data must be 1-dimensional
Hello there,
I try to analyze ECG and EDA data with your gr8 tool. Unfortunately I ran into a problem.
What I've done so far:
# Import packages
import neurokit as nk
import pandas as pd
import numpy as np
import biosppy as biosppy
# Plotting preferences
%matplotlib inline
import matplotlib
matplotlib.rcParams['figure.figsize'] = [14.0, 10.0] # Bigger figures
import seaborn as sns
sns.set_style("whitegrid") # White background
sns.set_palette(sns.color_palette("colorblind")) # Better colours
df = pd.read_csv("C:/Users/.../Data.csv", sep=';')
df=df.rename(columns = {'Input2':'EDA'})
df=df.rename(columns = {'Input3':'ECG'})
bio = nk.bio_process(ecg=df["ECG"], eda=df["EDA"])
bio = nk.bio_process(ecg=df["ECG"], eda=df["EDA"])
Traceback (most recent call last):
File "<ipython-input-40-84efa8150f06>", line 1, in <module>
bio = nk.bio_process(ecg=df["ECG"], eda=df["EDA"])
File "C:\Users\...\Desktop\neuropython\WinPython-64bit-3.5.3.1Zero\python-3.5.3.amd64\lib\site-packages\neurokit\bio\bio_meta.py", line 95, in bio_process
eda = eda_process(eda=eda, sampling_rate=sampling_rate, use_cvxEDA=use_cvxEDA)
File "C:\Users\...\Desktop\neuropython\WinPython-64bit-3.5.3.1Zero\python-3.5.3.amd64\lib\site-packages\neurokit\bio\bio_eda.py", line 94, in eda_process
scr_onsets[biosppy_eda['onsets']] = 1
IndexError: arrays used as indices must be of integer (or boolean) type
...With all other input data, it worked fine. Only this data-set seems to make problems but I cannot figure out why. Would be nice if you could help me to resolve this.
Thanks in advance
There is an omission in the heart rate variability calculations in function ecg_hrv(...) that may potentially affect the results, especially for the spectral domain methods.
The calculation of HRV is based on the RR intervals (rri variable in the code). However, rri is indexed at every heartbeat, so it is not uniformly sampled. A common practice is to interpolate the original rri signal and then resample it uniformly. Every subsequent HRV computation should occur in the resampled interpolated rri signal, not the original one that was computed just by subtracting adjacent RRs. If this does not happen, and the HRV computations are based on the original rri, the spectrum will not be a function of frequency but instead it will be a function of cycles per heartbeat.
The following papers decribe this issue in detail:
http://www.apsipa.org/proceedings_2014/Data/paper/1366.pdf
Inside the ecg_hrv function, which is included in bio_ecg.py, in lines 563-565, there is an attempt to resample the raw rri values. However, what is done is only a scaling of RR values to a sampling rate of 1000Hz. It is not an actual inerpolation and resampling.
So to summarize, I think that the following proceedure should be followed for the HRV measures:
Aim:
Thanks a lot for the great work that was put into implementing this library. I have been reading the source code related to the respiration signal processing (the bio_rsp.py) but I could not fully understand how the algorithms were implemented. If possible, would you please provide a paper or any other reference this work was based on? Did you make any publication related to respiration signal?
Regards,
K
Aim:
Following lines in function ecg_hrv
:
beats_times = rpeaks[1:]
beats_times -= beats_times[0]
change values in rpeaks, which is a direct reference to the result returned by ecg_process
.
In short, the bug causes the ecg_process
to return incorrect r_peak indices.
One quick fix is to copy the sliced array:
beats_times = rpeaks[1:].copy()
Hi there
I have a quick question regarding baseline correction for HRV and EDA features. I'm extracting the following features (over a 10s window):
EDA: latency, rise time, number of peaks, mean and std of tonic and phasic
HRV: pnn20, rmssd, sdnn, sdss
I have also done a 5 minute baseline recording for each person at the beginning. I think there are several possibilities for baseline correction:
Dividing (or subtracting?) from each feature the minimum or mean value over the whole recording time (not the baseline).
Dividing (or subtracting?) from each feature the minimum or mean value over the whole baseline.
Dividing (or subtracting?) from each feature the minimum or mean value over e.g. the last 2 minutes of the baseline.
Dividing (or subtracting?) from each feature the minimum or mean value around a 30 seconds window where the heart rate or EDA was minimal in the baseline.
What would you propose, i.e. with which method did you have the best results?
Thanks a lot for the help!
It seems that in the code you refer to the method DataFrame.rolling()
inserted since pandas version >=0.18.0
. To avoid errors as :
AttributeError: 'DataFrame' object has no attribute 'rolling'
it would be good to insert the minimum pandas version in setup.py or requirements.txt
Trying to work through the BioSignals processing in Python tutorial, but didn't make it far because I hit the above error when trying to run:
bio = nk.bio_process(ecg=df["ECG"], rsp=df["RSP"], eda=df["EDA"])
The full Traceback from the IPython console is:
Traceback (most recent call last):
File "<ipython-input-280-be922da6b29f>", line 1, in <module>
bio = nk.bio_process(ecg=df["ECG"], rsp=df["RSP"], eda=df["EDA"])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/neurokit/bio/bio_meta.py", line 112, in bio_process
ecg = ecg_process(ecg=ecg, rsp=rsp, sampling_rate=sampling_rate, resampling_method=resampling_method, quality_model=ecg_quality_model, hrv_segment_length=hrv_segment_length, age=age, sex=sex, position=position)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/neurokit/bio/bio_ecg.py", line 208, in ecg_process
processed_ecg["ECG"]["HRV"] = ecg_hrv(rri, sampling_rate, segment_length=hrv_segment_length)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/neurokit/bio/bio_ecg.py", line 665, in ecg_hrv
hrv["Entropy_Multiscale"] = entropy_multiscale(rri, emb_dim=2)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/neurokit/signal/complexity.py", line 408, in entropy_multiscale
se = nolds.sampen(temp_ts, 1, tolerance, dist="euler", debug_plot=False, plot_file=None)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nolds/measures.py", line 653, in sampen
dsts = np.norm(diff, axis=1)
AttributeError: module 'numpy' has no attribute 'norm'
NeuroKit.py/neurokit/bio/bio_ecg.py
Line 580 in 30710db
If I understand correctly, this is an hard coded value of 1000Hz for "sampling_rate" variable. There seems to be many other instances of this elsewhere in the code.
aim:
This may very well be a silly question because I haven't looked through your thoroughly enough (or because I'm missing something painfully obvious), so please bear with me.
From what I have been able to figure out by quickly scanning your code, you're using biosppy's filtering routine to filter ECG data prior to HRV/etc extraction. The biosppy filter, in turn, is set to a default bandpass filter at [3, 45] Hz.
If I wanted to run NeuroKit's ECG routine (processed_ecg = nk.ecg_process(ecg_signal, resp_signal)
), but specify a different filter (say, just a high pass filter?), is there an easy way to do this? I figured that if all else fails I can edit ecg.py within biosppy…
Aim
Hi there,
I have read that around 5% of the people are non-responders for EDA. How can they be identified (and removed from the experiment)? I'm thinking about looking at the number of peaks (a person who has almost no peaks after a stimulus might be a non-responder).
Hello
In bio_ecg.ecg_hrv you interpolate the RR intervals to convert to continuous RR interval before extracting the frequency domain features. You are doing this using a third order (i.e. cubic) spline. I assume that the way you calculate the frequency features needs a continuous signal. Would it not also be possible to compute frequency features without interpolation?
However, why are you using this cubic interpolation instead of a linear interpolation? I think with a cubic interpolation the signal can be overestimated or underestimated, especially around the RR values.
Hello,
We are trying to work with some of the researchers from a hospital and there signal samples are at about 2.4 seconds, which is too short. I modified the "interpolate" function and changed k to 2 in signal.py It made the signal run, but still gives ecg_process(): Sequence too short to compute heart rate and therefore, setting heart_rate to np.nan
How could be modified for a short signal? Thank you!
Hi! Sorry to keep asking questions - I think once I get more familiar with the NeuroKit/BioSPPy environment, I'll be able to start figuring them out on my own more. But for now...
I'm trying to get the power in different frequency bands of HRV. In the ECG output, I see columns labeled ECG_HRV_HF, ECG_HRV_LF, etc., with a value for each index. I assume these correspond to high frequency, low frequency, etc., but I'm not sure how to extract the power in that specific frequency band, because I'm not sure what those values represent. Do I need to get the area under the function that is described by those values?
Thanks for everything, you have been so helpful!
"Finally, to assist in clinical classification, we extracted two simple features of MSE curves, the slopes for small and large time scales, i.e., the slopes of the curves defined by SE values between scale factors 1 and 5, and scale factors 6 and 20, respectively. Results for the healthy and congestive heart failure groups corresponding to the sleeping period are presented in Fig. 8. There is a good separation between the two groups. Considering other features of the MSE curves, in addition to these slopes, may further improve the separation. Alternatively, methods derived from pattern recognition techniques, e.g., Fisher’s discriminant, may also be useful for clinical discrimination" Costa (2005)
Maybe extract the best polynomial fit and get its coefs?
Looking for help to implement artifacts detection for EDA.
Some ressources:
Hi,
I have a series of RR-intervals (which I have retrieved from Polar H10 chest strap)
The ecg_hrv function from neurokit, that computes HRV features, needs R peaks location as input. The step, in theory, before RRi computation. So we have to somehow transform the RRi data back into R peaks location. We can do it by computing the cumulative sum rpeaks = list(np.cumsum(rri))
.
rri_results = nk.ecg_hrv(rpeaks, sampling_rate=1000, hrv_features=["time", "nonlinear"])
On this line you have used a sampling rate of 1000. What should I use here? Somehow the sampling rate depends on the heart rate (the higher the heart rate, the more RR intervals).
Hello,
I've a little question about neuroKit. If someone mixed up the (+) and (-) placement of the electrodes in ECG measurement, which means, you have a negative peaked heart beats (see picture below) instead of a positive peaked.
Now the question is: Does this affect the data analysis and is the output of your gr8 tool still valid in such a case?
Best Regards and Thanks
Aim:
Hi! Thanks for providing this toolkit.
I have a question about the way NeuroKit can score RSA (and I'm very new to Python as well as psychophysiology, so I apologize if the answer to this question is overly obvious). Because of the short interval over which I'm recording ECG (30 seconds per epoch), I'd like to use the peak-valley method to score RSA (as per Eckberg, 1983: http://jap.physiology.org/content/jap/54/4/961.full.pdf). Is there a way to do this in NeuroKit?
Many thanks!
Ellie
Hi
I'm trying to read my data from Acqknowledge file but it doesn't look right at all. It seems like it displays values for only one channel, where there are in fact three. Is there something I can do to get it load properly? I just find nothing works on the Acqknowledge data - even the plots look wrong, displaying the signal for a few of the recorded minutes. I'm completely new to this so apologies if this is an obvious question - just completely lost on what to do with it.
Thanks a lot
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.