Skip to content

Instantly share code, notes, and snippets.

JohnAtl / interpol.m
Created Jul 15, 2020
Interpolate missing EEG channels based on chanlocs of all channels.
View interpol.m
function [EEG] = interpol( EEG, chanlocs, method )
%INTERPOL Performs channel interpolation on eeglab EEG structure
% Receives the EEG structure (see EEGLAB documentation), the disered final chanlocs to
% have on the data and the interpolation method and the algorithm finds the missing
% channels in the EEG structure and calls the pop_interp method from EEGLAB toolbox to
% compute the interpolations. Afterwords sorts the channels to the provided chanlocs
% order and fixes the icachansind field.
% Input:
% EEG - the EEG structure (EEGLAB)
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Users/john/.conda/envs/mneredux/lib/python3.7/site-packages/mne/preprocessing/", line 1633, in plot_properties
figsize=figsize, show=show, reject=reject)
File "/Users/john/.conda/envs/mneredux/lib/python3.7/site-packages/mne/viz/", line 472, in plot_ica_properties
File "/Users/john/.conda/envs/mneredux/lib/python3.7/site-packages/mne/viz/", line 110, in plt_show
(fig or plt).show(**kwargs)
File "/Users/john/.conda/envs/mneredux/lib/python3.7/site-packages/matplotlib/", line 272, in show
return _show(*args, **kw)
JohnAtl / macpowerusers.css
Created Apr 16, 2020
Mellow theme for Stylus and the Mac Power Users Discourse
View macpowerusers.css
@import url(;
@import url(;
@import url(,700);
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Applications/PyCharm with Anaconda plugin .app/Contents/plugins/python/helpers/pydev/_pydev_bundle/", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/Applications/PyCharm with Anaconda plugin .app/Contents/plugins/python/helpers/pydev/_pydev_imps/", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/john/PycharmProjects/mne-test/", line 16, in <module>
ica.plot_properties(raw, picks=ica.exclude)
File "/Users/john/PycharmProjects/mne-test/venv/lib/python3.7/site-packages/mne/preprocessing/", line 1633, in plot_properties
figsize=figsize, show=show, reject=reject)
View hl1_to_events.m
% Insert events based on transitions on a high-level input channel.
% As with all code from the internet, verify that it works for your unique situation.
function EEG = hl1_to_events(EEG)
% Find the index of the high-level (trigger) channel.
hl1_index = eeg_chaninds(EEG, 'HL1');
hl1 =,:);
JohnAtl / insert_filename_as_header.rb
Created Feb 7, 2020
Code to help with note-link-janitor
View insert_filename_as_header.rb
# Inserts the file's name as the first header in the file, if it isn't already there.
# Assumes filename begins with a 14 digit zettelkasten ID.
# Original file saved as filename.bak.
# As always, caveat emptor. This code could harm your files, so try it on a backup.
Dir.glob('*.md') do |filename|
puts "working on: #{filename}"