Closed cristi-neagu closed 6 years ago
Yes, it could return a None. I will modify. But do you know why a channel got missing ? keepChannels() should keep the channels you gave it. If you already know in advance before read what channels you are interested in, I would rather advise you to use channelList=[ 'list', 'of', 'channels']. You are loading everything and then dump what is not necessary, loading only what you need at once should be quicker and consumming less memory.
I am missing channels because the mdf files i'm using may not have them to start with.
Ok then, if that's solving your issue, I guess you can close.
Closed in ee6410b
Can this raise a warning instead of an error and let the calling code deal with the missing channel, rather than stop execution completely? The function can either return the channel name as it currently does, or return
None
.I usually build a list of channel names, pass that list to
mdf.keepChannels()
, change sampling rate, then iterate over the list, returning data. If one of the channels is missing i have to do a key check for every channel i want to retrieve (which seems a bit redundant, sincemdf.getChannelData()
does that check as well), and either remove the channel names (which i might not necessarily want to do), or do some sort of complicated procedure to remove the channel name and replace it with anumpy.zeros_like()
vector (which is preferable).It seems easier to get a warning from
mdf.getChannelData()
and deal with it on the spot, rather than doing extra checks before hand.