Browse Source

gin upload from Dell-XPS-13-Samuel

New files: 21
Samuel Garcia 6 years ago
parent
commit
a9da573b7d

+ 14 - 0
blackrock/FileSpec2.3.txt

@@ -0,0 +1,14 @@
+Raw recording on Channels 1-8
+Spike signal on Odd Channels (1-7)
+
+Recording on Analong Inputs 1 and 2
+Signal on Analog Input 2
+
+Three Comments Approximately 10 Seconds Apart
+
+Intermittent and Randomized Digital Signal
+
+No Serial Data
+
+No Tracking Data
+

File diff suppressed because it is too large
+ 124661 - 0
blackrock/FileSpec2.3001.ccf


BIN
blackrock/FileSpec2.3001.mat


BIN
blackrock/FileSpec2.3001.nev


+ 1 - 0
blackrock/FileSpec2.3001.ns5

@@ -0,0 +1 @@
+../.git/annex/objects/P3/q3/SHA256E-s18006983--35cf5ddafc340a4205fdf9534c235f8cea7a14d4a2da1399a0e9a1e8f9e0f05e.3001.ns5/SHA256E-s18006983--35cf5ddafc340a4205fdf9534c235f8cea7a14d4a2da1399a0e9a1e8f9e0f05e.3001.ns5

BIN
blackrock/blackrock_2_1/l101210-001-02.nev


BIN
blackrock/blackrock_2_1/l101210-001.mat


BIN
blackrock/blackrock_2_1/l101210-001.nev


BIN
blackrock/blackrock_2_1/l101210-001.ns2


+ 1 - 0
blackrock/blackrock_2_1/l101210-001.ns5

@@ -0,0 +1 @@
+../../.git/annex/objects/z5/5w/SHA256E-s20971616--401df6803498f8f32db69a6c0a197f18cc1bcfff3a6ea52b907b6a4a739eec65.ns5/SHA256E-s20971616--401df6803498f8f32db69a6c0a197f18cc1bcfff3a6ea52b907b6a4a739eec65.ns5

+ 1 - 0
blackrock/blackrock_2_1/l101210-001_nev-02_ns5.mat

@@ -0,0 +1 @@
+../../.git/annex/objects/zv/1v/SHA256E-s13988910--39f5efd6ecd8f397fe5ca78b7eb191a6bfec2816a6480ddd1a374cc7e6c3d982.mat/SHA256E-s13988910--39f5efd6ecd8f397fe5ca78b7eb191a6bfec2816a6480ddd1a374cc7e6c3d982.mat

+ 337 - 0
blackrock/blackrock_2_1/nev_-02_Units.txt

@@ -0,0 +1,337 @@
+contained units		- missing units compared to full size files
+1 / 0
+1 / 255
+2 / 0
+			- 2 / 255
+3 / 0
+3 / 1
+3 / 2
+3 / 255
+4 / 0
+4 / 255
+5 / 0
+5 / 1
+5 / 2
+5 / 3
+5 / 255
+6 / 0
+6 / 1
+6 / 255
+7 / 0
+7 / 1
+7 / 2
+7 / 255
+8 / 0
+8 / 1
+8 / 255
+9 / 0
+9 / 1
+9 / 255
+10 / 0
+10 / 1
+10 / 255
+11 / 0
+11 / 1
+11 / 2
+11 / 255
+12 / 0
+12 / 1
+12 / 255
+13 / 0
+13 / 1
+13 / 2
+13 / 3
+13 / 255
+14 / 0
+14 / 1
+14 / 2
+14 / 3
+14 / 255
+15 / 0
+15 / 1
+15 / 2
+15 / 255
+16 / 0
+16 / 1
+16 / 255
+17 / 0
+17 / 1
+17 / 255
+18 / 0
+18 / 1
+18 / 255
+19 / 0
+19 / 1
+19 / 255
+20 / 0
+20 / 1
+20 / 2
+20 / 255
+21 / 0
+21 / 255
+22 / 0
+22 / 1
+22 / 2
+22 / 255
+23 / 0
+23 / 1
+23 / 2
+23 / 3
+23 / 255
+24 / 0
+24 / 1
+24 / 2
+24 / 3
+24 / 255
+25 / 0
+25 / 1
+25 / 2
+25 / 3
+25 / 255
+26 / 0
+26 / 1
+26 / 255
+			- 27 / 0
+27 / 1
+			- 27 / 255
+28 / 0
+28 / 1
+28 / 255
+29 / 0
+29 / 255
+30 / 0
+30 / 1
+30 / 255
+31 / 0
+31 / 1
+31 / 255
+32 / 0
+32 / 1
+32 / 2
+32 / 3
+32 / 255
+33 / 0
+33 / 1
+33 / 255
+34 / 0
+34 / 1
+34 / 2
+34 / 3
+34 / 255
+35 / 0
+35 / 1
+			- 35 / 255
+36 / 0
+36 / 1
+36 / 2
+36 / 255
+37 / 0
+37 / 1
+37 / 255
+38 / 0
+38 / 1
+38 / 2
+38 / 255
+39 / 0
+39 / 1
+39 / 2
+39 / 3
+39 / 255
+40 / 0
+40 / 1
+40 / 255
+41 / 0
+41 / 1
+41 / 2
+41 / 255
+42 / 0
+42 / 1
+42 / 255
+43 / 0
+			- 43 / 255
+44 / 0
+44 / 1
+44 / 2
+44 / 255
+45 / 0
+45 / 1
+45 / 255
+46 / 0
+46 / 1
+46 / 2
+46 / 255
+47 / 0
+47 / 1
+47 / 255
+48 / 0
+48 / 1
+48 / 2
+			- 48 / 255
+49 / 0
+49 / 1
+49 / 255
+50 / 0
+50 / 255
+51 / 0
+51 / 1
+			- 51 / 255
+52 / 0
+52 / 1
+52 / 2
+52 / 3
+52 / 255
+53 / 0
+53 / 255
+54 / 0
+54 / 1
+54 / 2
+54 / 255
+55 / 0
+55 / 1
+55 / 255
+56 / 0
+56 / 1
+56 / 2
+			- 56 / 255
+57 / 0
+57 / 1
+			- 57 / 255
+58 / 0
+58 / 1
+			- 58 / 255
+59 / 0
+59 / 1
+59 / 255
+60 / 0
+60 / 1
+60 / 255
+61 / 0
+61 / 1
+61 / 2
+61 / 3
+			- 61 / 255
+62 / 0
+62 / 1
+62 / 255
+63 / 0
+63 / 1
+63 / 2
+63 / 255
+64 / 0
+64 / 1
+64 / 255
+65 / 0
+65 / 1
+65 / 255
+66 / 0
+66 / 1
+66 / 255
+67 / 0
+67 / 1
+67 / 255
+68 / 0
+68 / 1
+68 / 2
+68 / 3
+68 / 255
+69 / 0
+69 / 1
+69 / 255
+70 / 0
+70 / 1
+70 / 2
+70 / 255
+71 / 0
+71 / 1
+71 / 2
+71 / 3
+71 / 255
+72 / 0
+72 / 255
+73 / 0
+73 / 1
+73 / 255
+74 / 0
+74 / 1
+74 / 255
+75 / 0
+75 / 1
+75 / 2
+75 / 255
+76 / 0
+76 / 1
+76 / 2
+76 / 255
+77 / 0
+77 / 1
+77 / 2
+77 / 3
+77 / 255
+78 / 0
+78 / 1
+78 / 2
+78 / 255
+79 / 0
+79 / 255
+80 / 0
+80 / 1
+80 / 2
+80 / 3
+80 / 255
+81 / 0
+81 / 1
+81 / 255
+82 / 0
+82 / 1
+82 / 2
+82 / 255
+83 / 0
+83 / 1
+83 / 2
+83 / 255
+84 / 0
+84 / 1
+84 / 2
+84 / 255
+85 / 0
+85 / 1
+85 / 2
+85 / 255
+86 / 0
+86 / 1
+86 / 255
+87 / 0
+87 / 1
+			- 87 / 255
+88 / 0
+88 / 1
+88 / 255
+89 / 0
+89 / 1
+89 / 255
+90 / 0
+90 / 1
+90 / 2
+90 / 255
+91 / 0
+91 / 1
+91 / 2
+91 / 255
+92 / 0
+92 / 1
+92 / 255
+93 / 0
+93 / 1
+93 / 255
+94 / 0
+94 / 1
+94 / 2
+94 / 255
+95 / 0
+95 / 1
+95 / 2
+95 / 255
+96 / 0
+96 / 1
+96 / 2
+96 / 255

File diff suppressed because it is too large
+ 9025 - 0
blackrock/blackrock_2_1/nev_-02_data.txt


+ 231 - 0
blackrock/blackrock_2_1/nev_Units.txt

