From 9738948a177e1ed74c5e4a9015a6cb20a7a8e5ea Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Tue, 8 Dec 2020 18:42:04 +0100 Subject: [PATCH] Added 'channel_names' property --- .../extractors/cedextractors/cedrecordingextractor.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spikeextractors/extractors/cedextractors/cedrecordingextractor.py b/spikeextractors/extractors/cedextractors/cedrecordingextractor.py index 19764038..3641539f 100644 --- a/spikeextractors/extractors/cedextractors/cedrecordingextractor.py +++ b/spikeextractors/extractors/cedextractors/cedrecordingextractor.py @@ -5,6 +5,7 @@ import numpy as np from pathlib import Path from typing import Union +from copy import deepcopy try: from sonpy import lib as sp @@ -56,6 +57,7 @@ def __init__(self, file_path: PathType, smrx_channel_ids: list): # get channel info / set channel gains self._channelid_to_smrxind = dict() self._channel_smrxinfo = dict() + self._channel_names = [] for i, ind in enumerate(smrx_channel_ids): if self._recording_file.ChannelType(ind) == sp.DataType.Off: raise ValueError(f'Channel {ind} is type Off and cannot be used') @@ -71,6 +73,7 @@ def __init__(self, file_path: PathType, smrx_channel_ids: list): channel_ids=[i], gains=gains ) + self._channel_names.append(self._channel_smrxinfo[i]['title']) rate0 = self._channel_smrxinfo[0]['rate'] for chan, info in self._channel_smrxinfo.items(): @@ -80,6 +83,10 @@ def __init__(self, file_path: PathType, smrx_channel_ids: list): self._kwargs = {'file_path': str(Path(file_path).absolute()), 'smrx_channel_ids': smrx_channel_ids} + @property + def channel_names(self): + return deepcopy(self._channel_names) + @check_get_traces_args def get_traces(self, channel_ids=None, start_frame=None, end_frame=None): '''This function extracts and returns a trace from the recorded data from the