Skip to content

Instantly share code, notes, and snippets.

@ycanerol
ycanerol / write_eventmarkers.py
Created March 5, 2020 16:16
Read the stimulus times from bininfo.mat and write it in the required format for phy plugin EventMarker.
"""
Read the stimulus times from bininfo.mat and write it in the required
format for phy plugin EventMarker.
"""
import h5py
from pathlib import Path
import numpy as np
fp = Path(folder)
@ycanerol
ycanerol / readks.py
Last active December 3, 2020 16:12
Preprocess kilosort data
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
import os
import numpy as np
import pandas as pd
@ycanerol
ycanerol / shufflebyrow.py
Created April 16, 2019 07:54
Shuffle 2D numpy array within each row
def shufflebyrow(X):
"""
Shuffle each row of a given array independently. Can be useful for
randomizing binned spikes from all cells, for statistical testing.
Parameters
--------
X: np.array with two dimensions
Rows should correspond to cells, columns to time bins.
@ycanerol
ycanerol / multiSTAbrowser.py
Created March 12, 2019 16:56
Multi-STA browser with slider
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.widgets import Slider
import iofuncs as iof
import plotfuncs as plf