@@ -0,0 +1,231 @@
+contained units		- missing units compared to full size files
+1 / 0
+2 / 0
+3 / 0
+3 / 1
+4 / 0
+5 / 0
+5 / 1
+5 / 2
+5 / 3
+6 / 0
+6 / 1
+7 / 0
+7 / 1
+8 / 0
+			- 8 / 1
+8 / 2
+9 / 0
+9 / 1
+10 / 0
+10 / 1
+10 / 2
+11 / 0
+11 / 1
+11 / 2
+12 / 0
+12 / 1
+13 / 0
+13 / 1
+13 / 2
+13 / 3
+14 / 0
+14 / 1
+15 / 0
+15 / 1
+15 / 2
+16 / 0
+17 / 0			- 17 / 1 also missing in original files
+17 / 2
+18 / 0
+18 / 1
+19 / 0
+19 / 1
+20 / 0
+20 / 1
+20 / 2
+21 / 0
+22 / 0
+22 / 1
+22 / 2
+23 / 0
+23 / 1
+23 / 2
+23 / 3
+24 / 0
+24 / 1
+24 / 2
+25 / 0
+25 / 1
+25 / 2
+25 / 3
+26 / 0
+26 / 1
+27 / 0
+27 / 2
+28 / 0
+28 / 1
+			- 28 / 2
+29 / 0
+29 / 1
+29 / 2
+30 / 0
+31 / 0
+31 / 1
+32 / 0
+32 / 1
+33 / 0
+33 / 1
+34 / 0
+34 / 1
+34 / 2
+35 / 0
+35 / 1
+36 / 0
+36 / 1
+36 / 2
+37 / 0
+37 / 1
+			- 37 / 2
+38 / 0
+38 / 1
+38 / 2
+39 / 0
+39 / 1
+39 / 2
+40 / 0
+40 / 1
+			- 40 / 2
+			- 40 / 3
+41 / 0
+41 / 1
+42 / 0
+42 / 1
+43 / 0
+44 / 0
+44 / 1
+45 / 0
+45 / 1
+46 / 0
+46 / 1
+46 / 2
+47 / 0
+47 / 1
+48 / 0
+48 / 1
+48 / 2
+49 / 0
+49 / 1
+50 / 0
+51 / 0
+			- 51 / 1
+52 / 0
+52 / 1
+52 / 2
+53 / 0
+54 / 0
+54 / 1
+			- 54 / 2
+55 / 0
+55 / 1
+56 / 0
+56 / 1
+56 / 2
+57 / 0
+57 / 1
+57 / 2
+58 / 0
+			- 58 / 2
+58 / 2
+59 / 0
+59 / 1
+60 / 0
+			- 60 / 1
+60 / 2
+61 / 0
+61 / 1
+61 / 2
+62 / 0
+62 / 1
+62 / 2
+63 / 0
+63 / 1
+63 / 2
+64 / 0			- 64 / 1 also missing in original files
+64 / 2
+65 / 0
+66 / 0
+66 / 1
+67 / 0
+68 / 0
+68 / 1
+68 / 2
+69 / 0
+69 / 1
+70 / 0
+70 / 1
+70 / 2
+			- 70 / 3
+71 / 0
+71 / 1
+71 / 2
+72 / 0
+73 / 0
+73 / 1
+74 / 0
+74 / 1
+75 / 0
+75 / 1
+75 / 2
+76 / 0
+76 / 1
+76 / 2
+77 / 0
+77 / 1
+77 / 2
+78 / 0
+78 / 1
+78 / 2
+78 / 3
+79 / 0
+79 / 1
+80 / 0
+80 / 1
+80 / 2
+81 / 0
+81 / 1
+82 / 0
+82 / 1
+83 / 0
+83 / 2
+84 / 0
+84 / 1
+84 / 2
+			- 84 / 3
+85 / 0
+85 / 1
+86 / 0
+86 / 1
+87 / 0
+87 / 1
+			- 87 / 2
+88 / 0
+88 / 1
+89 / 0
+89 / 1
+90 / 0
+90 / 1
+91 / 0
+91 / 1
+92 / 0
+92 / 1
+93 / 0
+93 / 1
+94 / 0
+94 / 1
+95 / 0
+95 / 1
+95 / 2
+96 / 0
+96 / 1
+96 / 2)

File diff suppressed because it is too large
+ 7054 - 0
blackrock/blackrock_2_1/nev_data.txt


+ 53 - 0
blackrock/blackrock_2_1/ns2_data.txt

@@ -0,0 +1,53 @@
+ainp9
+[[ 20905.17773438]
+ [ 19074.06835938]
+ [ 16785.1796875 ]
+ ..., 
+ [ 36927.39453125]
+ [ 37537.765625  ]
+ [ 36622.2109375 ]] uV
+
+ainp10
+[[ 116122.9296875]
+ [ 113986.6328125]
+ [ 111850.3359375]
+ ..., 
+ [ 131534.765625 ]
+ [ 132602.921875 ]
+ [ 131687.359375 ]] uV
+
+ainp11
+[[ 17853.328125  ]
+ [ 16327.40234375]
+ [ 14038.51367188]
+ ..., 
+ [ 33875.54296875]
+ [ 34638.5078125 ]
+ [ 33875.54296875]] uV
+
+ainp12
+[[ 16785.1796875 ]
+ [ 14801.4765625 ]
+ [ 12512.58886719]
+ ..., 
+ [ 32959.98828125]
+ [ 33417.765625  ]
+ [ 32959.98828125]] uV
+
+ainp13
+[[ 24719.9921875 ]
+ [ 23041.47460938]
+ [ 20752.5859375 ]
+ ..., 
+ [ 48371.8359375 ]
+ [ 48982.20703125]
+ [ 47608.875     ]] uV
+
+ainp15
+[[ 1963713.5  ]
+ [ 1964323.875]
+ [ 1962035.   ]
+ ..., 
+ [ 1961424.625]
+ [ 1964476.375]
+ [ 1967070.5  ]] uV

+ 866 - 0
blackrock/blackrock_2_1/ns5_data.txt

