Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_begin_indices seems to be disturbed by spontaneous firing #346

Closed
SzaBoglarka opened this issue Jan 5, 2024 · 4 comments
Closed

AP_begin_indices seems to be disturbed by spontaneous firing #346

SzaBoglarka opened this issue Jan 5, 2024 · 4 comments
Assignees

Comments

@SzaBoglarka
Copy link

SzaBoglarka commented Jan 5, 2024

Hi,
We are having problems with the feature extraction of the trace below.
It seems to me that AP_begin_indices are not detected before the start of the stimulus, but AP_end_indices are.
This issue results in an unequal number of AP_begin_indices (red) and AP_end_indices (dark blue) and causes several problems with other features.
The most concerning results are the negative feature values for AP_duration and AP_rise_time.

AP_begin_indices_issue

Data:
time.csv
voltage.csv

Script:

import numpy
import pandas as pd 
import matplotlib.pyplot as plt
import efel


# print the efel version
print("\n","Efel version:",efel.__version__, "\n")

# load the time and voltage data
time_csv = pd.read_csv("time.csv", header=None, index_col=False)
time_data = time_csv[0].tolist()
voltage_csv = pd.read_csv("voltage.csv", header=None, index_col=False)
voltage_data = voltage_csv[0].tolist()

# create the trace
trace = {}
trace["T"] = time_data
trace["V"] = voltage_data
trace["stim_start"] = [200]
trace["stim_end"] = [200 + 200]
traces = [trace]

# extract the features from the trace
traces_results = efel.getFeatureValues(traces, ["AP_begin_indices", "AP_end_indices", "AP_duration", "AP_rise_time"])

# print the extracted features
print("AP_begin_indices\n:", traces_results[0]['AP_begin_indices'])
print("number of AP_begin_indices:",len(traces_results[0]['AP_begin_indices']), "\n")
print("AP_end_indices\n", traces_results[0]['AP_end_indices'])
print("number of AP_end_indices:",len(traces_results[0]['AP_end_indices']), "\n")
print("AP_durations:\n", traces_results[0]['AP_duration'])
print("number of AP_durations:",len(traces_results[0]['AP_duration']), "\n")
print("AP_rise_time\n", traces_results[0]['AP_rise_time'])
print("number of AP_rise_time:",len(traces_results[0]['AP_rise_time']), "\n")

# plot the data
plt.figure()
plt.plot(time_data,voltage_data)

# mark the AP begin (red) and end (dark blue) indices on the figure
h_dt = 0.025
x = traces_results[0]['AP_begin_indices']/10
votage_indices = [int(i/h_dt) for i in x]       # rescaling with h.dt=0.025
y = [voltage_data[j] for j in votage_indices]
plt.plot(x, y, 'o', color='red', markersize=4)

x = traces_results[0]['AP_end_indices']/10
votage_indices = [int(i/h_dt) for i in x]
y = [voltage_data[j] for j in votage_indices]
plt.plot(x, y, 'o', color='darkblue', markersize=4)

plt.show()
@anilbey
Copy link
Contributor

anilbey commented Jan 8, 2024

Thanks @SzaBoglarka for reporting this important issue. We will address it and inform you.

@AurelienJaquier
Copy link
Collaborator

Hi @SzaBoglarka ! I am currently fixing this Issue. Is that alright if I use your trace data to add a test in eFel in order to avoid this kind of issue in the future?

@SzaBoglarka
Copy link
Author

Hi @AurelienJaquier! Of course, it's alright.
By the way, the trace was generated with a public cell model available here: https://modeldb.science/114047.

@AurelienJaquier
Copy link
Collaborator

Thank you very much!
I solved this issue with PR #353 . You can update your efel version. Do not hesitate to contact us if the issue persists or if you encounter another one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants