2010/spike10: plotloadaecochams1b.m

File plotloadaecochams1b.m, 3.3 KB (added by shih, 8 years ago)

File for converting jaer files to cochlea addresses

Line 
1function plotloadaecochams1b(allTs, allAddr)
2%function [tsleft, laddress, tsright, raddress]=plotloadaecochams1b(allTs, allAddr)
3%function [tsl laddr tsr raddr]=plotloadaedatret64cochaerb(allTs, allAddr)
4% plots spikes from cochleaams1b from a 64 channel binaural cochlea,
5%each channel has 2 banks of neurons, one from SOS, one from bpf output of SOS
6%Lower 8 bits for TX and higher 8 bits for TY, only 2 bits of 8 used for TY
7%TX0 specifies sos (1) or bpf (0) output, %TX1 specifies left (0) or right (1) cochlea
8%TX2 to TX7 specifies channel number of cochlea, Channel 0 is hi freq, Channel 63 is low frequency
9%TY bits specify one of 4 neurons with range of VTs
10%timestamps from allTs are in microseconds
11%    pause(dur*1e-6);
12%splits data into left and right cochleas
13%    addr=ae(1,:);
14%
15% Compute cross-correlogram
16 %      aeCochleaRetCorr(tl,laddr,tr,raddr)
17
18addrmask=hex2dec('00FC'); %
19neuronmask=hex2dec('0300'); %
20
21
22sosbpfid=double(bitand(allAddr,1)); %first bit, TX0
23indsos=find(sosbpfid==1);
24indbpf=find(sosbpfid==0);
25leftrightid=double(bitshift((bitand(allAddr,2)), -1));  %TX1
26indleft=find(leftrightid==0);
27indright=find(leftrightid==1);
28addr=double(bitshift((bitand(allAddr, addrmask)), -2)); %shift by 2
29neuronY=double(bitshift((bitand(allAddr, neuronmask)), -8)); %shift by 8, TY0,1
30
31%FIND RIGHT AND LEFT COCHLEA ADDR AND TIMESTAMPS
32  %NOTE, SOS and BPF index not used
33  allTsd=double(allTs-allTs(1))/1e6;
34
35aeleft=addr(indleft);  neuronleft= neuronY(indleft); tsleft=allTsd(indleft); %ae(:,indc);
36aeright=addr(indright);  neuronright=neuronY(indright); tsright=allTsd(indright);
37
38
39    %plot cochlea
40
41%    aec = bitand (aec, 63);
42%    aec(1,:) = bitand (aec(1,:), 63); %    ts = double(aec(2,:))/1E3;
43if ((length(tsleft)>0) | (length(tsright)>0))
44
45%        address = double(aec)+0.1;
46%        maddress=double(aec);
47%        lchans = find(address<32);
48%        laddress = address(lchans);
49%        laddr = maddress(lchans);
50%        tl=[];  tr=[];
51
52%        tl = tsc(lchans);
53%        rchans = find(address>32);
54%        raddress = address(rchans)-32.1; %31.8
55%        tr = tsc(rchans);
56%        raddr = maddress(rchans)-32;
57
58%left channel, take addr * 4 then add neuronY
59                   laddress=[];
60lengthl=length(aeleft);
61for i=1:lengthl
62        laddress(i)=aeleft(i)*4+neuronleft(i);
63end
64
65%%look for indices where neuronleft=0
66indleftY0=find(neuronleft==0);
67laddressinteger=laddress(indleftY0);
68tsleftinteger=tsleft(indleftY0);
69
70
71%right channel, take addr * 4 then add neuronY
72 raddress=[];
73lengthr=length(aeright);
74for i=1:lengthr
75        raddress(i)=aeright(i)*4+neuronright(i);
76end
77
78%%look for indices where neuronright=0
79
80indrightY0=find(neuronright==0);
81raddressinteger=raddress(indrightY0);
82tsrightinteger=tsright(indrightY0);
83
84offset=64*4; %64 channels by 4 neurons
85%%%PLOT COCHLEA SPIKES
86    figure
87           cla;
88hold off
89plot (tsleft, laddress, '.', 'MarkerSize', 10, 'Color', [0.6 0 0])
90hold on
91plot (tsleftinteger, laddressinteger, '.', 'MarkerSize', 10, 'Color', [0.6 0.6 0.6])
92hold on
93
94plot (tsright, raddress+offset, '.', 'MarkerSize', 10, 'Color', [0 0.6 0])
95hold on
96plot (tsrightinteger,raddressinteger+offset, '.', 'MarkerSize', 10, 'Color', [0.6 0.6 0.6])
97hold off
98
99            %xlim ([0 Time]);
100%            ylim ([0 33]);
101       end
102
103
104
105   
106
107