@@ -0,0 +1,866 @@
+chan1
+[[  -7.]
+ [  -6.]
+ [ -12.]
+ ..., 
+ [-108.]
+ [-115.]
+ [-110.]] uV
+
+chan2
+[[ 6698.]
+ [ 6698.]
+ [ 6698.]
+ ..., 
+ [ 7116.]
+ [ 7116.]
+ [ 7116.]] uV
+
+
+chan3
+[[ -20.]
+ [ -22.]
+ [ -21.]
+ ..., 
+ [-125.]
+ [-126.]
+ [-124.]] uV
+
+
+chan4
+[[-183.]
+ [-188.]
+ [-198.]
+ ..., 
+ [ -78.]
+ [ -74.]
+ [ -72.]] uV
+
+
+chan5
+[[   6.]
+ [   9.]
+ [   2.]
+ ..., 
+ [-126.]
+ [-138.]
+ [-142.]] uV
+
+chan6
+[[  35.]
+ [  37.]
+ [  35.]
+ ..., 
+ [-118.]
+ [-122.]
+ [-124.]] uV
+
+chan7
+[[  31.]
+ [  36.]
+ [  28.]
+ ..., 
+ [-112.]
+ [-119.]
+ [-114.]] uV
+
+chan8
+[[  13.]
+ [  10.]
+ [   6.]
+ ..., 
+ [-157.]
+ [-156.]
+ [-165.]] uV
+
+chan9
+[[ -21.]
+ [ -26.]
+ [ -30.]
+ ..., 
+ [ -97.]
+ [ -98.]
+ [-102.]] uV
+
+chan10
+[[  56.]
+ [  53.]
+ [  39.]
+ ..., 
+ [-129.]
+ [-132.]
+ [-129.]] uV
+
+chan11
+[[ -15.]
+ [  -8.]
+ [ -13.]
+ ..., 
+ [-133.]
+ [-139.]
+ [-131.]] uV
+
+chan12
+[[  37.]
+ [  30.]
+ [  26.]
+ ..., 
+ [-129.]
+ [-130.]
+ [-124.]] uV
+
+chan13
+[[ -25.]
+ [ -35.]
+ [ -37.]
+ ..., 
+ [-176.]
+ [-179.]
+ [-179.]] uV
+
+chan14
+[[  45.]
+ [  34.]
+ [  21.]
+ ..., 
+ [-104.]
+ [-109.]
+ [-107.]] uV
+
+chan15
+[[  45.]
+ [  45.]
+ [  29.]
+ ..., 
+ [-134.]
+ [-128.]
+ [-128.]] uV
+
+chan16
+[[   0.]
+ [  -2.]
+ [  -9.]
+ ..., 
+ [-102.]
+ [-103.]
+ [ -98.]] uV
+
+chan17
+[[ -37.]
+ [ -45.]
+ [ -47.]
+ ..., 
+ [-115.]
+ [-116.]
+ [-101.]] uV
+
+chan18
+[[ 55.]
+ [ 51.]
+ [ 41.]
+ ..., 
+ [-85.]
+ [-78.]
+ [-78.]] uV
+
+chan19
+[[  39.]
+ [  37.]
+ [  30.]
+ ..., 
+ [-136.]
+ [-131.]
+ [-122.]] uV
+
+chan20
+[[   2.]
+ [ -14.]
+ [ -18.]
+ ..., 
+ [-169.]
+ [-169.]
+ [-152.]] uV
+
+chan21
+[[ -24.]
+ [ -23.]
+ [ -33.]
+ ..., 
+ [-131.]
+ [-118.]
+ [-109.]] uV
+
+chan22
+[[ 396.]
+ [ 396.]
+ [ 397.]
+ ..., 
+ [ 195.]
+ [ 195.]
+ [ 194.]] uV
+
+chan23
+[[   0.]
+ [ -26.]
+ [ -42.]
+ ..., 
+ [-162.]
+ [-167.]
+ [-162.]] uV
+
+chan24
+[[ 29.]
+ [ 21.]
+ [ 20.]
+ ..., 
+ [-92.]
+ [-97.]
+ [-98.]] uV
+
+chan25
+[[  37.]
+ [  43.]
+ [  32.]
+ ..., 
+ [-213.]
+ [-210.]
+ [-201.]] uV
+
+chan26
+[[ 50.]
+ [ 52.]
+ [ 38.]
+ ..., 
+ [-91.]
+ [-97.]
+ [-98.]] uV
+
+chan27
+[[  17.]
+ [   3.]
+ [  -9.]
+ ..., 
+ [-137.]
+ [-147.]
+ [-145.]] uV
+
+chan28
+[[  20.]
+ [  17.]
+ [  13.]
+ ..., 
+ [-148.]
+ [-145.]
+ [-136.]] uV
+
+chan29
+[[ 29.]
+ [  5.]
+ [-26.]
+ ..., 
+ [-33.]
+ [ 12.]
+ [ 13.]] uV
+
+chan30
+[[ 36.]
+ [ 36.]
+ [ 35.]
+ ..., 
+ [-94.]
+ [-92.]
+ [-95.]] uV
+
+chan31
+[[  27.]
+ [  32.]
+ [  30.]
+ ..., 
+ [-126.]
+ [-132.]
+ [-127.]] uV
+
+chan32
+[[  24.]
+ [  17.]
+ [   2.]
+ ..., 
+ [-100.]
+ [-104.]
+ [ -99.]] uV
+
+chan33
+[[  7.]
+ [  6.]
+ [  0.]
+ ..., 
+ [-68.]
+ [-67.]
+ [-64.]] uV
+
+chan34
+[[   1.]
+ [   1.]
+ [   1.]
+ ..., 
+ [ -98.]
+ [-103.]
+ [-100.]] uV
+
+chan35
+[[ 14.]
+ [ 11.]
+ [  0.]
+ ..., 
+ [-88.]
+ [-85.]
+ [-83.]] uV
+
+chan36
+[[ -18.]
+ [ -32.]
+ [ -38.]
+ ..., 
+ [-117.]
+ [-116.]
+ [-108.]] uV
+
+chan37
+[[  21.]
+ [  13.]
+ [   4.]
+ ..., 
+ [-126.]
+ [-121.]
+ [-119.]] uV
+
+chan38
+[[  -4.]
+ [  -8.]
+ [ -16.]
+ ..., 
+ [-149.]
+ [-144.]
+ [-144.]] uV
+
+chan39
+[[ -13.]
+ [ -20.]
+ [ -28.]
+ ..., 
+ [-116.]
+ [-111.]
+ [-119.]] uV
+
+chan40
+[[  10.]
+ [   3.]
+ [  -1.]
+ ..., 
+ [-136.]
+ [-137.]
+ [-134.]] uV
+
+chan41
+[[  18.]
+ [   8.]
+ [   2.]
+ ..., 
+ [-104.]
+ [-100.]
+ [ -94.]] uV
+
+chan42
+[[ -2.]
+ [-20.]
+ [-29.]
+ ..., 
+ [-78.]
+ [-81.]
+ [-81.]] uV
+
+chan43
+[[ 31.]
+ [ 27.]
+ [ 13.]
+ ..., 
+ [-10.]
+ [  5.]
+ [ -6.]] uV
+
+chan44
+[[-20.]
+ [-29.]
+ [-38.]
+ ..., 
+ [-42.]
+ [-37.]
+ [-39.]] uV
+
+chan45
+[[  18.]
+ [  36.]
+ [  17.]
+ ..., 
+ [-105.]
+ [-109.]
+ [ -96.]] uV
+
+chan46
+[[  33.]
+ [  31.]
+ [  25.]
+ ..., 
+ [-104.]
+ [ -98.]
+ [ -90.]] uV
+
+chan47
+[[  20.]
+ [  13.]
+ [  13.]
+ ..., 
+ [-101.]
+ [ -96.]
+ [ -90.]] uV
+
+chan48
+[[   6.]
+ [   0.]
+ [  -4.]
+ ..., 
+ [-134.]
+ [-142.]
+ [-133.]] uV
+
+chan49
+[[ 32.]
+ [ 35.]
+ [ 27.]
+ ..., 
+ [-12.]
+ [ -7.]
+ [-31.]] uV
+
+chan50
+[[  11.]
+ [  17.]
+ [   5.]
+ ..., 
+ [-116.]
+ [-119.]
+ [-125.]] uV
+
+chan51
+[[  34.]
+ [  43.]
+ [  46.]
+ ..., 
+ [-108.]
+ [-106.]
+ [-100.]] uV
+
+chan52
+[[  46.]
+ [  47.]
+ [  45.]
+ ..., 
+ [-118.]
+ [-111.]
+ [-104.]] uV
+
+chan53
+[[ 10.]
+ [ 15.]
+ [ 12.]
+ ..., 
+ [-53.]
+ [-45.]
+ [-49.]] uV
+
+chan54
+[[  34.]
+ [  30.]
+ [  22.]
+ ..., 
+ [-166.]
+ [-158.]
+ [-158.]] uV
+
+chan55
+[[ 26.]
+ [ 25.]
+ [ 16.]
+ ..., 
+ [-79.]
+ [-81.]
+ [-78.]] uV
+
+chan56
+[[   9.]
+ [  10.]
+ [   4.]
+ ..., 
+ [-138.]
+ [-131.]
+ [-123.]] uV
+
+chan57
+[[ -11.]
+ [ -10.]
+ [ -14.]
+ ..., 
+ [-116.]
+ [-121.]
+ [-116.]] uV
+
+chan58
+[[  -3.]
+ [  -2.]
+ [ -10.]
+ ..., 
+ [-178.]
+ [-149.]
+ [-142.]] uV
+
+chan59
+[[  14.]
+ [  11.]
+ [  -2.]
+ ..., 
+ [-102.]
+ [ -95.]
+ [ -98.]] uV
+
+chan60
+[[ 60.]
+ [ 76.]
+ [ 83.]
+ ..., 
+ [ 48.]
+ [ 55.]
+ [ 46.]] uV
+
+chan61
+[[  26.]
+ [  29.]
+ [  32.]
+ ..., 
+ [ -92.]
+ [-101.]
+ [-109.]] uV
+
+chan62
+[[  46.]
+ [  39.]
+ [  26.]
+ ..., 
+ [-137.]
+ [-136.]
+ [-133.]] uV
+
+chan63
+[[   5.]
+ [   5.]
+ [  -4.]
+ ..., 
+ [-129.]
+ [-128.]
+ [-128.]] uV
+
+chan64
+[[  34.]
+ [  31.]
+ [  23.]
+ ..., 
+ [-122.]
+ [-128.]
+ [-124.]] uV
+
+chan65
+[[  34.]
+ [  31.]
+ [  28.]
+ ..., 
+ [-156.]
+ [-160.]
+ [-165.]] uV
+
+chan66
+[[ -2.]
+ [ -1.]
+ [ -1.]
+ ..., 
+ [-98.]
+ [-94.]
+ [-94.]] uV
+
+chan67
+[[ 25.]
+ [ 24.]
+ [ 25.]
+ ..., 
+ [-99.]
+ [-95.]
+ [-97.]] uV
+
+chan68
+[[-11.]
+ [-13.]
+ [-18.]
+ ..., 
+ [-83.]
+ [-88.]
+ [-95.]] uV
+
+chan69
+[[ 15.]
+ [ 20.]
+ [ 16.]
+ ..., 
+ [-66.]
+ [-56.]
+ [-51.]] uV
+
+chan70
+[[ 10.]
+ [  9.]
+ [ -1.]
+ ..., 
+ [-77.]
+ [-82.]
+ [-86.]] uV
+
+chan71
+[[  3.]
+ [ -3.]
+ [-14.]
+ ..., 
+ [-79.]
+ [-79.]
+ [-80.]] uV
+
+chan72
+[[ 40.]
+ [ 50.]
+ [ 57.]
+ ..., 
+ [ 27.]
+ [ 35.]
+ [ 31.]] uV
+
+chan73
+[[ -7.]
+ [ -4.]
+ [ -5.]
+ ..., 
+ [-99.]
+ [-98.]
+ [-91.]] uV
+
+chan74
+[[ 48.]
+ [ 51.]
+ [ 47.]
+ ..., 
+ [-87.]
+ [-79.]
+ [-68.]] uV
+
+chan75
+[[  4.]
+ [  1.]
+ [-12.]
+ ..., 
+ [-92.]
+ [-95.]
+ [-91.]] uV
+
+chan76
+[[   1.]
+ [  -9.]
+ [ -15.]
+ ..., 
+ [-124.]
+ [-123.]
+ [-116.]] uV
+
+chan77
+[[  -3.]
+ [ -10.]
+ [ -18.]
+ ..., 
+ [-106.]
+ [-104.]
+ [-100.]] uV
+
+chan78
+[[-15.]
+ [-23.]
+ [-32.]
+ ..., 
+ [-91.]
+ [-87.]
+ [-72.]] uV
+
+chan79
+[[-10.]
+ [ -7.]
+ [ -8.]
+ ..., 
+ [-87.]
+ [-87.]
+ [-86.]] uV
+
+chan80
+[[ 25.]
+ [ 24.]
+ [ 18.]
+ ..., 
+ [-81.]
+ [-81.]
+ [-77.]] uV
+
+chan81
+[[ -39.]
+ [ -38.]
+ [ -47.]
+ ..., 
+ [-108.]
+ [-107.]
+ [-104.]] uV
+
+chan82
+[[  4.]
+ [  3.]
+ [ -8.]
+ ..., 
+ [-47.]
+ [-38.]
+ [-37.]] uV
+
+chan83
+[[  -6.]
+ [ -15.]
+ [ -29.]
+ ..., 
+ [-101.]
+ [-101.]
+ [ -91.]] uV
+
+chan84
+[[-21.]
+ [-27.]
+ [-41.]
+ ..., 
+ [-68.]
+ [-71.]
+ [-71.]] uV
+
+chan85
+[[ -18.]
+ [ -18.]
+ [ -23.]
+ ..., 
+ [-106.]
+ [ -98.]
+ [ -89.]] uV
+
+chan86
+[[ 22.]
+ [ 23.]
+ [ 10.]
+ ..., 
+ [-80.]
+ [-78.]
+ [-76.]] uV
+
+chan87
+[[ 16.]
+ [ 16.]
+ [ 15.]
+ ..., 
+ [-69.]
+ [-59.]
+ [-57.]] uV
+
+chan88
+[[  10.]
+ [   9.]
+ [   3.]
+ ..., 
+ [-107.]
+ [-101.]
+ [ -91.]] uV
+
+chan89
+[[ 87.]
+ [ 86.]
+ [ 76.]
+ ..., 
+ [-95.]
+ [-95.]
+ [-85.]] uV
+
+chan90
+[[  33.]
+ [  32.]
+ [  22.]
+ ..., 
+ [-107.]
+ [-104.]
+ [ -97.]] uV
+
+chan91
+[[   9.]
+ [   5.]
+ [   0.]
+ ..., 
+ [-142.]
+ [-133.]
+ [-123.]] uV
+
+chan92
+[[  -4.]
+ [  -5.]
+ [  -5.]
+ ..., 
+ [-114.]
+ [-115.]
+ [-104.]] uV
+
+chan93
+[[  25.]
+ [  25.]
+ [  27.]
+ ..., 
+ [-166.]
+ [-160.]
+ [-149.]] uV
+
+chan94
+[[   6.]
+ [   5.]
+ [  -6.]
+ ..., 
+ [-101.]
+ [ -95.]
+ [ -95.]] uV
+
+chan95
+[[  14.]
+ [   2.]
+ [  -1.]
+ ..., 
+ [-117.]
+ [-114.]
+ [-102.]] uV
+
+chan96
+[[  13.]
+ [  11.]
+ [   8.]
+ ..., 
+ [-106.]
+ [-104.]
+ [ -94.]] uV

