Skip to content

Instantly share code, notes, and snippets.


Nathan Clack nclack

  • Kinetica DB
  • Ashburn, VA
View GitHub Profile
nclack / gist:2695810
Last active Oct 4, 2015
Plot the shape of a tracked whisker at a given time point.
View gist:2695810
w = LoadWhiskers('trial.whiskers');
measurements = LoadMeasurements('trial.measurements');
whisker_id=0; % the tracked whisker of interest
frame_id=100; % the time point of interest
times = [measurements(:).fid];
names = [measurements(:).label];
curveids = [measurements(:).wid];
nclack / gist:2473960
Created Apr 23, 2012
Arithmetic coding example
View gist:2473960
void encode()
{ unsigned char *input, *output=0; // input and output buffer
size_t countof_input, countof_output; // number of symbols in input and output buffer
float *cdf=0;
size_t nsym; // number of symbols in the input alphabet
// somehow load the data into input array
encode_u1_u8( // encode unsigned chars to a string of bits (1 bit per output symbol)
input, countof_input,
nclack /
Created Jan 23, 2012
Plotting whiskers using whisk's Python interface (and matplotlib)
import traj
from numpy import *
from pylab import *
data = traj.MeasurementsTable('trial.measurements').asarray()
dt = 0.002 # seconds per frame
for i in xrange(data[:,0].max()+1):
mask = data[:,0]==i
nclack / gist:1518410
Created Dec 24, 2011
Plotting whiskers using whisk's Matlab interface
View gist:1518410
%% Load the file
measurements = LoadMeasurements('trial.measurements')
%% Set the frame rate
dt = 0.002; %seconds per frame
%% Get the data and plot
% Note: Be careful about the data types returned in the measurements struct.
% They're not all doubles.