" I’d like to append them to a sort of databank or list that I could call for plotting or statistics with pandas and numpy."
I had a similar requirement wherein I had to read through individual subjects’ fdt data, do the epoching and apply feature extraction / classification. So as I read through each subject’s .FDT (eeglab) file and did the epoch, I converted them into pandas dataframe using to_data_frame, concatenated each subject’s data using pandas.concat and saved them as .csv (added a ‘subject’ column in addition to the pre-generated columns). Now I can visualize individual subject’s data / all subjects’ data and train models on this dataset.
" If I append Pandas in a list,what happens to raw.info? " - I didn’t need the raw.info file once the dataset is created, but if you will still need it, you can save it as a separate text file along with the csv (either for one subject or for all subjects).
And as for your requirements, you could extend this approach by converting the incoming patient’s data to a dataframe, and either a) append it to the existing dataset, or b) validate the patient’s data using the pre-trained model .
‘Besides as “n” in databank increases (normals, children with learning disabilities, temporal lobe epilepsy databanks) parametric, nonparametric statistics become stronger.’ - Similar to adding patient’s data the existing dataset (rows), these additional criteria / conditions can be appended as columns for the data for which the criterion is known and fill it with Nan otherwise.
Something like this:
fnames = glob.glob("*.set")
for fname_count,fname in enumerate(fnames):
raw = mne.io.read_raw_eeglab(fname, preload=False)
raw_events, raw_event_id = mne.events_from_annotations(raw)
raw_epochs = mne.Epochs(raw, events=raw_events, event_id=raw_event_id, tmin = t_min, tmax = t_max, baseline = (-0.4, 0), preload=False)
df = raw_epochs.to_data_frame()
df['subject'] = fname_count+1
if fname_count == 0:
df_all = df
df_all = pd.concat([df_all , df])