Convert pandas dataframe back to Evoked

External Email - Use Caution

Dear list,

I used the .to_dataFrame() method to convert an Evoked object to a pandas
data frame, performed some channel operations, and now I would like to read
the data frame back as a new evoked object with the .EvokedArray() method.
The EvokedArray() call works fine, except that the created time points do
not match the original ones.

On the original Evoked file, time ranges from -500 to 13000 ms, but it
progresses in 2ms steps (minimum and maximum Evoked.times are -0.5 and
1.300 respectively, but the length of the .times vector is 923 items). This
structure is preserved in the pandas data frame, but the problem is that
when I read it back the data frame as Evoked, the time/index of the
dataframe is ignored, and the Evoked object creates its own time, which do
not correspond to the actual timing of the original signal (i.e. the time
points in the data frame.

My questions would be then:
- How create an Evoked object using the both the data and the time points
stored in the pandas data frame?
- More or less unrelated to the question, but I am puzzled by the time
points and the fact that they progress on 2ms steps. Raw data was
originally sampled ad 2048Hz, but during pre-processing it was down-sampled
to 512Hz (The sampling frequency I am feeding to the EvokedArray() call).
Could this be the reason for having samples on 2ms steps? Or is this a sign
that I made some kind of mistake during pre-processing / Epoching /
averaging?
- Is it possible to altogether avoid the conversion to pandas data frame? I
am trying to compute event-related lateralizations, and for those I need to
perform some additions and subtractions between symmetrical left and right
electrodes depending on the visual hemifield in which an image is
presented. I could not manage to do that directly on the Evoked object, so
I figured the easiest way would be to convert the Evoked to a data frame,
perform the computations necessary computations there, and then read back
the results as a new evoked object that I can use to calculate grand
averages and generate plots. That worked ok, in principle, except for the
timing issue.

Thanks in advance for any ideas!
Best,
D.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180807/ed973e24/attachment-0001.html