Hi all,
According to the mne-python reference the input argument to
mne.fiff.Raw.append may be a list of Raw instances. As such, could someone
explain to me why the following doesn't work:
In: raws = [fiff.Raw(f) for f in file_list]
In: print raws
Out: [<Raw | n_channels x n_times : 392 x 1302000>, <Raw | n_channels x
n_times : 392 x 724000>]
In: raw = mne.fiff.Raw.append(raws)
Out: TypeError: unbound method append() must be called with Raw instance as
first argument (got list instance instead)
When I ask for type(raws) I get <type 'list'>, so how is it not a list of
Raw instances that satisfies append?
This problem has to do with the use of class methods. Generally you should
use class methods (e.g., Raw.append()) on instantiated objects, not by
accessing them through the class name. What I mean is that you'd generally
do this:
raw0 = mne.fiff.Raw(fname0)
raw1 = mne.fiff.Raw(fname1)
raw = raw0.append(raw1)
Note how the append() method is called from the instantiated Raw instance
"raw0", not by calling mne.fiff.Raw.append(). So you'd want to do any of
the following:
raw = raws[0].append(raws[1:])
raw = raws[0].append(raws[1])
raw = mne.fiff.concatenate_raw(raws)
I find the last use case the most intuitive, so it's generally what I use.
In mne-python, classes (e.g., Raw, Epochs, SourceEstimate) and their
methods can be differentiated from normal functions (e.g.,
concatenate_raws) by the use of uppercase letters at the beginning of the
name. So if you ever find yourself trying to use a method within a
capital-letter namespace (e.g., mne.Epochs.add_proj), it's probably not the
ideal way to accomplish what you're going for.