@@ -1135,6 +1135,7 @@ describe('openBCIUtilities', function () {
1135
1135
it ( 'without scale all the channels should have the same number value as their (index + 1)' , function ( ) {
1136
1136
packet = openBCIUtilities . samplePacketRawAuxTimeSynced ( 0 ) ;
1137
1137
let sample = openBCIUtilities . parsePacketTimeSyncedRawAux ( {
1138
+ channelSettings : defaultChannelSettingsArray ,
1138
1139
rawDataPacket : packet ,
1139
1140
timeOffset : 0 ,
1140
1141
scale : false
@@ -1375,6 +1376,7 @@ describe('openBCIUtilities', function () {
1375
1376
} ) ;
1376
1377
it ( 'should get raw aux buffer' , function ( ) {
1377
1378
let sample = openBCIUtilities . parsePacketTimeSyncedRawAux ( {
1379
+ channelSettings : defaultChannelSettingsArray ,
1378
1380
rawDataPacket : packetBuffer ,
1379
1381
timeOffset : 0 ,
1380
1382
scale : false
@@ -1384,6 +1386,7 @@ describe('openBCIUtilities', function () {
1384
1386
} ) ;
1385
1387
it ( 'should get board time' , function ( ) {
1386
1388
let sample = openBCIUtilities . parsePacketTimeSyncedRawAux ( {
1389
+ channelSettings : defaultChannelSettingsArray ,
1387
1390
rawDataPacket : packetBuffer ,
1388
1391
timeOffset : 0 ,
1389
1392
scale : false
@@ -1394,6 +1397,7 @@ describe('openBCIUtilities', function () {
1394
1397
it ( 'should get time stamp with offset' , function ( ) {
1395
1398
let timeOffset = 80 ;
1396
1399
let sample = openBCIUtilities . parsePacketTimeSyncedRawAux ( {
1400
+ channelSettings : defaultChannelSettingsArray ,
1397
1401
rawDataPacket : packetBuffer ,
1398
1402
timeOffset : timeOffset ,
1399
1403
scale : false
@@ -1755,6 +1759,46 @@ describe('openBCIUtilities', function () {
1755
1759
expect ( openBCIUtilities . isOdd ( 2 ) ) . to . be . false ( ) ;
1756
1760
} ) ;
1757
1761
} ) ;
1762
+ describe ( '#getChannelDataArrayNoScale' , function ( ) {
1763
+ let sampleBuf ;
1764
+ beforeEach ( ( ) => {
1765
+ sampleBuf = openBCIUtilities . samplePacket ( 0 ) ;
1766
+ } ) ;
1767
+ it ( 'should return length of channel settings when less then 8' , function ( ) {
1768
+ let numChannels = 2 ;
1769
+ let channelSettings = k . channelSettingsArrayInit ( numChannels ) ;
1770
+ let valArray = openBCIUtilities . getChannelDataArrayNoScale ( {
1771
+ channelSettings : channelSettings ,
1772
+ rawDataPacket : sampleBuf
1773
+ } ) ;
1774
+ expect ( valArray ) . to . have . length ( numChannels ) ;
1775
+ } ) ;
1776
+ it ( 'should return length of channel settings of 8 when cyton' , function ( ) {
1777
+ let numChannels = k . OBCINumberOfChannelsCyton ;
1778
+ let channelSettings = k . channelSettingsArrayInit ( numChannels ) ;
1779
+ let valArray = openBCIUtilities . getChannelDataArrayNoScale ( {
1780
+ channelSettings,
1781
+ rawDataPacket : sampleBuf
1782
+ } ) ;
1783
+ expect ( valArray ) . to . have . length ( k . OBCINumberOfChannelsDefault ) ;
1784
+ } ) ;
1785
+ it ( 'should return length of channel settings of 8 when daisy' , function ( ) {
1786
+ let numChannels = k . OBCINumberOfChannelsDaisy ;
1787
+ let channelSettings = k . channelSettingsArrayInit ( numChannels ) ;
1788
+ let valArray = openBCIUtilities . getChannelDataArrayNoScale ( {
1789
+ channelSettings,
1790
+ rawDataPacket : sampleBuf
1791
+ } ) ;
1792
+ expect ( valArray ) . to . have . length ( k . OBCINumberOfChannelsDefault ) ;
1793
+ } ) ;
1794
+ it ( 'should reject when channelSettingsArray is not in fact an array' , function ( ) {
1795
+ expect ( openBCIUtilities . getChannelDataArrayNoScale . bind ( openBCIUtilities , {
1796
+ rawDataPacket : sampleBuf ,
1797
+ channelSettings : { } ,
1798
+ protocol : k . OBCIProtocolWifi
1799
+ } ) ) . to . throw ( 'Error [getChannelDataArrayNoScale]: Channel Settings must be an array!' ) ;
1800
+ } ) ;
1801
+ } ) ;
1758
1802
describe ( '#getChannelDataArray' , function ( ) {
1759
1803
let sampleBuf , badChanArray ;
1760
1804
beforeEach ( ( ) => {
@@ -1878,20 +1922,6 @@ describe('openBCIUtilities', function () {
1878
1922
} ) ;
1879
1923
} ) ;
1880
1924
describe ( 'Wifi' , function ( ) {
1881
- it ( 'should multiply each channel by the ganglion scale value when num chan is 4' , function ( ) {
1882
- let chanArr = k . channelSettingsArrayInit ( k . OBCINumberOfChannelsGanglion ) ; // Not in daisy mode
1883
- let scaleFactor = 1.2 / 51.0 / ( Math . pow ( 2 , 23 ) - 1 ) ;
1884
- // Call the function under test
1885
- let valueArray = openBCIUtilities . getChannelDataArray ( {
1886
- rawDataPacket : sampleBuf ,
1887
- channelSettings : chanArr ,
1888
- protocol : k . OBCIProtocolWifi
1889
- } ) ;
1890
- for ( let j = 0 ; j < k . OBCINumberOfChannelsGanglion ; j ++ ) {
1891
- // console.log(`channel data ${j + 1}: ${valueArray[j]} : actual ${scaleFactor * (j + 1)}`);
1892
- expect ( valueArray [ j ] ) . to . be . closeTo ( scaleFactor * ( j + 1 ) , 0.0001 ) ;
1893
- }
1894
- } ) ;
1895
1925
it ( 'should multiply each channel by the cyton scale value when num chan is 8' , function ( ) {
1896
1926
let chanArr = k . channelSettingsArrayInit ( k . OBCINumberOfChannelsDefault ) ; // Not in daisy mode
1897
1927
let scaleFactor = 4.5 / 24 / ( Math . pow ( 2 , 23 ) - 1 ) ;
0 commit comments