+ 46 - 0
blackrock/matlab/create_data_matlab_blackrock.m

@@ -0,0 +1,46 @@
+%This script creates a mat file with spikes and LFP channels 1-8 of one
+%data set supplied by Blackrock Microsystems that conforms to File
+%Specification 2.3.
+%
+%The matlab code for loading data was originally provided through Blackrock
+%Microsystems and was slightly modified.
+%TODO: Update to newer versions of matlab file loaders provided by Blackrock.
+%
+%The result FileSpec2.3001.mat is used in the IO test :
+% test_compare_blackrockio_with_matlabloader_V23
+%
+%Contents of data file:
+%Raw recording on Channels 1-8
+%Spike signal on Odd Channels (1-7)
+%Recording on Analong Inputs 1 and 2
+%Signal on Analog Input 2
+%Three Comments Approximately 10 Seconds Apart
+%Intermittent and Randomized Digital Signal
+%No Serial Data
+%No Tracking Data
+
+
+openNEV('../FileSpec2.3001.nev','read','e:1','u:0','nosave','noparse');
+openNSx('../FileSpec2.3001.ns5','e:1:8','read');
+
+
+%get unit data
+ts=NEV.Data.Spikes.Timestamps;
+el=NEV.Data.Spikes.Electrode;
+un=NEV.Data.Spikes.Unit;
+wf=NEV.Data.Spikes.Waveform;
+
+%load LFP matrix
+lfp=NS5.Data;
+
+%select units on el. 1-7
+ts=ts(el>=1 & el<=7);
+un=un(el>=1 & el<=7);
+el=el(el>=1 & el<=7);
+
+%marker
+mts=NEV.Data.SerialDigitalIO.TimeStamp;
+mid=NEV.Data.SerialDigitalIO.UnparsedData;
+
+save('../FileSpec2.3001.mat','lfp','ts','el','un','wf','mts','mid');
+

+ 558 - 0
blackrock/matlab/openNEV.m

