You are not authenticated, login.
text: sort by
tags: modified
type: chronology
{535} is owned by tlh24.{499} is owned by tlh24.
[0] Shuler MG, Bear MF, Reward timing in the primary visual cortex.Science 311:5767, 1606-9 (2006 Mar 17)

[0] Karni A, Meyer G, Rey-Hipolito C, Jezzard P, Adams MM, Turner R, Ungerleider LG, The acquisition of skilled motor performance: fast and slow experience-driven changes in primary motor cortex.Proc Natl Acad Sci U S A 95:3, 861-8 (1998 Feb 3)

hide / / print
ref: -0 tags: Anna Roe optogenetics artificial dura monkeys intrinisic imaging date: 09-30-2013 19:08 gmt revision:3 [2] [1] [0] [head]

PMID-23761700 Optogenetics through windows on the brain in nonhuman primates

  • technique paper.
  • placed over the visual cortex.
  • Injected virus through the artificial dura -- micropipette, not CVD.
  • Strong expression:
  • See also: PMID-19409264 (Boyden, 2009)

hide / / print
ref: -0 tags: polymide flexible electrode Rousche incision needle assist date: 01-30-2013 06:38 gmt revision:3 [2] [1] [0] [head]

PMID-11327505 Flexible Polyimide-Based Intracortical Electrode Arrays with Bioactive Capability

  • Use gold / polymide fabrication; electrode is 20um thick, 160um wide.
  • Still quite flexible -- buckles at 0.003 N.
  • Successfully recorded by inserting it in an incision in rat barrel cortex -- needle assist.
    • Well, not too successfully.
  • Suggest that bioactive components can be applied to the permeable polymide surface.


' ''' ()

hide / / print
ref: work-2999 tags: autocorrelation poisson process test neural data ISI synchrony DBS date: 02-16-2012 17:53 gmt revision:5 [4] [3] [2] [1] [0] [head]

I recently wrote a matlab script to measure & plot the autocorrelation of a spike train; to test it, I generated a series of timestamps from a homogeneous Poisson process:

function [x, isi]= homopoisson(length, rate)
% function [x, isi]= homopoisson(length, rate)
% generate an instance of a poisson point process, unbinned.
% length in seconds, rate in spikes/sec. 
% x is the timestamps, isi is the intervals between them.

num = length * rate * 3; 
isi = -(1/rate).*log(1-rand(num, 1)); 
x = cumsum(isi); 
%%find the x that is greater than length. 
index = find(x > length); 
x = x(1:index(1,1)-1, 1); 
isi = isi(1:index(1,1)-1, 1); 

The autocorrelation of a Poisson process is, as it should be, flat:


  • Red lines are the autocorrelations estimated from shuffled timestamps (e.g. measure the ISIs - interspike intervals - shuffle these, and take the cumsum to generate a new series of timestamps). Hence, red lines are a type of control.
  • Blue lines are the autocorrelations estimated from segments of the full timestamp series. They are used to how stable the autocorrelation is over the recording
  • Black line is the actual autocorrelation estimated from the full timestamp series.

The problem with my recordings is that there is generally high long-range correlation, correlation which is destroyed by shuffling.

Above is a plot of 1/isi for a noise channel with very high mean 'firing rate' (> 100Hz) in blue. Behind it, in red, is 1/shuffled isi. Noise and changes in the experimental setup (bad!) make the channel very non-stationary.

Above is the autocorrelation plotted in the same way as figure 1. Normally, the firing rate is binned at 100Hz and high-pass filtered at 0.005hz so that long-range correlation is removed, but I turned this off for the plot. Note that the suffled data has a number of different offsets, primarily due to differing long-range correlations / nonstationarities.

Same plot as figure 3, with highpass filtering turned on. Shuffled data still has far more local correlation - why?

The answer seems to be in the relation between individual isis. Shuffling isi order obviuosly does not destroy the distribution of isi, but it does destroy the ordering or pair-wise correlation between isi(n) and isi(n+1). To check this, I plotted these two distributions:

