# 2010/spike10: plotloadaecochams1b.m

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

Line | |
---|---|

1 | function 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 | |

18 | addrmask=hex2dec('00FC'); % |

19 | neuronmask=hex2dec('0300'); % |

20 | |

21 | |

22 | sosbpfid=double(bitand(allAddr,1)); %first bit, TX0 |

23 | indsos=find(sosbpfid==1); |

24 | indbpf=find(sosbpfid==0); |

25 | leftrightid=double(bitshift((bitand(allAddr,2)), -1)); %TX1 |

26 | indleft=find(leftrightid==0); |

27 | indright=find(leftrightid==1); |

28 | addr=double(bitshift((bitand(allAddr, addrmask)), -2)); %shift by 2 |

29 | neuronY=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 | |

35 | aeleft=addr(indleft); neuronleft= neuronY(indleft); tsleft=allTsd(indleft); %ae(:,indc); |

36 | aeright=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; |

43 | if ((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=[]; |

60 | lengthl=length(aeleft); |

61 | for i=1:lengthl |

62 | laddress(i)=aeleft(i)*4+neuronleft(i); |

63 | end |

64 | |

65 | %%look for indices where neuronleft=0 |

66 | indleftY0=find(neuronleft==0); |

67 | laddressinteger=laddress(indleftY0); |

68 | tsleftinteger=tsleft(indleftY0); |

69 | |

70 | |

71 | %right channel, take addr * 4 then add neuronY |

72 | raddress=[]; |

73 | lengthr=length(aeright); |

74 | for i=1:lengthr |

75 | raddress(i)=aeright(i)*4+neuronright(i); |

76 | end |

77 | |

78 | %%look for indices where neuronright=0 |

79 | |

80 | indrightY0=find(neuronright==0); |

81 | raddressinteger=raddress(indrightY0); |

82 | tsrightinteger=tsright(indrightY0); |

83 | |

84 | offset=64*4; %64 channels by 4 neurons |

85 | %%%PLOT COCHLEA SPIKES |

86 | figure |

87 | cla; |

88 | hold off |

89 | plot (tsleft, laddress, '.', 'MarkerSize', 10, 'Color', [0.6 0 0]) |

90 | hold on |

91 | plot (tsleftinteger, laddressinteger, '.', 'MarkerSize', 10, 'Color', [0.6 0.6 0.6]) |

92 | hold on |

93 | |

94 | plot (tsright, raddress+offset, '.', 'MarkerSize', 10, 'Color', [0 0.6 0]) |

95 | hold on |

96 | plot (tsrightinteger,raddressinteger+offset, '.', 'MarkerSize', 10, 'Color', [0.6 0.6 0.6]) |

97 | hold off |

98 | |

99 | %xlim ([0 Time]); |

100 | % ylim ([0 33]); |

101 | end |

102 | |

103 | |

104 | |

105 | |

106 | |

107 |