Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

import acquire
runtime = acquire.Runtime() # initializes driver adapters
# All the settings are in the `props`
# Configuration objects are typed.
# They can all be made into a dict. e.g: props.dict()
# They can also be read from a dict. e.g. Properties(**json.load('acquire.json')))
p = runtime.get_configuration()
# Camera configuration
@nclack
nclack / 2021 Dec Slicing.ipynb
Created December 17, 2021 23:49
Exploring sampling data and transforms
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nclack
nclack / gist:2695810
Last active October 4, 2015 20:38
Plot the shape of a tracked whisker at a given time point.
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 April 23, 2012 21:23
Arithmetic coding example
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 January 23, 2012 22:46
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
nclack / gist:1518410
Created December 24, 2011 21:37
Plotting whiskers using whisk's Matlab interface
%% 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.