Skip to content

Commit a404703

Browse files
author
AJ Keller
committed
Removed old functions for impedance - #28
1 parent f618dcd commit a404703

File tree

3 files changed

+3
-60
lines changed

3 files changed

+3
-60
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
### New Features
44
* Add new example for Lab stream layer (#139) thanks @gabrielibagon
55

6+
### Breaking changes
7+
* Removed `impedanceCalculationForChannel()` and `impedanceCalculationForAllChannels` from `OpenBCISample.js`
8+
69
### Bug Fixes
710
* Fixes #131 - 16 chan not working by sending a channel command and parsing the return.
811

openBCISample.js

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -203,53 +203,6 @@ var sampleModule = {
203203
},
204204
floatTo3ByteBuffer,
205205
floatTo2ByteBuffer,
206-
/**
207-
* @description Calculate the impedance for one channel only.
208-
* @param sampleObject - Standard OpenBCI sample object
209-
* @param channelNumber - Number, the channel you want to calculate impedance for.
210-
* @returns {Promise} - Fulfilled with impedance value for the specified channel.
211-
* @author AJ Keller
212-
*/
213-
impedanceCalculationForChannel: (sampleObject, channelNumber) => {
214-
return new Promise((resolve, reject) => {
215-
if (sampleObject === undefined || sampleObject === null) reject('Sample Object cannot be null or undefined');
216-
if (sampleObject.channelData === undefined || sampleObject.channelData === null) reject('Channel cannot be null or undefined');
217-
if (channelNumber < 1 || channelNumber > k.OBCINumberOfChannelsDefault) reject('Channel number invalid.');
218-
219-
const index = channelNumber - 1;
220-
221-
if (sampleObject.channelData[index] < 0) {
222-
sampleObject.channelData[index] *= -1;
223-
}
224-
225-
const impedance = (Math.SQRT2 * sampleObject.channelData[index]) / k.OBCILeadOffDriveInAmps;
226-
resolve(impedance);
227-
});
228-
},
229-
/**
230-
* @description Calculate the impedance for all channels.
231-
* @param sampleObject - Standard OpenBCI sample object
232-
* @returns {Promise} - Fulfilled with impedances for the sample
233-
* @author AJ Keller
234-
*/
235-
impedanceCalculationForAllChannels: sampleObject => {
236-
return new Promise((resolve, reject) => {
237-
if (sampleObject === undefined || sampleObject === null) reject('Sample Object cannot be null or undefined');
238-
if (sampleObject.channelData === undefined || sampleObject.channelData === null) reject('Channel cannot be null or undefined');
239-
240-
let sampleImpedances = [];
241-
const numChannels = sampleObject.channelData.length;
242-
for (let index = 0; index < numChannels; index++) {
243-
if (sampleObject.channelData[index] < 0) {
244-
sampleObject.channelData[index] *= -1;
245-
}
246-
const impedance = (Math.SQRT2 * sampleObject.channelData[index]) / k.OBCILeadOffDriveInAmps;
247-
sampleImpedances.push(impedance);
248-
}
249-
sampleObject.impedances = sampleImpedances;
250-
resolve(sampleObject);
251-
});
252-
},
253206
interpret16bitAsInt32: twoByteBuffer => {
254207
var prefix = 0;
255208

test/OpenBCISample-test.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -708,19 +708,6 @@ describe('openBCISample', function () {
708708
assert(passed, 'a sample with accel data was produced');
709709
});
710710
});
711-
describe('#impedanceCalculationForChannel', function () {
712-
it('rejects when undefined sampleObject', function (done) {
713-
var bad;
714-
openBCISample.impedanceCalculationForChannel(bad, 1).should.be.rejected.and.notify(done);
715-
});
716-
it('rejects when undefined channel number', function (done) {
717-
var bad;
718-
openBCISample.impedanceCalculationForChannel('taco', bad).should.be.rejected.and.notify(done);
719-
});
720-
it('rejects when invalid channel number', function (done) {
721-
openBCISample.impedanceCalculationForChannel('taco', 69).should.be.rejected.and.notify(done);
722-
});
723-
});
724711
describe('#impedanceSummarize', function () {
725712
var impedanceArray = [];
726713
var numberOfChannels = 8;

0 commit comments

Comments
 (0)