@@ -0,0 +1,558 @@
+function NEV = openNEV(varargin)
+
+%%
+% Opens an .nev file for reading, returns all file information in a NEV
+% structure. Works with File Spec 2.1 & 2.2.
+% This version reads only waveforms of a specified list of neuron IDs.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
+% Use OUTPUT = openNEV(fname,  'read', 'wave_elec', 'wave_unit', 'report', 'noparse', 'nowarning', 'precision').
+% 
+% All input arguments are optional. Input arguments can be in any order.
+%
+%   fname:        Name of the file to be opened. If the fname is omitted
+%                 the user will be prompted to select a file using an open 
+%                 file user interface. 
+%                 DEFAULT: Will open Open File UI.
+%
+%   'read':       Will read the waveform data if user passes this argument.
+%                 The field .Data.Spikes.WaveformIndices contains the index
+%                 of each waveform i in .Data.Spikes.Waveform(i,:) into
+%                 arrays such as, e.g., .Data.Spikes.Electrode (useful when
+%                 selecting only sets of electrodes/units using 'wave_unit'
+%                 and 'wave_elec').
+%                 DEFAULT: will not read data.
+%
+%   'wave_unit':  User can specify which units are used to read spike 
+%                 waveforms (option "read"). The units can be selected
+%                 either by specifying a range (e.g. 1:3) or by indicating
+%                 individual units (e.g. 1,2,4) or both. This field needs
+%                 to be followed by the prefix 'u:'. See example for more
+%                 details.
+%                 DEFAULT: will read all existing units.
+%
+%   'wave_elec':  User can specify which electrodes are used to read spike 
+%                 waveforms (option "read"). The number of electrodes can
+%                 be greater than or equal to 1 and less than or equal to
+%                 128. The electrodes can be selected either by specifying
+%                 a range (e.g. 20:45) or by indicating individual
+%                 electrodes (e.g. 3,6,7,90) or both. This field needs to
+%                 be followed by the prefix 'e:'. See example for more
+%                 details. 
+%                 DEFAULT: will read from all existing channels.
+%
+%   'report':     Will show a summary report if user passes this argument.
+%                 DEFAULT: will not show report.
+%
+%   'noparse':    The code will not parse the experimental parameters.
+%                 See below for format.
+%                 DEFAULT: will parse the parameters.
+%
+%   'nowarning':  The code will not give a warning if there is an error in
+%                 parsing or several other actions.
+%                 DEFAULT: will give warning message.
+%
+%   'nosave':     The code will not save a copy of the NEV structure as a
+%                 MAT file. By default the code will save a copy in the
+%                 same folder as the NEV file for easy future access. If
+%                 "wave_elec" (e:) or "wave_unit" (u:) is specified, the
+%                 mat file is never saved! 
+%                 DEFAULT: will save the MAT file, unless e: or u: is 
+%                 specified.
+%
+%   'nomat':      Will not look for a MAT file. This option will force
+%                 openNEV to open a NEV file instead of any available MAT
+%                 files. If "wave_elec" (e:) or "wave_unit" (u:) is
+%                 specified, the mat file is never loaded! 
+%                 DEFAULT: will load the MAT file if available, unless e: 
+%                 or u: is specified.
+%
+%   'compact':    If specified the spike data is stored in 'int16' type 
+%                 instead of default double precision.
+%
+%   OUTPUT:       Contains the NEV structure.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%   USAGE EXAMPLE: 
+%   
+%   openNEV('report','read','c:\data\sample.nev','u:1','e:80');
+%
+%   In the example above, the file c:\data\sample.nev will be used. A
+%   report of the file contents will be shown. The digital data will be
+%   parsed. The data needs to be in the proper format (refer below). The
+%   waveforms of unit 1 on electrode 80 is also stored in the resulting
+%   structure.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%   DIGITAL PARAMETERS/MARKERS FORMAT:
+%
+%   The experimental parameters need to be in the following format for the
+%   code to properly parse them:
+%
+%   *Label:Parameter1=value1;Parameter2=value2;Parameter3=value3;#
+%
+%   EXAMPLES:
+%   *ExpParameter:Intensity=1.02;Duration=400;Trials=1;PageSegment=14;#
+%   *Stimulation:StimCount=5;Duration=10;#
+%
+%   The above line is an "ExpParameter". The parameters are, "Intensity,
+%   Duration, Trials, and PageSement." The values of those parameters are,
+%   respectively, "1.02, 400, 1, and 14." The second example is a 
+%   "Stimulation". The name of the parameters are "StimCount" and
+%   "Duration" and the values are "5" and "10" respectively.
+%
+%   It can also read single value markers that follow the following format.
+%
+%   *MarkerName=Value;#
+%
+%   EXAMPLE:
+%   *WaitSeconds=10;# OR
+%   *JuiceStatus=ON;#
+%
+%   The above line is a "Marker". The marker value is 10 in the first 
+%   and it's ON in the second example.
+%
+%   The label, parameter name, and values are flexible and can be anything.
+%   The only required formatting is that the user needs to have a label
+%   followed by a colon ':', followed by a field name 'MarkerVal', followed
+%   by an equal sign '=', followed by the parameter value '10', and end
+%   with a semi-colon ';'. 
+%
+%   NOTE:
+%   Every parameter requires a pound-sign '#' at the very end. 
+%   Every parameter requires a star sign '*' at the very beginning. If you
+%   use my LabVIEW SendtoCerebus VI then there is no need for a '*' in the
+%   beginning.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%   Kian Torab
+%   kian.torab@utah.edu
+%   Department of Bioengineering
+%   University of Utah
+%   Version 3.5.0 - March 22, 2010
+% 
+%   2010-06-28: - Added code for selecting only specific waveforms using the
+%                 directives "e:" and "u:". A further field 
+%                 .Data.Spikes.WaveformIndices was added to save the packet
+%                 indices of those waveforms that make up
+%                 .Data.Spikes.Waveform. A few clear statements have been
+%                 removed/moved to enable this functionality -- this should
+%                 not cause siginificant memory problems (however, current
+%                 optimizations with "clear" are very quick-and-dirty 
+%                 anyhow, so there should be room for improvement/cleanup).
+%               - Changed default behavior to NOT read the matlab files or
+%                 write them if either e: or u: is supplied for obvious
+%                 readons.
+%               Author: Michael Denker
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+NEVver = '3.5.0'; % optimize for memory, supporting general usage
+disp(['openNEV version ' NEVver])
+
+    %%  Validating existance of parseCommand
+if exist('parseCommand.m', 'file') ~= 2
+    disp('This version of openNEV requires function parseCommand.m to be placed in path.');
+    return;
+end
+
+%% Defining structures
+NEV = struct('MetaTags',[],'IOLabels',[], 'ElectrodesInfo', [], 'Data',[]);
+NEV.MetaTags = struct('Subject', [], 'Experimenter', [], 'DateTime',[],...
+    'SampleRes',[],'Comment',[],'FileTypeID',[],'Flags',[]);
+NEV.Data = struct('SerialDigitalIO', [], 'Spikes', []);
+NEV.Data.Spikes = struct('Timestamps',[],'Electrode',[],...
+    'Unit',[],'Waveform',[]);
+NEV.Data.SerialDigitalIO = struct('InputType',[],'TimeStamp',[],...
+    'TimeStampSec',[],'Type',[],'Value',[]);
+
+Electrodes=[];
+Units=[];
+
+%% Validating input arguments
+for i=1:length(varargin)
+    if strncmp(varargin{i}, 'e:', 2)
+        Electrodes = str2num(varargin{i}(3:end)); %#ok<ST2NM>
+    elseif strncmp(varargin{i}, 'u:', 2)
+        Units = str2num(varargin{i}(3:end)); %#ok<ST2NM>
+    else
+        switch varargin{i}
+            case 'report'
+                Report = varargin{i};
+            case 'read'
+                ReadData = varargin{i};
+            case 'nosave'
+                SaveFile = varargin{i};
+            case 'nomat'
+                NoMAT = varargin{i};
+            case 'nowarning'
+                WarningStat = varargin{i};
+            case 'noparse'
+                ParseData = 'noparse';
+            case 'compact'
+                Compact = 'compact';
+                
+            otherwise
+                temp = varargin{i};
+                if length(temp)>3 && strcmpi(temp(end-3),'.')
+                    fname = varargin{i};
+                    if exist(fname, 'file') ~= 2
+                        disp('The file does not exist.');
+                        clear variables;
+                        if nargout; NEV = []; end;
+                        return;
+                    end
+                else
+                    if ~isnumeric(varargin{i})
+                        disp(['Invalid argument ''' varargin{i} ''' .']);
+                    else
+                        disp(['Invalid argument ''' num2str(varargin{i}) ''' .']);
+                    end
+                    clear variables;
+                    return;
+                end
+        end
+    end
+end
+
+%% Defining and validating variables
+if ~exist('fname', 'var')
+    [fname, fpath] = uigetfile('D:\Data\*.nev');
+else
+    [fpath,fname, fext] = fileparts(fname);
+    fname = [fname fext];
+    fpath = [fpath '/'];
+end
+if ~exist('Report', 'var'); Report = 'noreport'; end
+if ~exist('WarningStat', 'var'); WarningStat = 'warning'; end;
+if ~exist('ReadData', 'var'); ReadData = 'noread'; end
+if ~exist('ParseData', 'var'); ParseData = 'parse'; end
+if ~exist('SaveFile', 'var'); SaveFile = 'save'; end;
+if ~exist('NoMAT', 'var'); NoMAT = 'yesmat'; end;
+if ~exist('Compact', 'var'); Compact = 'non-compact'; end;
+if fname==0; clear variables; if nargout; NEV = []; end; disp('No file was selected.'); return; end;
+tic;
+matPath = [fpath fname(1:end-4) '.mat'];
+
+%if only part of the waveforms are read, do not load or save the MAT file.
+if (~isempty(Units) || ~isempty(Electrodes)) && (strcmp(NoMAT,'yesmat') || strcmp(SaveFile,'save') )
+    NoMAT='nomat';
+    SaveFile='nosave';
+    if strcmp(WarningStat,'warning')
+        disp('WARNING: Overriding and enabling nomat/nosave options, as electrodes (e:) and/or units (u:) was specified.');
+    end
+end
+
+%% Check for a MAT file and load that instead of NEV
+if exist(matPath, 'file') == 2 && strcmpi(NoMAT, 'yesmat')
+    disp('MAT file corresponding to selected NEV file already exists. Loading MAT instead...');
+    load(matPath);
+    if isempty(NEV.Data.Spikes.Waveform) && strcmpi(ReadData, 'read')
+        disp('The MAT file does not contain waveforms. Loading NEV instead...');
+    else
+        if ~nargout
+            assignin('base', 'NEV', NEV);
+            clear variables;
+        end
+        return;
+    end
+end
+
+%% Reading BasicHeader information from file
+FID                       = fopen([fpath fname], 'r', 'ieee-le');
+BasicHeader               = fread(FID, 336, '*uint8');
+NEV.MetaTags.FileTypeID   = char(BasicHeader(1:8)');
+fileSpec                  = num2str((BasicHeader(9:10)'));
+NEV.MetaTags.Flags        = dec2bin(typecast(BasicHeader(11:12), 'uint16'),16);
+fExtendedHeader           = double(typecast(BasicHeader(13:16), 'uint32'));
+PacketBytes               = double(typecast(BasicHeader(17:20), 'uint32'));
+TimeRes                   = double(typecast(BasicHeader(21:24), 'uint32'));
+NEV.MetaTags.SampleRes    = typecast(BasicHeader(25:28), 'uint32');
+t                         = typecast(BasicHeader(29:44), 'uint16');
+NEV.MetaTags.Comment      = char(BasicHeader(77:332)');
+NEV.MetaTags.Filename     = fname;
+ExtHeaderCount            = typecast(BasicHeader(333:336), 'uint32');
+if strcmpi(NEV.MetaTags.FileTypeID, 'NEURALEV') 
+    disp(['Current NEV Filespec: ' fileSpec]);
+    if exist([fpath fname(1:end-8) '.sif'], 'file') == 2
+        METATAGS = textread([fpath fname(1:end-8) '.sif'], '%s');
+        NEV.MetaTasg.Subject      = METATAGS{3}(5:end-5);
+        NEV.MetaTags.Experimenter = [METATAGS{5}(8:end-8) ' ' METATAGS{6}(7:end-7)];
+    end
+elseif strcmpi(fileSpec, '2  1')
+    disp('Current NEV Filespec: 2.1');
+else
+    disp('Unknown filespec. Cannot open file.')
+    clear variables;
+    return;
+end
+
+%% Parsing and validating FileSpec and DateTime variables
+NEV.MetaTags.DateTime = [num2str(t(2)) '/'  num2str(t(4)) '/' num2str(t(1))...
+    ' ' datestr(double(t(3)), 'dddd') ' ' num2str(t(5)) ':'  ...
+    num2str(t(6)) ':'  num2str(t(7)) '.' num2str(t(8))] ;
+
+%% Removing extra garbage characters from the Comment field.
+NEV.MetaTags.Comment(find(NEV.MetaTags.Comment==0,1):end) = 0;
+
+%% Recording after BasicHeader file position
+fBasicHeader = ftell(FID); %#ok<NASGU>
+
+%% Reading ExtendedHeader information
+for ii=1:ExtHeaderCount
+    ExtendedHeader = fread(FID, 32, '*uint8');
+    PacketID = char(ExtendedHeader(1:8)');
+    switch PacketID
+        case 'ARRAYNME'
+            NEV.ArrayInfo.ElectrodeName    = char(ExtendedHeader(9:end));
+        case 'ECOMMENT'
+            NEV.ArrayInfo.ArrayComment     = char(ExtendedHeader(9:end));
+        case 'CCOMMENT'
+            NEV.ArrayInfo.ArrayCommentCont = char(ExtendedHeader(9:end));
+        case 'MAPFILE'
+            NEV.ArrayInfo.MapFile          = char(ExtendedHeader(9:end));
+        case 'NEUEVWAV'
+            PacketID                       = typecast(ExtendedHeader(9:10), 'uint16');
+            NEV.ElectrodesInfo{PacketID, 1}.ElectrodeID     = PacketID;
+            NEV.ElectrodesInfo{PacketID, 1}.ConnectorBank   = char(ExtendedHeader(11)+64);
+            NEV.ElectrodesInfo{PacketID, 1}.ConnectorPin    = ExtendedHeader(12);
+            NEV.ElectrodesInfo{PacketID, 1}.DigitalFactor   = typecast(ExtendedHeader(13:14),'uint16');
+            NEV.ElectrodesInfo{PacketID, 1}.EnergyThreshold = typecast(ExtendedHeader(15:16),'uint16');
+            NEV.ElectrodesInfo{PacketID, 1}.HighThreshold   = typecast(ExtendedHeader(17:18),'int16');
+            NEV.ElectrodesInfo{PacketID, 1}.LowThreshold    = typecast(ExtendedHeader(19:20),'int16');
+            NEV.ElectrodesInfo{PacketID, 1}.Units           = ExtendedHeader(21);
+            NEV.ElectrodesInfo{PacketID, 1}.WaveformBytes   = ExtendedHeader(22);
+        case 'NEUEVLBL'
+            PacketID                       = typecast(ExtendedHeader(9:10), 'uint16');
+            NEV.ElectrodesInfo{PacketID, 1}.ElectrodeLabel = char(ExtendedHeader(11:26));
+        case 'NEUEVFLT'
+            PacketID                       = typecast(ExtendedHeader(9:10), 'uint16');
+            NEV.ElectrodesInfo{PacketID, 1}.HighFreqCorner = typecast(ExtendedHeader(11:14),'uint32');
+            NEV.ElectrodesInfo{PacketID, 1}.HighFreqOrder  = typecast(ExtendedHeader(15:18),'uint32');
+            NEV.ElectrodesInfo{PacketID, 1}.HighFilterType = typecast(ExtendedHeader(19:20),'uint16');
+            NEV.ElectrodesInfo{PacketID, 1}.LowFreqCorner  = typecast(ExtendedHeader(21:24),'uint32');
+            NEV.ElectrodesInfo{PacketID, 1}.LowFreqOrder   = typecast(ExtendedHeader(25:28),'uint32');
+            NEV.ElectrodesInfo{PacketID, 1}.LowFilterType  = typecast(ExtendedHeader(29:30),'uint16');
+        case 'DIGLABEL'
+            Label                                 = char(ExtendedHeader(9:24));
+            Mode                                  = ExtendedHeader(25);
+            NEV.IOLabels{Mode+1, 1} = Label;
+        case 'NSASEXEV' %% Not implemented in the Cerebus firmware. 
+                        %% Needs to be updated once implemented into the 
+                        %% firmware by Blackrock Microsystems.
+            NEV.NSAS.Freq          = typecast(ExtendedHeader(9:10),'uint16');
+            NEV.NSAS.DigInputConf  = char(ExtendedHeader(11));
+            NEV.NSAS.AnalCh1Conf   = char(ExtendedHeader(12));
+            NEV.NSAS.AnalCh1Detect = typecast(ExtendedHeader(13:14),'uint16');
+            NEV.NSAS.AnalCh2Conf   = char(ExtendedHeader(15));
+            NEV.NSAS.AnalCh2Detect = typecast(ExtendedHeader(16:17),'uint16');
+            NEV.NSAS.AnalCh3Conf   = char(ExtendedHeader(18));
+            NEV.NSAS.AnalCh3Detect = typecast(ExtendedHeader(19:20),'uint16');
+            NEV.NSAS.AnalCh4Conf   = char(ExtendedHeader(21));
+            NEV.NSAS.AnalCh4Detect = typecast(ExtendedHeader(22:23),'uint16');
+            NEV.NSAS.AnalCh5Conf   = char(ExtendedHeader(24));
+            NEV.NSAS.AnalCh5Detect = typecast(ExtendedHeader(25:26),'uint16');
+        otherwise
+            display(['PacketID ' PacketID ' is unknown.']);
+    end
+end
+
+%% Recording after ExtendedHeader file position and calculating Data Length
+%  and number of data packets
+fseek(FID, 0, 'eof');
+fData = ftell(FID);
+DataPacketCount = (fData - fExtendedHeader)/PacketBytes;
+DataLen = PacketBytes - 8; %#ok<NASGU>
+UnparsedDigitalDataFlag = 0;
+
+%% Reading data packets if 'read' is passed as an argument
+fseek(FID, fExtendedHeader, 'bof');
+Timestamps        = fread(FID, DataPacketCount, '*uint32', PacketBytes-4);
+fseek(FID, fExtendedHeader+4, 'bof');
+PacketIDs         = fread(FID, DataPacketCount, '*uint16', PacketBytes-2);
+fseek(FID, fExtendedHeader+6, 'bof');
+tempClassOrReason = fread(FID, DataPacketCount, '*uchar', PacketBytes-1);
+fseek(FID, fExtendedHeader+8, 'bof');
+tempDigiVals      = fread(FID, DataPacketCount, '*uint16', PacketBytes-2);
+
+%% Populate the NEV structure with spike timestamps, electrode numbers
+% and unit numbers
+nonNeuralIndices  = find(PacketIDs == 0);
+neuralIndices     = find(PacketIDs ~= 0);
+nonNeuTimestamps  = Timestamps(nonNeuralIndices);
+NEV.Data.Spikes.Timestamps   = Timestamps(neuralIndices);
+clear Timestamps; % save memory
+NEV.Data.Spikes.Electrode = PacketIDs(neuralIndices);
+NEV.Data.Spikes.Unit      = tempClassOrReason(neuralIndices);
+
+%% Parse read digital data. Please refer to help to learn about the proper
+% formatting if the data.
+if strcmp(ParseData, 'parse')
+    try
+        InsertionReason   = tempClassOrReason(find(PacketIDs == 0));
+        DigiValues        = char(tempDigiVals(nonNeuralIndices)');
+    % %   This section needs to be uncommented out for Justin
+    %     if int16(DigiValues(1)) > 128
+    %         DigiValues = char(DigiValues-128);
+    %     end
+        AsteriskIndices   = find(DigiValues == '*');
+        DataBegTimestamps = nonNeuTimestamps(AsteriskIndices);
+        Inputs            = {'Digital'; 'AnCh1'; 'AnCh2'; 'AnCh3'; 'AnCh4'; 'AnCh5'; 'PerSamp'; 'Serial'};
+        if ~isempty(DigiValues)
+            if ~int8(DigiValues(2))
+                DigiValues(find(DigiValues == DigiValues(2))) = [];
+            end
+            if strcmp(ParseData, 'parse') && ~isempty(DigiValues)
+                splitDigiValues = regexp(DigiValues(2:end), '*', 'split')';
+                for idx = 1:length(splitDigiValues)
+                    try
+                        if isempty(find(splitDigiValues{idx} == ':', 1))
+                            splitDigiValues{idx}(find(splitDigiValues{idx} == '#')) = [];
+                            NEV.Data.SerialDigitalIO(idx).Value = splitDigiValues{idx};
+                            NEV.Data.SerialDigitalIO(idx).Type = 'Marker';
+                        else
+                            [tempParsedCommand error] = parseCommand(splitDigiValues{idx});
+                            if ~error
+                                pcFields = fields(tempParsedCommand);
+                                for fidx = 1:length(pcFields)
+                                    NEV.Data.SerialDigitalIO(idx).(pcFields{fidx}) = tempParsedCommand.(pcFields{fidx});
+                                end
+                            else
+                               NEV.Data.SerialDigitalIO(idx).Value = splitDigiValues{idx};
+                               NEV.Data.SerialDigitalIO(idx).Type = 'UnparsedData';
+                               UnparsedDigitalDataFlag = 1;
+                            end
+                        end
+                    catch
+                        disp(['Error parsing: ' splitDigiValues{idx}]);
+                        disp('Please refer to the help for more information on how to properly format the digital data for parsing.');
+                    end
+                end            
+                % Populate the NEV structure with timestamps and inputtypes for the
+                % digital data
+                if ~isempty(DataBegTimestamps)
+                    c = num2cell(DataBegTimestamps); [NEV.Data.SerialDigitalIO(1:length(NEV.Data.SerialDigitalIO)).TimeStamp] = deal(c{1:end});
+                    c = num2cell(DataBegTimestamps/NEV.MetaTags.SampleRes); [NEV.Data.SerialDigitalIO.TimeStampSec] = deal(c{1:end});
+                    c = {Inputs{InsertionReason(AsteriskIndices)}}; [NEV.Data.SerialDigitalIO.InputType] = deal(c{1:end});
+                end
+            elseif ~isempty(DigiValues)
+                NEV.Data.SerialDigitalIO.TimeStamp = nonNeuTimestamps;
+                NEV.Data.SerialDigitalIO.UnparsedData = DigiValues;
+            end
+        else
+            disp('No digital data to read.');
+        end
+    catch
+        disp('An error occured during reading digital data. This is due to a problem with formatting digital data.');
+        disp('Refer to help ''help openNEV'' for more information on how to properly format the digital data.');
+    end
+else
+    %clear tempClassOrReason;
+    %clear PacketIDs;
+    NEV.Data.SerialDigitalIO.UnparsedData = tempDigiVals(nonNeuralIndices);
+    clear tempDigiVals;
+    NEV.Data.SerialDigitalIO.TimeStamp    = nonNeuTimestamps;
+    NEV.Data.SerialDigitalIO.TimeStampSec = double(nonNeuTimestamps) / double(NEV.MetaTags.SampleRes);
+    clear nonNeuTimestamps;
+end
+
+%% Reads the waveforms if 'read' is passed to the function
+if strcmp(ReadData, 'read')
+    if (strcmp(Compact, 'compact'))
+        SpikeWaveformType='int16';
+    else
+        SpikeWaveformType='double';
+    end
+    %read all waveforms or only a specific subset?
+    if isempty(Units) && isempty(Electrodes)
+        fseek(FID, fExtendedHeader + 8, 'bof'); % go to where spikes are located
+        NEV.Data.Spikes.Waveform  = fread(FID,...
+                                    [(PacketBytes-8)/2 DataPacketCount], ...
+                                    [num2str((PacketBytes-8)/2) '*int16=>' SpikeWaveformType],...
+                                    8)';
+        %remove non neural indices -- these have no waveform
+        NEV.Data.Spikes.Waveform(nonNeuralIndices, :) = [];
+        %retain a list of all packet indices 
+        NEV.Data.Spikes.WaveformIndices=neuralIndices;
+    else
+        %find all data packets that correspond to this electrode and/or
+        %unit
+        waveform_inds=find((isempty(Units) | ismember(tempClassOrReason,Units)) & ((isempty(Electrodes) & PacketIDs~=0) | ismember(PacketIDs,Electrodes)));
+        
+        %pre-allocate waveform array
+        NEV.Data.Spikes.Waveform=zeros(length(waveform_inds),(PacketBytes-8)/2,SpikeWaveformType);
+
+        for k=1:length(waveform_inds)
+            fseek(FID, fExtendedHeader + 8 + (waveform_inds(k)-1)*PacketBytes, 'bof'); % go to where the packet ist located
+            NEV.Data.Spikes.Waveform(k,:) = fread(FID,...
+                                            [(PacketBytes-8)/2 1], ...
+                                            [num2str((PacketBytes-8)/2) '*int16=>' SpikeWaveformType])';
+        end
+        
+        %retain a list of all packet indices -- this time respective the
+        %neural data packets only
+        NEV.Data.Spikes.WaveformIndices=find((isempty(Units) | ismember(tempClassOrReason(neuralIndices),Units)) & (isempty(Electrodes) | ismember(PacketIDs(neuralIndices),Electrodes)));
+    end
+end
+
+% save memory
+clear nonNeuralIndices;
+clear neuralIndices; 
+
+%% Calculating the length of the data
+fseek(FID, -PacketBytes, 'eof');
+DataDuration = fread(FID, 1, 'uint32=>double');
+%% Show a report if 'report' is passed as an argument
+if strcmp(Report, 'report')
+    disp( '*** FILE INFO **************************');
+    disp(['File Path           = ' fpath(1:end-1)]);
+    disp(['File Name           = ' fname]);
+    disp(['Filespec            = ' fileSpec]);
+    disp(['Data Duration (min) = ' num2str(round(DataDuration/NEV.MetaTags.SampleRes/60))]);
+    disp(['Packet Counts       = ' num2str(DataPacketCount)]);
+    disp(' ');
+    disp( '*** BASIC HEADER ***********************');    
+    disp(['File Type ID        = '         NEV.MetaTags.FileTypeID]);
+    disp(['Sample Resolution   = ' num2str(NEV.MetaTags.SampleRes)]);
+    disp(['Date and Time       = '         NEV.MetaTags.DateTime]);
+    disp(['Comment             = '         NEV.MetaTags.Comment(1:64)   ]);
+    disp(['                      '         NEV.MetaTags.Comment(65:128) ]);
+    disp(['                      '         NEV.MetaTags.Comment(129:192)]);
+    disp(['                      '         NEV.MetaTags.Comment(193:256)]);
+end
+
+
+%% Display how fast the function was executed.
+if strcmp(Report, 'report')
+    disp(['The load time was for NEV file was ' num2str(toc, '%0.1f') ' seconds.']);
+end
+
+%% Closing and clearing memory
+if strcmp(ParseData, 'parse')
+    if UnparsedDigitalDataFlag && strcmp(WarningStat, 'warning')
+        fprintf(2, 'WARNING: The NEV file contains unparsed digital data.\n'); % where the file is opened?
+        pause;
+    end
+end
+
+%% Saving the NEV structure as a MAT file for easy access
+if strcmp(SaveFile, 'save')
+    if exist(matPath, 'file') == 2
+        disp(['File ' matPath ' already exists.']);
+        overWrite = input('Would you like to overwrite (Y/N)? ', 's');
+        if strcmpi(overWrite, 'y')
+            disp('Saving MAT file. This may take a few seconds...');
+            save(matPath, 'NEV');
+        else
+            disp('File was not overwritten.');
+        end
+    else
+        disp('Saving MAT file. This may take a few seconds...');
+        save(matPath, 'NEV');
+    end
+end
+
+%% Closing and clearing memory
+if ~nargout
+    assignin('base', 'NEV', NEV);
+    fclose(FID);
+    clear variables;
+else
+    fclose(FID);
+end
+end

+ 291 - 0
blackrock/matlab/openNSx.m

@@ -0,0 +1,291 @@
+function NSx = openNSx(varargin)
+
+%%Opens an NSx file for reading, returns all file information in a NSx
+% structure. Works with File Spec 2.1 and 2.2.
+% Use OUTPUT = openNSx(fname, 'read', 'report', 'electrodes', 'duration', 'mode', 'precision').
+%
+% All input arguments are optional. Input arguments can be in any order.
+%
+%   fname:        Name of the file to be opened. If the fname is omitted
+%                 the user will be prompted to select a file.
+%                 DEFAULT: Will open Open File UI.
+%
+%   'read':       Will read the data in addition to the header information
+%                 if user passes this argument.
+%                 DEFAULT: will only read the header information.
+%
+%   'report':     Will show a summary report if user passes this argument.
+%                 DEFAULT: will not show report.
+%
+%   'electrodes': User can specify which electrodes need to be read. The
+%                 number of electrodes can be greater than or equal to 1
+%                 and less than or equal to 128. The electrodes can be
+%                 selected either by specifying a range (e.g. 20:45) or by
+%                 indicating individual electrodes (e.g. 3,6,7,90) or both.
+%                 This field needs to be followed by the prefix 'e:'. See
+%                 example for more details.
+%                 DEFAULT: will read all existing channels.
+%
+%   'duration':   User can specify the beginning and end of the data
+%                 segment to be read. If the start time is greater than the
+%                 length of data the program will exit with an error
+%                 message. If the end time is greater than the length of
+%                 data the end packet will be selected for end of data. The
+%                 user can specify the start and end values by comma
+%                 (e.g. [20,50]) or by a colon (e.g. [20:50]). To use this
+%                 argument the user must specify the [electrodes] or the
+%                 interval will be used for [electrodes] automatically.
+%                 This field needs to be followed by the prefix 't:'. See
+%                 example for more details.
+%                 DEFAULT: will read the entire file.
+%
+%   'mode':       The user can specify the mode of duration in [duration],
+%                 such as 'sec', 'min', 'hour', or 'sample'. If 'sec' is
+%                 specified the numbers in [duration] will correspond to
+%                 the number of seconds. The same is true for 'min', 'hour'
+%                 and 'sample'.
+%                 DEFAULT: will be set to 'sample'.
+%
+%   'precision':  The data storage class can be any format known by
+%                 MATLAB such as 'double', 'int16', 'int'.
+%                 This field needs to be followed by the prefix 'p:'. See
+%                 example for more details.
+%                 DEFAULT: will be set to 'double'
+%
+%   OUTPUT:       Contains the NSx structure.
+%
+%   Example:
+%
+%   openNSx('report','read','c:\data\sample.ns5', 'e:15:30', 't:3:10', 'min', 'p:int16');
+%
+%   In the example above, the file c:\data\sample.ns5 will be used. A
+%   report of the file contents will be shown. The data will be read from
+%   electrodes 15 through 50 in the 3-10 minute time interval. The data
+%   is saved in 'int16' type.
+%   If any of the arguments above are omitted the default values will be used.
+%
+%   Kian Torab
+%   kian.torab@utah.edu
+%   Department of Bioengineering
+%   University of Utah
+%   Version 2.1.0 - March 22, 2010
+
+NSxver = '2.1.0';
+disp(['openNSx version ' NSxver])
+
+%% Defining the NSx data structure and sub-branches.
+NSx             = struct('MetaTags',[],'Data',[]);
+NSx.MetaTags    = struct('FileTypeID',[],'ChannelCount',[],'SamplingFreq',[],'ChannelID',[],'Version',[],'ElecLabel',[],'CreateDateTime',[]);
+
+%% Validating the input arguments. Exit with error message if error occurs.
+for i=1:length(varargin)
+    inputArgument = varargin{i};
+    if strcmpi(inputArgument, 'report')
+        Report = inputArgument;
+    elseif strcmpi(inputArgument, 'read')
+        ReadData = inputArgument;
+    elseif strncmp(varargin{i}, 't:', 2)
+        colonIndex = find(inputArgument(3:end) == ':');
+        StartPacket = str2num(inputArgument(3:colonIndex+1));
+        EndPacket = str2num(inputArgument(colonIndex+3:end));
+        if min(varargin{i})<1 || max(varargin{i})>128
+            display('The electrode number cannot be less than 1 or greater than 128.');
+            clear variables;
+            if nargout; NSx = []; end
+            return;
+        end
+    elseif strncmp(varargin{i}, 'e:', 2)
+        Elec = str2num(inputArgument(3:end)); %#ok<ST2NM>
+    elseif strncmp(varargin{i}, 'p:', 2)
+        Precision = inputArgument(3:end); % precision for storage
+    elseif strfind(' hour min sec sample ', [' ' inputArgument ' ']) ~= 0
+        TimeScale = inputArgument;
+    else
+        temp = inputArgument;
+        if length(temp)>3 && strcmpi(temp(end-3),'.')
+            fname = inputArgument;
+            if exist(fname, 'file') ~= 2
+                display('The file does not exist.');
+                clear variables;
+                if nargout; NSx = []; end
+                return;
+            end
+        else
+            display(['Invalid argument ''' inputArgument ''' .']);
+            clear variables;
+            if nargout; NSx = []; end
+            return;
+        end
+    end
+end
+
+%% Popup the Open File UI. Also, process the file name, path, and extension
+%  for later use, and validate the entry.
+if ~exist('fname', 'var')
+    [fname, path] = uigetfile('D:\Data\*.ns*');
+    if fname == 0
+        clear variables;
+        if nargout; NSx = []; end
+        return;
+    end
+    fext = fname(end-3:end);
+else
+    [path, fname, fext] = fileparts(fname);
+    fname = [fname fext];
+end
+if fname==0; return; end;
+
+tic;
+
+%% Give all input arguments a default value. All input argumens are
+%  optional.
+if ~exist('Report', 'var');      Report = 'noreport'; end
+if ~exist('ReadData', 'var');    ReadData = 'noread'; end
+if ~exist('StartPacket', 'var'); StartPacket = 0;     end
+if ~exist('TimeScale', 'var');   TimeScale = 1;       end
+if ~exist('Precision', 'var');   Precision = 'double';       end
+
+%% Reading Basic Header from file into NSx structure.
+% we use fullfile instead of [path '\' fname] to support nix platforms
+FID                       = fopen(fullfile(path,fname), 'r', 'ieee-le');
+NSx.MetaTags.FileTypeID   = fread(FID, [1,8] , 'uint8=>char');
+
+% Validate the data file's File Spec.
+if strcmp(NSx.MetaTags.FileTypeID, 'NEURALSG')                              % 2.1
+    NSx.MetaTags.Version = '2.1';
+    NSx.MetaTags.Label           = fread(FID, [1,16] , 'uint8=>char');
+    NSx.MetaTags.SamplingFreq    = 30000/fread(FID, 1 , 'uint32=>double');
+    ChannelCount                 = fread(FID, 1 , 'uint32=>double');
+    NSx.MetaTags.ChannelID       = fread(FID, [ChannelCount 1], '*uint32');
+    NSx.MetaTags.ChannelCount    = ChannelCount;
+    fHeader = ftell(FID);
+elseif strcmp(NSx.MetaTags.FileTypeID, 'NEURALCD')                          % 2.2, 2.3
+    Major                        = num2str(fread(FID, 1  , 'uint8=>double'));
+    Minor                        = num2str(fread(FID, 1  , 'uint8=>double'));
+    NSx.MetaTags.Version         = [Major '.' Minor];
+    fHeader                      = fread(FID, 1  , 'uint32=>double');
+    NSx.MetaTags.Label           = fread(FID, [1,16]  , 'uint8=>char');
+    NSx.MetaTags.Comments        = fread(FID, [1,256]  , 'uint8=>char');
+    NSx.MetaTags.SamplingFreq    = 30000/fread(FID, 1 , 'uint32=>double' );
+    NSx.MetaTags.Resolution      = fread(FID, 1 , 'uint32=>double' );
+    NSx.MetaTags.CreateDateTime  = fread(FID, [1,8] , 'uint16=>double' );
+    ChannelCount                 = fread(FID, 1       , 'uint32=>double' );
+    NSx.MetaTags.ChannelCount    = ChannelCount;
+    NSx.MetaTags.ChannelID       = zeros(ChannelCount, 1);
+    NSx.MetaTags.ElecLabel       = char(zeros(ChannelCount, 16));         % Electrode label
+    % now read external header
+    for ii = 1:ChannelCount
+        CC = fread(FID, [1,2]  , 'uint8=>char');
+        if ~strcmp(CC, 'CC')
+            display('Wrong extension header');
+            fclose(FID);
+            clear variables;
+            return;
+        end
+        NSx.MetaTags.ChannelID(ii) = fread(FID, 1 , 'uint16=>double');
+        NSx.MetaTags.ElecLabel(ii,:) = fread(FID, [1,16]  , 'uint8=>char');
+        % We do not care about the rest now
+        dummy = num2str(fread(FID, [46,1]  , 'uint8=>double')); % dummy
+    end
+    clear dummy;
+    if fHeader ~= ftell(FID)
+        display('Header file corrupted!');
+        fHeader = ftell(FID);
+    end
+    fHeader = fHeader + 9; % to account for the data header
+else
+    display('This version of openNSx can only read File Specs 2.1 or 2.2');
+    display(['The selected file label is ' NSx.MetaTags.FileTypeID '.']);
+    fclose(FID);
+    clear variables;
+    if nargout; NSx = []; end;
+    return;
+end;
+% find out number of data points
+fseek(FID, 0, 'eof');
+fData = ftell(FID);
+fseek(FID, fHeader, 'bof');
+
+%% Adjusts StartPacket and EndPacket based on what time setting (sec, min,
+%  hour, or packets) the user has indicated in the input argument.
+switch TimeScale
+    case 'sec'
+        StartPacket = StartPacket * NSx.MetaTags.SamplingFreq;
+        EndPacket = EndPacket * NSx.MetaTags.SamplingFreq;
+    case 'min'
+        StartPacket = StartPacket * NSx.MetaTags.SamplingFreq * 60;
+        EndPacket = EndPacket * NSx.MetaTags.SamplingFreq * 60;
+    case 'hour'
+        StartPacket = StartPacket * NSx.MetaTags.SamplingFreq * 3600;
+        EndPacket = EndPacket * NSx.MetaTags.SamplingFreq * 3600;
+    case 'sample'
+        StartPacket = StartPacket - 1;
+        EndPacket   = EndPacket - 1;
+end
+
+%% Validate StartPacket and EndPacket to make sure they do not exceed the
+%  length of packets in the file. If EndPacket is over then the last packet
+%  will be set for EndPacket. If StartPacket is over then will exist with an
+%  error message.
+NumofPackets = (fData-fHeader)/(2*ChannelCount);
+if exist('EndPacket', 'var') && (EndPacket > NumofPackets)
+    display('The time interval specified is longer than the data duration.');
+    if StartPacket > NumofPackets
+        disp('The starting packet is greater than the total data duration.');
+        clear variables;
+        if nargout; NSx = []; end
+        return;
+    end
+    disp('The time interval specified is longer than the data duration.');
+    disp('Last data point will be used instead.');
+    disp('Press enter to continue...');
+    pause;
+    EndPacket = NumofPackets;
+elseif ~exist('EndPacket', 'var')
+    EndPacket = NumofPackets;
+end
+DataLength = EndPacket - StartPacket;
+clear TimeScale
+
+%% Displaying a report of basic file information and the Basic Header.
+if strcmp(Report, 'report')
+    disp( '*** FILE INFO **************************');
+    disp(['File Path          = '  path]);
+    disp(['File Name          = '  fname   ]);
+    disp(['File Version       = '  NSx.MetaTags.Version   ]);
+    disp(['Duration (seconds) = '  num2str(NumofPackets/NSx.MetaTags.SamplingFreq)]);
+    disp(['Total Data Points  = '  num2str(NumofPackets)                   ]);
+    disp(' ');
+    disp( '*** BASIC HEADER ***********************');
+    disp(['File Type ID       = '          NSx.MetaTags.FileTypeID      ]);
+    disp(['Label              = '          NSx.MetaTags.Label           ]);
+    disp(['Sample Resolution  = '  num2str(NSx.MetaTags.SamplingFreq)         ]);
+    disp(['Electrodes Read    = '  num2str(NSx.MetaTags.ChannelCount)   ]);
+end
+
+%%
+if ~exist('Elec', 'var');
+    Elec = 1:ChannelCount;
+end
+Elec=Elec(Elec>=1 & Elec<=ChannelCount);
+ReadElec = max(Elec)-min(Elec)+1;
+if (ReadElec <= ChannelCount)
+    if strcmp(ReadData, 'read')
+        fseek(FID, StartPacket * 2 * ChannelCount + fHeader, 'bof');
+        fseek(FID, (min(Elec)-1) * 2, 'cof');
+        NSx.Data = fread(FID, [ReadElec DataLength-1], [num2str(ReadElec) '*int16=>' Precision], (ChannelCount-ReadElec) * 2);
+    end
+end
+%% If user does not specify an output argument it will automatically create
+%  a structure.
+outputName = ['NS' fext(4)];
+if (nargout == 0),
+    assignin('caller', outputName, NSx);
+end
+
+if strcmp(Report, 'report')
+    display(['The load time for ' outputName ' file was ' num2str(toc, '%0.1f') ' seconds.']);
+end
+fclose(FID);
+
+end

BIN
blackrock/test2/test.ns5