@@ -1135,6 +1135,7 @@ describe('openBCIUtilities', function () {
11351135 it ( 'without scale all the channels should have the same number value as their (index + 1)' , function ( ) {
11361136 packet = openBCIUtilities . samplePacketRawAuxTimeSynced ( 0 ) ;
11371137 let sample = openBCIUtilities . parsePacketTimeSyncedRawAux ( {
1138+ channelSettings : defaultChannelSettingsArray ,
11381139 rawDataPacket : packet ,
11391140 timeOffset : 0 ,
11401141 scale : false
@@ -1375,6 +1376,7 @@ describe('openBCIUtilities', function () {
13751376 } ) ;
13761377 it ( 'should get raw aux buffer' , function ( ) {
13771378 let sample = openBCIUtilities . parsePacketTimeSyncedRawAux ( {
1379+ channelSettings : defaultChannelSettingsArray ,
13781380 rawDataPacket : packetBuffer ,
13791381 timeOffset : 0 ,
13801382 scale : false
@@ -1384,6 +1386,7 @@ describe('openBCIUtilities', function () {
13841386 } ) ;
13851387 it ( 'should get board time' , function ( ) {
13861388 let sample = openBCIUtilities . parsePacketTimeSyncedRawAux ( {
1389+ channelSettings : defaultChannelSettingsArray ,
13871390 rawDataPacket : packetBuffer ,
13881391 timeOffset : 0 ,
13891392 scale : false
@@ -1394,6 +1397,7 @@ describe('openBCIUtilities', function () {
13941397 it ( 'should get time stamp with offset' , function ( ) {
13951398 let timeOffset = 80 ;
13961399 let sample = openBCIUtilities . parsePacketTimeSyncedRawAux ( {
1400+ channelSettings : defaultChannelSettingsArray ,
13971401 rawDataPacket : packetBuffer ,
13981402 timeOffset : timeOffset ,
13991403 scale : false
@@ -1755,6 +1759,46 @@ describe('openBCIUtilities', function () {
17551759 expect ( openBCIUtilities . isOdd ( 2 ) ) . to . be . false ( ) ;
17561760 } ) ;
17571761 } ) ;
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+ } ) ;
17581802 describe ( '#getChannelDataArray' , function ( ) {
17591803 let sampleBuf , badChanArray ;
17601804 beforeEach ( ( ) => {
@@ -1878,20 +1922,6 @@ describe('openBCIUtilities', function () {
18781922 } ) ;
18791923 } ) ;
18801924 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- } ) ;
18951925 it ( 'should multiply each channel by the cyton scale value when num chan is 8' , function ( ) {
18961926 let chanArr = k . channelSettingsArrayInit ( k . OBCINumberOfChannelsDefault ) ; // Not in daisy mode
18971927 let scaleFactor = 4.5 / 24 / ( Math . pow ( 2 , 23 ) - 1 ) ;
0 commit comments