-- Original log(isi(n)) vs. log(isi(n+1)

-- Shuffled log(isi_shuf(n)) vs. log(isi_shuf(n+1)

-- Close-up of log(isi(n)) vs. log(isi(n+1) using alpha-blending for a channel that seems heavily corrupted with electro-cauterizer noise.

hide / / print
ref: Frank-2007.11 tags: horses PD STN DBS levodopa decision learning science date: 01-25-2012 00:50 gmt revision:5 [4] [3] [2] [1] [0] [head]

PMID-17962524[0] Hold your horses: impulsivity, deep brain stimulation, and medication in parkinsonism.

  • While on DBS, patients actually sped up their decisions under high-conflict conditions. Wow!
    • This impulsivity was not effected by dopaminergic medication status.
    • Impulsivity may be the cognitive equivalent of excess grip force {88}.
  • Mathematical models of decision making suggest that individuals only execute a choice once the 'evidence' in its favor crosses a critical decision threshold.
    • people can adjust decision thresholds to meet current task demands
    • One theory is that the STN modulates decision thresholds (6) and delays decision-making when faced with a conflict. Wanted to test this in a conflict situation.
    • Record from the STN in conflict task to see ??
  • Second wanted to test negative learning.
    • Dopamine replacement therapy impairs patient's ability to learn from the negative outcomes of their decisions (11 - 13), which may account for pathological gambling behavior (14).
    • PD patients did indeed score worse on avoidance, slightly less accurate on AB choice, and about the same for the rest.
  • Made a network model.
    • Found that preSMA and STN coactivation is associated with slowed reaction times under decision conflict (25).
    • And that STN-DBS reduces coupling between cingulate and basal ganglia output (27).
    • Their model they either lesioned STN or overloaded it with high frequency regular firing.
      • either one showed the same faster response in high-conflict decisions.
  • STN dysfunction does not lead to impulsivity in all behavioral situations.
    • STN lesioned rats show enhanced preference for choices that lead to large delayed rewards compared to those that yield small immediate rewards (32,33). (This is not conflict, though -- rather reward -- but nonetheless illuminating)
  • Dopaminergic medication, by tonically elevating dopamine levels and stimulating D2 receptors, prevents learning from negative decision outcomes (11, 13, 18). Hence pathological gambling behavior (14).
  • Other studies show DBS-induced impairments in cognitive control (27 PMID-17119543, 36 PMID-15079009).


[0] Frank MJ, Samanta J, Moustafa AA, Sherman SJ, Hold your horses: impulsivity, deep brain stimulation, and medication in parkinsonism.Science 318:5854, 1309-12 (2007 Nov 23)

hide / / print
ref: Wyler-1980.05 tags: operant control motor learning interspike intervals ISI Wyler Lange Neafsey Robbins date: 01-07-2012 21:46 gmt revision:1 [0] [head]

PMID-6769536[0] Operant control of precentral neurons: Control of modal interspike intervals

  • Question: can monkeys control the ISI of operantly controlled neurons?
    • Answer: Seems they cannot. Operant and overt movement cells have about the same ISI, and this cannot be changed by conditioning.
  • Task requires a change from tonic to phasic firing, hence they call it "Differential reinforcement of Tonic Patterns".
    • That is, the monkey is trained to produce spikes within a certain ISI window.
    • PDP8 control, applesauce feedback.
    • modal ISI, in this case, means mode (vs. mean and median) of the ISI.
  • Interesting: "It was not uncommon for a neuron to display bi- or trimodal ISI distributions when the monkey was engaged in a movement unrelated to a unit's firing"
  • For 80% of the units, the more tightly a neuron's firing was related to a specific movement, the more gaussian its ISI became.
  • As the monkey gained control over reinforced units, the ISI became more gaussian.
  • Figure 2: monkey was not able to significantly change the modal ISI.
    • Monkeys instead seem to succeed at the task by decreasing the dispersion of the ISI distribution and increasing the occurrence of the modal ISI.
  • Monkeys mediate response through proprioceptive feedback:
    • Cervical spinal cord sectioning decreases the fidelity of control.
    • When contralateral C5-7 ventral roots were sectioned, PTN responsive to passive arm movements could not be statistically controlled.
    • Thus, monkeys operantly control precentral neurons through peripheral movements, perhaps even small and isometric contractions.
  • Excellent paper. Insightful conclusions.


[0] Wyler AR, Lange SC, Neafsey EJ, Robbins CA, Operant control of precentral neurons: control of modal interspike intervals.Brain Res 190:1, 29-38 (1980 May 19)

hide / / print
ref: Donoghue-1990.01 tags: Donoghue Suner Sanes rat motor cortex reorganization M1 tuning surprising date: 01-03-2012 03:30 gmt revision:4 [3] [2] [1] [0] [head]

PMID-2340869[0] Dynamic organization of primary motor cortex output to target muscles in adult rats. II. Rapid reorganization following motor nerve lesions.

  1. Map out the motor cortex into vibrissa and forelimb areas using ICMS.
  2. Implant a simulating electrode in the vibrissa motor cortex.
  3. Implant EMG electrodes in the forearm.
  4. Sever the buccal and mandibular branches of the facial nerve.
  5. stimulate, and wait for forearm EMG to be elicited by ICMS. Usually occurs! Why? Large horizontal axons in motor cortex? Uncovering of silent synapses, and homeostatic modulation of firing rates?


[0] Donoghue JP, Suner S, Sanes JN, Dynamic organization of primary motor cortex output to target muscles in adult rats. II. Rapid reorganization following motor nerve lesions.Exp Brain Res 79:3, 492-503 (1990)

hide / / print
ref: Shuler-2006.03 tags: reward V1 visual cortex timing reinforcement surprising date: 01-03-2012 02:33 gmt revision:4 [3] [2] [1] [0] [head]

PMID-16543459[0] Reward Timing in the Primary Visual Cortex

  • the responses of a substantial fraction of neurons in the primary visual cortex evolve from those that relate solely to the physical attributes of the stimuli to those that accurately predict the timing of reward.. wow!
  • rats. they put goggles on the rats to deliver full-fields retinal illumination for 400ms (isn't this cheating? full field?)
  • recorded from deep layers of V1
  • sensory processing does not seem to be reliable, stable, and reproducible...
  • rewarded only half of the trials, to see if the plasticity was a result of reward delivery or association of stimuli and reward.
  • after 5-7 sessions of training, neurons began to respond to the poststimulus reward time.
  • this was actually independent of reward delivery - only dependent on the time.
  • reward-related activity was only driven by the dominant eye.
  • individual neurons predict reward time quite accurately. (wha?)
  • responses continued even if the animal was no longer doing the task.
  • is this an artifact? of something else? what's going on? the suggest that it could be caused by subthreshold activity due to recurrent connections amplified by dopamine.


hide / / print
ref: -0 tags: todorov R2 M1 PV tuning bias decision boundaries controversy date: 12-22-2011 22:52 gmt revision:1 [0] [head]

PMID-11017160 Reply to One motor cortex, two different views

hide / / print
ref: Inzlicht-2009.03 tags: uncertainty religion conviction decision science date: 02-02-2010 20:39 gmt revision:3 [2] [1] [0] [head]

The Neural Markers of Religious Conviction PMID-19291205

Recently a friend pointed this article out to me, and while I found the scientific results interesting though slightly questionable - that religious people have less anterior cingulate cortex activation upon error - the introduction and discussion were stimulating. What follows are a few quotes and my interpretation and implications of the authors' viewpoint.

"The absence of a cognitive map providing clear standards and goals is uncomfortable and leads people to search for and assert belief systems that quell their anxiety by allowing for clearer goal pursuit (McGregor, Zanna, Holmes, & Spencer, 2001)." I would argue that uncertainty itself is highly uncomfortable - whether it is uncertainty as to how much food you will have in the future, or uncertainty as to the best behavior. In this sense, of course religion decreases anxiety - it provides a structured way to think about this disordered and highly undecidable world, a filter to remove or explain away many of the random parts of our lives. In my personal experience, conviction is usually easier than trying to hold accurate probabalistic models in your mind - conviction is pleasurable, even if it is wrong.

I find their short review of cognitive science in the introduction interesting - they claim that the septo-hippocampal system is concerned with the detection and correction of errors associated with concrete behaviors and goals, while in humans (and other primates?) the ACC allows error and feedback based operations on concepts and higher-order goals. The need for a higher-level error detection circuit makes sense in humans, as we are able to bootstrap our behavior to very complicated limits, but it also begs to question - what trains the ACC? To some degree, it must train itself in the via the typical loopy feedback-based brain way, but this only goes so far, as (at least in the modern world) the space of all possible behaviors, longterm and short term, given stochastic feedback is too large to be either decidable or fully parseable/generalizable into an accurate global model, even given a lifetime of experience. Religion, as this paper and many others posits, provides this global model against which behaviors and perceptions can be measured.

But why does a uncertainty challenge causes a compensatory increase in the strength of convictions, almost to the point of zealousness (how is this adaptive? just as a means of reducing anxiety?); I've seen it happen, but why. From a Bayesian point of view, increased uncertainty necessitates decreased certainty, or fewer convictions. From a pragmatic point of view, increased uncertainty requires increased convictions purely because the convictions have to make up for the lack of environmental information from which to make a decision. Any theory must include the cost of not making a decision, the cost of delaying a decision, and the principle of sunk costs.

There are other solutions to the 'undecidable' problems of life than religion - literary culture and science come to mind. The principle behind all may be that, while individual experience and intellect is possibly insufficient for generating global rules to guide behavior, the condensed experience of thousands/millions/billions of people is. This assumes that experience, as a random variable/signal, scales according to the laws of large numbers - noise decreases monotonically as sample size increases. This may not actually be true, it depends on the structure of the distributions, and the extent to which people's decisions/behaviors are orthogonal, and the fidelity of the communication / aggregation channels which operate on the data. I think the dimensionality increase afforded by larger sample size is slower than the concomitant noise decrease, hence (valid) global rules guiding behavior can be extracted from large populations of people. Regarding the communication channels, it seems there were always high fidelity channels of experience - e.g. Homer, Benjamin Franklin's transatlatic trips, the royal Society of London, (forgive my western pov) - and now, there are even more (the internet)! The latter invention should, at least within the framework here, allow larger groups of people to make 'harder' or 'more undecidable' decisions by virtue of greater information. Fairly standard rhetoric to the internet crowd (c.f. forums), I know.

I would argue that this is better than using convictions... but the result of communication / aggregation is convictions anyway, so eh. Getting back to the uncertainty issue, the authors point out that conservative cultures there is usually greater uncertainty (which way is the arrow of causality?), and increasing uncertainty bolsters support zealous action, e.g. war.

"For example, contemporary social psychological research indicates that uncertainty threats can cause people to become more extreme in their opinions, so that they exaggerate their religious convictions and become more willing to support a war to defend those convictions (McGregor, Haji, Nash, & Teper, 2008). In fact, even nonbelievers bolster their personal convictions to near-religious levels in order to reduce uncertainty-related distress (McGregor et al., 2001). Thus, in terms of feedback-loop models, the standards and predictions provided by religious convictions are strong enough that they can resist any discrepant feedback that might alert the comparator system."

This, I believe, is fairly accurate, and it implies several dramatic things: if a despot or leader wishes to engender support for a war, particularly a religious war, then he should make the lives of his constituents uncertain. If their lives are stable and certain sans ideology, then they will be less likely to have the convictions ('the other side is bad!') to fight certain wars. (It of course depends on who/what the other side is!). Take Europe vs. America as an example - America has far fewer social support systems and greater uncertainty in life than in Europe. The Economist frequently phrases American businesses' penchant for hiring and firing people quickly and seemingly at whim, as it encourages creative reuse, economic flexibility, and better allocation of capital, but it has a clear downside - increased anxiety, uncertainty. We (well, not me, but many Americans) deal with this via religion, the article would argue (that said, I should guess that there are a great many other reasons people are religious). Still, in western Europe has less uncertainty in life, is more secular, and less tolerant of ideological wars. Hence the antidote for war is to give people stable, significant lives. More common-sense rhetoric.

On to another suggestive point made by the article: "In terms of feedback-loop models, this explanation suggests that the standards and predictions provided by religion are inadequate and should, in fact, result in prediction errors; however, because religious beliefs are rigid, inconsistent information is reinterpreted in such a way that it becomes assimilated to preexisting convictions, further sustaining beliefs (Park, 2005)."

I would be interested in an actual test of this hypothesis - if it is possible without bias (perhaps another EEG study? perhaps it has been already done?) The authors actually prove the opposite point, that religions people are more likely to answer correctly on the Stroop test. They take more time, but seem to be more careful. This reminds me of Matteo Ricci, who allegedly used his Jesuit training in sustained concentration and memorization to master the Chinese language; clearly religion is far more than just a means of reducing perceived uncertainty about the world.

To loop the argument back on its tail - this is the 'meta' blog, afterall - one may question if the theory (looking at behavior in terms of the unpleasantness of uncertainty and the need for decidability) is a good way of looking at things, just as we questioned if religion is a good theory of the world. I think it generalizes; for example, Solaiman mentioned that the European children of the revolution of 1968 had parents who notably applied very little guidance to their lives; they were like the American hippies. These people grew up disliking their parents, and sought far more structure in their lives and in parenting their own children. One may imagine that they disliked the vast uncertainty their parents bluntly exposed them to, and paucity of guiding principles - something that the parents, after years of living in the world, probably had. Secondly, Solaiman recalled that all his favorite teachers were those that were strictest, strongest in their conviction, and most structured in their pedagogy. People seek to make decisions decidable whether through parents, teachers, religion, science or even art and literature.

To summarize, uncertainty engenders convictions by the pragmatic principle. Best thing we can do is to either reduce uncertainty or found those convictions on aggregate data(*)

(*) Google publication. The principle of data is our zeitgist, but history suggests that independent of what we think now it will not be the last.

comments? edit this, write below.

hide / / print
ref: Brown-2007.09 tags: motor force field learning vision date: 02-20-2009 00:28 gmt revision:1 [0] [head]

PMID-17855611 Motor Force Field Learning Influences Visual Processing of Target Motion

  • as you can see from the title - this is an interesting result.
  • learning to compensate for forces applied to the hand influenced how participants predicted target motion for interception.
  • subjects were trained on a robotic manipulandum that applied different force fields; they had to use the manipulandum to hit a accelerating target.
  • There were 3 force feilds: rightward, leftward, and null. Target accelerated left to right. Subjects with the rightward force field hit more targets than the null, and these more targets than the leftward force field. Hence motor knowledge of the environment (associated accelerations, as if there were wind or water current...) influenced how motion was perceived and acted upon.
    • perhaps there is a simple explanation for this (rather than their evolutionary information-sharing hypothesis): there exists a network that serves to convert visual-spatial coordinates into motor plans, and later muscle activations. The presence of a force field initially only affects the motor/muscle control parts of the ctx, but as training continues, the changes are propagated earlier into the system - to the visual system (or at least the visual-planning system). But this is a complicated system, and it's hard to predict how and where adaptation occurs.

hide / / print
ref: Karni-1998.02 tags: motor learning skill acquisition fMRI date: 10-08-2008 21:05 gmt revision:1 [0] [head]

PMID-9448252[0] The acquisition of skilled motor performance: Fast and slow experience-driven changes in primary motor cortex

  • a few minutes of daily practice on a sequential finger opposition task induced large, incremental performance gains over a few weeks of training
  • performance was lateralized
  • limited training experience can be sufficient to trigger performance gains that require time to become evident.
  • learning is characterized by two stages:
    • "fast” learning, an initial, within-session improvement phase, followed by a period of consolidation of several hours duration
      • possibly this is due to synaptic plasticity.
    • and then “slow” learning, consisting of delayed, incremental gains in performance emerging after continued practice
      • In many instances, most gains in performance evolved in a latent manner not during, but rather a minimum of 6–8 hr after training, that is, between sessions
      • this is thought to correspond to the reorganization of M1 & other cortical structures.
  • long-term training results in highly specific skilled motor performance, paralleled by the emergence of a specific, more extensive representation of a trained sequence of movements in the contralateral primary motor cortex. this is seen when imaging for activation using fMRI.
  • why is there the marked difference between declarative learning, which often only takes one presentation to learn, and procedural memory, which takes several sessions to learn? Hypothetically, they require different neural substrates.
  • pretty good series of references...


hide / / print
ref: notes-0 tags: filter DSP finite precision 16bit blackfin matlab date: 07-22-2008 03:25 gmt revision:7 [6] [5] [4] [3] [2] [1] [head]

I needed to evaluate different fixed-point filters & implement them in a way which would more-or-less easily transfer to hand-coded blackfin assembly. Hence, I wrote a small program in C to test two likely alternatives: a 5th order elliptic filter, with 82db stopband rejection, or a 4th order elliptic, with 72 db stopband rejection. see {421} also, and this useful reference. (also at {584})

UPDATE: this filter is not stable/ suitable for the 1.15 signed fraction format of the blackfin processor. As in the reference, you must use a non-canonic form which puts the numerator before the denominator. I had a great deal of difficulty trying to determine why the output of the Direct Form II filter was giving crap results with poles/zeros designed for lowpass operation. The reason appears to be that the Direct FormII filter requires dynamic range > +-1 for the w's (first feedback section). The numerator / b coefficients for these highpass filters is usually [1 -2 1] - a highpass - which returns 0 when passed saturated data. See the signal flowchart below.

The program for implementing these filters as cascaded biquad/ triquads follows. The method of generating the filter coefficients is in the comments. Note that the filter coefficients for the triquad exceed and absolute magnitude of 2, hence the triquad implementation has a fixed-point format of s.2.13 (one bit sign, 2 bits whole part, 13 bits fractional part). The biquad has s.1.14 format - one bit for the whole part. Also note that I incorporated a scale factor of x2 into the first stage, and x4 into the second stage, as the output of the ADC is only 12 bits and we can afford to expand it to the full range.

The filter responses, as designed (in floating point). 5th order is on the left, 4th on the right.

The filter output to white noise, in the time domain. 5th order has, in this impementation, a 'softer shoulder', which i do not think is appropriate for this application.

The same output in fourier space, confirming the softer shoulder effect. this was actually kinda unespected .. I thought an extra pole/zero would help! I guess the triquad & lower res coefficient quantization is less efficient.. ?

#include <stdio.h>
// gcc -Wall filter_test.c -o filter_test

//need to test fixed-point filtering in C (where it is easy)
//before converting to hand-coded assembly. 
short w1_1[2]= {0,0};
short w1_2[3]= {0,0,0};
short w2_1[2]= {0, 0}; 
short w2_2[2]= {0, 0}; 
filter 1: 5th order. biquad then a triquad.
[B1, A1] = ellip(5,0.2,84, 6/31.25); %84db = 14 bits. 
rb = roots(B1); 
ra = roots(A1); 
pa1 = poly(ra(1:2)); 
pa2 = poly(ra(3:5)); 
pb1 = poly(rb(1:2)); 
pb2 = poly(rb(3:5)); 
b1_1 = round(pb1*sqrt(B1(1))*2^15)
a1_1 = round(pa1* 2^14)* -1
b1_2 = round(pb2*sqrt(B1(1))*2^15)
a1_2 = round(pa2*2^13)*-1 % triquad.
short b1_1[3] = {1199, 87, 1199}; 
short a1_1[2] = {24544 -14085};
short b1_2[4] = {1199, 2313, 2313, 1199};
short a1_2[3] = {18090, -14160, 3893};

/*filter 2: can be implemented by 2 biquads. 
[B3, A3] = ellip(4,0.5,72, 6/31.25);
rb = roots(B3); 
ra = roots(A3); 
pa1 = poly(ra(1:2)); 
pa2 = poly(ra(3:4)); 
pb1 = poly(rb(1:2)); 
pb2 = poly(rb(3:4)); 
b2_1 = round(pb1*sqrt(B3(1))*2^15)
a2_1 = round(pa1* 2^14)* -1
b2_2 = round(pb2*sqrt(B3(1))*2^16) %total gain = 8. 
a2_2 = round(pa2*2^14)*-1
short b2_1[3] = {2082, 914, 2082};
short a2_1[2] = {24338, -13537}; 
//biquad2 (2): 
short b2_2[3] = {4163, 6639, 4163};
short a2_2[2] = {24260, -9677}; 

int madd_sat(int acc, short a, short b){
	//emulate the blackfin
	//signed-integer mode of operating. page 567  in the programming reference.
	int c; 
	long long l, lo, hi;
	lo = (long long)(-2147483647); 
	hi = (long long)(2147483647); 
	c = (int)a * (int)b; 
	l = (long long)acc + (long long)c; 
	if(l < lo)
		l = lo; 
	if(l > hi)
		l = hi; 
	acc = (int)l; 
	return acc; 
//need to deal with samples one at a time, as they come in, from different channels
//need to quantize the coeficients
//need to utilize a biquad topology / filter structure.  
//   (this is simple - just segregate the poles. order 5 filter req. biquad & triquad. 
short filter_biquad(short in, short* a1, short* b1, short* w1){
	int acc; 
	short out, w; 
	//in varies from 0 to 0x0fff - ADC is straight binary. (0 to 4095). unsigned.
	acc = madd_sat(0, in, 16384); 
	acc = madd_sat(acc, w1[0], a1[0]); 
	acc = madd_sat(acc, w1[1], a1[1]);
	w = (short)(acc >> 14); //hopefully this does sign-extended shift. 
	acc = madd_sat(0, w, b1[0]); 
	acc = madd_sat(acc, w1[0], b1[1]); 
	acc = madd_sat(acc, w1[1], b1[0]); //symmetry.  
	out = (short)(acc >> 14); 
	w1[1] = w1[0]; 
	w1[0] = w; 
	return out; 
short filter_triquad(short in, short* a2, short* b2, short* w2){
	int acc; 
	short out, w; 
	//this one is a bit different, as the coefficients are > 2 in the denom. 
	// hence have to normalize by a different fraction. 
	//multiply the numerator by 4 for a net gain of 8.
	acc = madd_sat(0   , in, 8192); 
	acc = madd_sat(acc, w2[0], a2[0]); 
	acc = madd_sat(acc, w2[1], a2[1]); 
	acc = madd_sat(acc, w2[2], a2[2]); 
	w = acc >> 13; 
	acc = madd_sat(0   , w, b2[0]); 
	acc = madd_sat(acc, w2[0], b2[1]); 
	acc = madd_sat(acc, w2[1], b2[1]); 
	acc = madd_sat(acc, w2[2], b2[0]); //symmetry.
	out = (short)(acc >> 13); 
	w2[2] = w2[1]; 
	w2[1] = w2[0]; 
	w2[0] = w; 
	return out; 

int main( int argv, char* argc[]){
	//read the samples from stdin.
	int in, out; 
	while(scanf("%d", &in)){
		//compare 5th and 4th order filters directly. 
		in -= 2048; 
		out = filter_biquad(in, a1_1, b1_1, w1_1); 
		out = filter_triquad(out, a1_2, b1_2, w1_2); 
		printf("%d	", out); 
		out = filter_biquad(in, a2_1, b2_1, w2_1); 
		out = filter_biquad(out, a2_2, b2_2, w2_2); 
", out); 
	return 0; 
// gcc -Wall filter_test.c -o filter_test
//  cat filter_test_in.dat | ./filter_test > filter_test_out.dat

Below, some matlab code to test the filtering.

% make some noisy data. 

x = randn(2000, 1);
x = x .* 1000; 
x = x + 2048; 
i = find(x >= 4096)
x(i) = 4095; 
i = find(x < 0);
x(i) = 0; 
x = round(x); 
fid = fopen('filter_test_in.dat', 'w'); 
for k = 1:length(x)
	fprintf(fid, '%d
', x(k)); 
fprintf(fid, 'quit'); 

Here is a blackfin assembly implementation of the filter, Note the filter weights (i0) and delays (i1, i2) need to be on two different cache/sram banks, or the processor will stall. Also note that , as per the second diagram above, the delays for biquad 1 output are synonymous to the delays for biquad 2 input, hence they are only represented once in memory.

	directform 1 biquad now, form II saturates 1.15 format.
	operate on the two samples in parallel (both in 1 32bit reg). 
	r0	x(n)				-- the input from the serial bus. 
	r1 	x(n-1) (yn-1)	-- ping-pong the delayed registers. 
	r2	x(n-2) (yn-2)	-- do this so save read cycles. 
	r3	y(n-1) (xn-1)
	r4	y(n-2) (xn-2)
	r5	b0 b1 			-- (low  high)
	r6	a0 a1
	i0 reads the coeficients into the registers; 
		it loops every 32 bytes (16 coef, 4 biquads)
	i1 reads the delays. 
		it loops every 640 bytes = 10 delays * 4 bytes/delay * 16 stereo channels.
		only increments. 
	i2 writes the delays, loops every 640 bytes. 
		also only increments. 
		if i1 and i2 are dereferenced in the same cycle, the processor will stall -- 
		each of the 1k SRAM memory banks has only one port. 
	format of delays in memory: 
	[x1(n-1) , 
	 x1(n-2) ,  
	 x2(n-1) aka y1(n-1) , 
	 x2(n-2) aka y1(n-2) , 
	 x3(n-1) aka y2(n-1) , 
	 x3(n-2) aka y2(n-2) , 
	 x4(n-1) aka y3(n-1) , 
	 x4(n-2) aka y3(n-2) , 
	 y4(n-1) , 
	 y4(n-2) ] 
	 --that's 10 delays, 4 bytes each. 
	r5 = [i0++] || r1 = [i1++]; 
	a0 = r0.l * r5.l , a1 = r0.h * r5.l || r6 = [i0++] ||  [i2++] = r0; 
	a0 += r1.l * r5.h, a1 += r1.h * r5.h || r2 = [i1++] ; 
	a0 += r2.l * r5.l, a1 += r2.h * r5.l || r3 = [i1++] ; 
	a0 += r3.l * r6.l, a1 += r3.h * r6.l || r4 = [i1++] ;
	r0.l = (a0 += r4.l * r6.h), r0.h = (a1 += r4.h * r6.h) (s2rnd) || [i2++] = r1;
	r5 = [i0++] || [i2++] = r0; 
	a0 = r0.l * r5.l, a1 += r0.h * r5.l || r6 = [i0++] || [i2++] = r3; 
	a0 += r3.l * r5.h, a1 += r3.h * r5.h || r1 = [i1++]; 
	a0 += r4.l * r5.l, a1 += r4.h * r5.l || r2 = [i1++]; 
	a0 += r1.l * r6.l, a1 += r1.h * r6.l; 
	r0.l = (a0 += r2.l * r6.h), r0.h = (a1 += r2.h * r6.h) (s2rnd); 
	r5 = [i0++] || [i2++] = r0; 
	a0 = r0.l * r5.l, a1 = r0.h * r5.l || r6 = [i0++] || [i2++] = r1; 
	a0 += r1.l * r5.h, a1 += r1.h * r5.h || r3 = [i1++]; 
	a0 += r2.l * r5.l, a1 += r2.h * r5.l || r4 = [i1++]; 
	a0 += r3.l * r6.l, a1 += r3.h * r6.l; 
	r0.l = (a0 += r4.l * r6.h), r0.h = (a1 += r4.h * r6.h) (s2rnd); 
	r5 = [i0++] || [i2++] = r0; 
	a0 = r0.l * r5.l, a1 += r0.h * r5.l || r6 = [i0++] || [i2++] = r3; 
	a0 += r3.l * r5.h, a1 += r3.h * r5.h || r1 = [i1++]; 
	a0 += r4.l * r5.l, a1 += r4.h * r5.l || r2 = [i1++]; 
	a0 += r1.l * r6.l, a1 += r1.h * r6.l; 
	r0.l = (a0 += r2.l * r6.h), r0.h = (a1 += r2.h * r6.h) (s2rnd); 
	[i2++] = r0; //save the delays. 
	[i2++] = r1; //normally this would be pipelined.

hide / / print
ref: notes-0 tags: spike patterns neural response LGN spike_timing Sejnowski vision date: 0-0-2006 0:0 revision:0 [head]


  • quote: " when a cortical neuron is repeatedly injected with the same fluctuating current stimulus, the timing of the spikes is highly precise from trial to trial and the spike pattern appears to be unique"
    • though: I'd imagine that somebody has characterized the actual transfer function of this.
  • mais: we conclude that the prestimulus history of a neuron may influence the precise timing of the spikes in repsonse to a stimulus over a wide range of time scales.
  • in vivo, it is hard to find patterns because neurons may jump between paterns & there is a large ammount of neuronal noise in there too. or there may be neural "attractors".
  • they observed long-term (seconds) firing patterns in cat LGN (interesting)

hide / / print
ref: notes-0 tags: praxis movement vision date: 0-0-2006 0:0 revision:0 [head]

  • praxis is the ability to plan and sequence unfamiliar actions.
  • things are only remembered when they produce motor output.
  • if you put an eye patch over one eye in a 2-year old human for two weeks, the child's vision in that eye will be permanently impared.
  • movement stimulates creativity.

hide / / print
ref: bookmark-0 tags: poisson tutorial ISI date: 0-0-2006 0:0 revision:0 [head]

http://www.neuroscience.ucsf.edu/neurograd/courses/ns201b_2004/Miller/03-12-04_PoissonProcess.pdf http://robotics.caltech.edu/~zoran/Research/poisson/node1.html