[reproclasses/baseline] add function to get the raw membrane voltage
This commit is contained in:
parent
ade9b62c54
commit
1a1dabf955
@ -166,6 +166,30 @@ class BaselineData:
|
|||||||
def spikes(self, index: int=0):
|
def spikes(self, index: int=0):
|
||||||
return self.__spike_data[index] if len(self.__spike_data) >= index else None
|
return self.__spike_data[index] if len(self.__spike_data) >= index else None
|
||||||
|
|
||||||
|
def membrane_voltage(self, index: int=0):
|
||||||
|
if index >= self.size:
|
||||||
|
raise IndexError("Index %i out of bounds for size %i!" % (index, self.size))
|
||||||
|
if not self.__dataset.has_nix:
|
||||||
|
print('Sorry, this is not supported for non-nixed datasets. Implement it at '
|
||||||
|
'fishbook.reproclasses.BaselineData.membrane_voltage and send a pull request!')
|
||||||
|
return None, None
|
||||||
|
else:
|
||||||
|
rp = self.__repros[index]
|
||||||
|
data_source = os.path.join(self.__dataset.data_source, self.__dataset.id + ".nix")
|
||||||
|
f = nix.File.open(data_source, nix.FileMode.ReadOnly)
|
||||||
|
b = f.blocks[0]
|
||||||
|
t = b.tags[rp.id]
|
||||||
|
if not t:
|
||||||
|
print("Tag not found!")
|
||||||
|
try:
|
||||||
|
data = t.retrieve_data("V-1")[:]
|
||||||
|
time = np.asarray(t.references["V-1"].dimensions[0].axis(len(data)))
|
||||||
|
except:
|
||||||
|
data = np.empty()
|
||||||
|
time = np.empty()
|
||||||
|
f.close()
|
||||||
|
return time, data
|
||||||
|
|
||||||
def eod(self, index: int=0):
|
def eod(self, index: int=0):
|
||||||
eod = self.__eod_data[index] if len(self.__eod_data) >= index else None
|
eod = self.__eod_data[index] if len(self.__eod_data) >= index else None
|
||||||
time = np.arange(len(eod)) / self.__dataset.samplerate
|
time = np.arange(len(eod)) / self.__dataset.samplerate
|
||||||
|
Loading…
Reference in New Issue
Block a user