Skip to content

Instantly share code, notes, and snippets.

Avatar

Nathan Clack nclack

  • Kinetica DB
  • Ashburn, VA
View GitHub Profile
@nclack
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
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
cdf_build(&cdf,&nsym,input,countof_input);
encode_u1_u8( // encode unsigned chars to a string of bits (1 bit per output symbol)
(void**)&out,&countof_output,
input, countof_input,
@nclack
nclack / plot_whisker_angle.py
Created Jan 23, 2012
Plotting whiskers using whisk's Python interface (and matplotlib)
View plot_whisker_angle.py
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
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.
You can’t perform that action at this time.