Skip to content

Instantly share code, notes, and snippets.

View jasmainak's full-sized avatar

Mainak Jas jasmainak

View GitHub Profile
@jasmainak
jasmainak / mkl_error.py
Created February 3, 2016 13:55
mkl error
======================================================================
ERROR: Failure: ImportError (libopenblas.so.0: cannot open shared object file: No such file or directory)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mainak/anaconda/lib/python2.7/site-packages/nose/loader.py", line 420, in loadTestsFromName
addr.filename, addr.module)
File "/home/mainak/anaconda/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/home/mainak/anaconda/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
In [1]: import scipy
In [2]: scipy.test('full')
Running unit tests for scipy
NumPy version 1.10.2
NumPy relaxed strides checking option: False
NumPy is installed in /home/mainak/anaconda/lib/python2.7/site-packages/numpy
SciPy version 0.16.1
SciPy is installed in /home/mainak/anaconda/lib/python2.7/site-packages/scipy
Python version 2.7.11 |Anaconda 1.9.1 (64-bit)| (default, Dec 6 2015, 18:08:32) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jasmainak
jasmainak / haufe.ipynb
Created July 14, 2017 09:25 — forked from wmvanvliet/haufe.ipynb
Testing the Haufe trick
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jasmainak
jasmainak / ps.py
Created July 18, 2018 02:30 — forked from larsoner/ps.py
# -*- coding: utf-8 -*-
"""
PySurfer-like plotting using VisPy scene.
"""
import numpy as np
from vispy import scene, app
import mne
import nibabel
name: hnn
channels:
- defaults
dependencies:
- python>=3.6
- pip
- numpy
- scipy
- matplotlib
- cython
@jasmainak
jasmainak / automations.sh
Created January 6, 2019 04:42 — forked from raghavrv/automations.sh
Some automation aliases and scripts for Telecom Paristech desktop / TSI server
export LANG=en_US.UTF-8
# COMMON CONFS
# Use pgrep with full command path and display the name
alias checktuns="ps x | grep 'ssh -N'"
alias pgrep="ps x | grep "
# Set the scikit path env var
export SCIKIT_LEARN_PATH=~/raghav/code/scikit-learn
@jasmainak
jasmainak / plot_bad_epochs.py
Created March 5, 2019 03:16
visualize bad epochs
import numpy as np
from autoreject import RejectLog
epochs_orig = epochs.copy()
# now interactively mark the bad epochs
epochs.plot()
bad_idxs = [idx for idx, drop in enumerate(epochs.drop_log) if
drop == ['USER']]
def remap_evoked(evoked, info_to, mode='fast'):
# get info that should only differ in dev_head transform
from mne import pick_types, pick_info
from mne.forward import _map_meg_channels
picks = pick_types(evoked.info, meg=True, eeg=False, ref_meg=True)
info_from = pick_info(evoked.info, picks)
info_to = pick_info(info_to, picks)
mapping = _map_meg_channels(info_from, info_to, mode=mode)
# %%
# %matplotlib widget
import matplotlib.pyplot as plt
from matplotlib.colors import SymLogNorm
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import numpy as np
from neuron import h
from hnn_core.network_builder import load_custom_mechanisms
from hnn_core.lfp import _LFPElectrode