Compare commits

...

2 Commits

Author SHA1 Message Date
peterlu14 db0111d1db [update] amplitude rebuild & fix STI_T4 2021-09-01 10:57:35 +08:00
peterlu14 21cb382a1f [update] replace ADC_CLOCK to SAMPLE_RATE & 3.5 RECORDING_CH 2021-09-01 10:55:58 +08:00
11 changed files with 153 additions and 83 deletions
@@ -266,7 +266,7 @@ export default {
}
})
let scale = '1000'
const sampleRate = (800000 / metaInfo.parameter_set.ADC_CLOCK) // Hz
const sampleRate = metaInfo.parameter_set.SAMPLE_RATE // Hz
const dataPointNum = (parseInt(metaInfo.time_duration) / 1e6) * sampleRate // us -> s: /1e6
if (dataPointNum > 2e6) { // 2000 (points) * 1000 (resample) = 2e6
scale = '1000'
@@ -312,7 +312,7 @@ export default {
}
})
let scale = '1000'
const sampleRate = (800000 / metaInfo.parameter_set.ADC_CLOCK) // Hz
const sampleRate = metaInfo.parameter_set.SAMPLE_RATE // Hz
const dataPointNum = (timeDur / 1e6) * sampleRate // us -> s: /1e6
if (dataPointNum > 2e6) { // 2000 (points) * 1000 (resample) = 2e6
scale = '1000'
@@ -49,34 +49,54 @@ export default {
neuliveSampleRateOptions: [
{
id: 0,
value: 800,
value: 1000,
description: '1k',
},
{
id: 1,
value: 400,
value: 2000,
description: '2k',
},
{
id: 2,
value: 200,
value: 4000,
description: '4k',
},
{
id: 3,
value: 160,
value: 5000,
description: '5k',
},
{
id: 4,
value: 100,
value: 8000,
description: '8k',
},
{
id: 5,
value: 80,
value: 10000,
description: '10k',
},
{
id: 6,
value: 20000,
description: '20k',
},
{
id: 7,
value: 40000,
description: '40k',
},
{
id: 8,
value: 80000,
description: '80k',
},
{
id: 9,
value: 100000,
description: '100k',
},
],
stimulateElectrodeOptions: [
{
@@ -283,7 +303,7 @@ export default {
if (!(key.includes('sti') || key.includes('STI'))) {
let showKey = ''
let showValue = value
if (key === 'RECORDING_CH' || key === 'AXIS_CH' || key === 'AMP_GAIN' || key === 'ADC_CLOCK') {
if (key === 'RECORDING_CH' || key === 'AXIS_CH' || key === 'AMP_GAIN' || key === 'SAMPLE_RATE') {
if (key === 'RECORDING_CH') {
showKey = 'Channels'
// convert decimal to binary
@@ -328,7 +348,7 @@ export default {
showValue = this.ampGainOptions[i].description
}
}
} else if (key === 'ADC_CLOCK') {
} else if (key === 'SAMPLE_RATE') {
showKey = 'Sample Rate'
for (let i = 0; i < this.neuliveSampleRateOptions.length; i++) {
if (this.neuliveSampleRateOptions[i].value === value) {
+1 -1
View File
@@ -193,7 +193,7 @@ export default {
metaInfo = _meta
}
})
const sampleRate = (800000 / metaInfo.parameter_set.ADC_CLOCK) / JSON.parse(metaInfo.channels).length // Hz
const sampleRate = metaInfo.parameter_set.SAMPLE_RATE / JSON.parse(metaInfo.channels).length // Hz
const period = 1e6 / sampleRate
let thresholdValue
@@ -355,6 +355,8 @@ export default {
name: '[' + taskInfo.getTaskInfo().taskDeviceID.indexOf(selectID) + '] ' + taskInfo.getDeviceInfoByRawID(selectID).info.device_name,
addr: taskInfo.getDeviceInfoByRawID(selectID).info.device_address,
address: _address,
library_name: taskInfo.getDeviceInfoByRawID(selectID).info.library_name,
library_version: taskInfo.getDeviceInfoByRawID(selectID).info.library_version,
picture: pic,
type: type,
isSync: taskInfo.getDeviceInfoByRawID(selectID).info.isSync,
@@ -290,37 +290,37 @@ export default {
sampleRateOptions: [
{
id: 0,
value: 800,
value: 1000,
description: '1k',
},
{
id: 1,
value: 400,
value: 2000,
description: '2k',
},
{
id: 2,
value: 200,
value: 4000,
description: '4k',
},
{
id: 3,
value: 160,
value: 5000,
description: '5k',
},
{
id: 4,
value: 100,
value: 8000,
description: '8k',
},
{
id: 5,
value: 80,
value: 10000,
description: '10k',
},
{
id: 6,
value: 40,
value: 20000,
description: '20k',
},
],
@@ -472,7 +472,7 @@ export default {
}
})
this.ampGainSelect = this.ampGainOptions[(taskInfo.getDeviceInfo(this.deviceID).parameterSet.AMP_GAIN) % 4]
this.sampleRateSelect = this.sampleRateOptions[this.sampleRateOptions.findIndex(ele => ele.value === taskInfo.getDeviceInfo(this.deviceID).parameterSet.ADC_CLOCK)]
this.sampleRateSelect = this.sampleRateOptions[this.sampleRateOptions.findIndex(ele => ele.value === taskInfo.getDeviceInfo(this.deviceID).parameterSet.SAMPLE_RATE)]
this.recordOn = taskInfo.getDeviceInfo(this.deviceID).parameterSet.RECORDING
this.axisChannelList.length = 0
const axisChannelSet = taskInfo.getDeviceInfo(this.deviceID).parameterSet.AXIS_CH.toString(2).split('').reverse()
@@ -554,12 +554,13 @@ export default {
}
},
sampleRateSelectChange () {
if (this.sampleRateSelect != null && this.sampleRateSelect.value !== ((taskInfo.getDeviceInfo(this.deviceID).parameterSet.ADC_CLOCK))) {
if (this.sampleRateSelect != null && this.sampleRateSelect.value !== ((taskInfo.getDeviceInfo(this.deviceID).parameterSet.SAMPLE_RATE))) {
const adcClock = 8e5 / this.sampleRateSelect.value
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'ADC_CLOCK',
content: this.sampleRateSelect.value,
parameter: 'SAMPLE_RATE|ADC_CLOCK',
content: `${this.sampleRateSelect.value}|${String(adcClock)}`,
}))
}
},
@@ -290,39 +290,54 @@ export default {
sampleRateOptions: [
{
id: 0,
value: 800,
value: 1000,
description: '1k',
},
{
id: 1,
value: 400,
value: 2000,
description: '2k',
},
{
id: 2,
value: 200,
value: 4000,
description: '4k',
},
{
id: 3,
value: 160,
value: 5000,
description: '5k',
},
{
id: 4,
value: 100,
value: 8000,
description: '8k',
},
{
id: 5,
value: 80,
value: 10000,
description: '10k',
},
{
id: 6,
value: 40,
value: 20000,
description: '20k',
},
{
id: 7,
value: 40000,
description: '40k',
},
{
id: 8,
value: 80000,
description: '80k',
},
{
id: 9,
value: 100000,
description: '100k',
},
],
radioFrequencySelect: null,
radioFrequencyOptions: [
@@ -475,11 +490,11 @@ export default {
const channelSetHight = taskInfo.getDeviceInfo(this.deviceID).parameterSet.RECORDING_CH_H.toString(2).split('').reverse()
channelSetHight.forEach((element, index) => {
if (parseInt(element) > 0) {
this.channelList.push(index + 15)
this.channelList.push(index + 17)
}
})
this.ampGainSelect = this.ampGainOptions[(taskInfo.getDeviceInfo(this.deviceID).parameterSet.AMP_GAIN) % 4]
this.sampleRateSelect = this.sampleRateOptions[this.sampleRateOptions.findIndex(ele => ele.value === taskInfo.getDeviceInfo(this.deviceID).parameterSet.ADC_CLOCK)]
this.sampleRateSelect = this.sampleRateOptions[this.sampleRateOptions.findIndex(ele => ele.value === taskInfo.getDeviceInfo(this.deviceID).parameterSet.SAMPLE_RATE)]
this.recordOn = taskInfo.getDeviceInfo(this.deviceID).parameterSet.RECORDING
this.axisChannelList.length = 0
const axisChannelSet = taskInfo.getDeviceInfo(this.deviceID).parameterSet.AXIS_CH.toString(2).split('').reverse()
@@ -524,6 +539,7 @@ export default {
content: channelValue,
}))
}
this.recordingChannelReset(this.channelList)
} else if (this.channelList.indexOf(val) < 0 && val <= 32 && val > 16) {
this.channelList.push(val)
@@ -545,6 +561,7 @@ export default {
content: channelValue,
}))
}
this.recordingChannelReset(this.channelList)
} else {
this.pageToast('Recording channels cannot choose more than 32.')
}
@@ -569,6 +586,7 @@ export default {
content: channelValue,
}))
}
this.recordingChannelReset(this.channelList)
} else if (this.channelList.indexOf(val) >= 0 && val <= 32 && val > 16) {
this.channelList.splice(this.channelList.indexOf(val), 1)
let channelSet = ''
@@ -588,6 +606,26 @@ export default {
content: channelValue,
}))
}
this.recordingChannelReset(this.channelList)
}
},
recordingChannelReset (channelList) {
let channelSet = ''
for (let i = 32; i >= 1; i--) {
if (channelList.indexOf(i) >= 0) {
channelSet += '1'
} else {
channelSet += '0'
}
}
const channelValue = parseInt(channelSet, 2)
if (channelValue !== taskInfo.getDeviceInfo(this.deviceID).RECORDING_CH) {
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'RECORDING_CH',
content: channelValue,
}))
}
},
ampGainSelectChange () {
@@ -601,12 +639,13 @@ export default {
}
},
sampleRateSelectChange () {
if (this.sampleRateSelect != null && this.sampleRateSelect.value !== ((taskInfo.getDeviceInfo(this.deviceID).parameterSet.ADC_CLOCK))) {
if (this.sampleRateSelect != null && this.sampleRateSelect.value !== ((taskInfo.getDeviceInfo(this.deviceID).parameterSet.SAMPLE_RATE))) {
const adcClock = 8e6 / this.sampleRateSelect.value
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'ADC_CLOCK',
content: this.sampleRateSelect.value,
parameter: 'SAMPLE_RATE|ADC_CLOCK',
content: `${this.sampleRateSelect.value}|${String(adcClock)}`,
}))
}
},
@@ -136,35 +136,35 @@
<div class="mt-4">
<div class="row sm12 xl12 md12 xs12">
<p class="display-6">AMPLITUDE LOW (uA)</p>
<p class="display-6">AMPLITUDE PHASE1 (uA)</p>
</div>
<div class="row">
<div class="flex sm12 xl12 md12 xs12">
<div class="flex row align--center">
<va-button slot="append" class="mr-2 pa-1 shrink" small @click="amplitudeNumberChange(5, 'LOW')">
<va-button slot="append" class="mr-2 pa-1 shrink" small @click="amplitudeNumberChange(5, 'PHASE1')">
5
</va-button>
<va-input
@keyup.enter="amplitudeNumberChange(amplitudeNumberInput.LOW, 'LOW')"
v-model="amplitudeNumberInput.LOW"
@keyup.enter="amplitudeNumberChange(amplitudeNumberInput.PHASE1, 'PHASE1')"
v-model="amplitudeNumberInput.PHASE1"
class="mb-0"
>
<p slot="append" style="margin-right: 0;" small>
uA
</p>
</va-input>
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="amplitudeNumberChange(4000, 'LOW')">
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="amplitudeNumberChange(4000, 'PHASE1')">
4000
</va-button>
</div>
<va-slider
class="flex sm12 xl12 md12 xs12"
@mouseup.native="amplitudeNumberChange(amplitudeNumber, 'LOW')"
@mouseleave.native="amplitudeNumberChange(amplitudeNumber, 'LOW')"
@touchend.native="amplitudeNumberChange(amplitudeNumber, 'LOW')"
@mouseup.native="amplitudeNumberChange(amplitudeNumber.PHASE1, 'PHASE1')"
@mouseleave.native="amplitudeNumberChange(amplitudeNumber.PHASE1, 'PHASE1')"
@touchend.native="amplitudeNumberChange(amplitudeNumber.PHASE1, 'PHASE1')"
value-visible
v-model="amplitudeNumber.LOW"
v-model="amplitudeNumber.PHASE1"
:min="5"
:max="4000"
/>
@@ -174,35 +174,35 @@
<div class="mt-4">
<div class="row sm12 xl12 md12 xs12">
<p class="display-6">AMPLITUDE HIGHT (uA)</p>
<p class="display-6">AMPLITUDE PHASE2 (uA)</p>
</div>
<div class="row">
<div class="flex sm12 xl12 md12 xs12">
<div class="flex row align--center">
<va-button slot="append" class="mr-2 pa-1 shrink" small @click="amplitudeNumberChange(5, 'HIGHT')">
<va-button slot="append" class="mr-2 pa-1 shrink" small @click="amplitudeNumberChange(5, 'PHASE2')">
5
</va-button>
<va-input
@keyup.enter="amplitudeNumberChange(amplitudeNumberInput.HIGHT, 'HIGHT')"
v-model="amplitudeNumberInput.HIGHT"
@keyup.enter="amplitudeNumberChange(amplitudeNumberInput.PHASE2, 'PHASE2')"
v-model="amplitudeNumberInput.PHASE2"
class="mb-0"
>
<p slot="append" style="margin-right: 0;" small>
uA
</p>
</va-input>
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="amplitudeNumberChange(4000, 'HIGHT')">
<va-button slot="append" class="ml-2 pa-1 shrink" small @click="amplitudeNumberChange(4000, 'PHASE2')">
4000
</va-button>
</div>
<va-slider
class="flex sm12 xl12 md12 xs12"
@mouseup.native="amplitudeNumberChange(amplitudeNumber, 'HIGHT')"
@mouseleave.native="amplitudeNumberChange(amplitudeNumber, 'HIGHT')"
@touchend.native="amplitudeNumberChange(amplitudeNumber, 'HIGHT')"
@mouseup.native="amplitudeNumberChange(amplitudeNumber.PHASE2, 'PHASE2')"
@mouseleave.native="amplitudeNumberChange(amplitudeNumber.PHASE2, 'PHASE2')"
@touchend.native="amplitudeNumberChange(amplitudeNumber.PHASE2, 'PHASE2')"
value-visible
v-model="amplitudeNumber.HIGHT"
v-model="amplitudeNumber.PHASE2"
:min="5"
:max="4000"
/>
@@ -447,12 +447,16 @@ export default {
cycleNumber: 1,
// cycleNumberArray: Array(9).fill(1),
amplitudeNumberInput: {
LOW: '50',
HIGHT: '50',
PHASE1: '50',
PHASE2: '50',
},
amplitudeNumber: {
LOW: 50,
HIGHT: 50,
PHASE1: 50,
PHASE2: 50,
},
amplitudeName: {
PHASE1: ['H1', 'L1'],
PHASE2: ['L3', 'H3'],
},
patternModeSelect: null,
patternModeOptions: [
@@ -588,10 +592,10 @@ export default {
this.cycleNumber = (taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_CYCLE_CH0 + 1)
this.cycleNumberInput = String(this.cycleNumber)
// this.cycleNumberArray = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_CYCLE_LIST
this.amplitudeNumber.LOW = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_AMPLITUDE_L2 * 5
this.amplitudeNumberInput.LOW = String(this.amplitudeNumber.LOW)
this.amplitudeNumber.HIGHT = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_AMPLITUDE_H2 * 5
this.amplitudeNumberInput.HIGHT = String(this.amplitudeNumber.HIGHT)
this.amplitudeNumber.PHASE1 = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_AMPLITUDE_L1 * 5
this.amplitudeNumberInput.PHASE1 = String(this.amplitudeNumber.PHASE1)
this.amplitudeNumber.PHASE2 = taskInfo.getDeviceInfo(this.deviceID).parameterSet.STI_AMPLITUDE_H3 * 5
this.amplitudeNumberInput.PHASE2 = String(this.amplitudeNumber.PHASE2)
this.refreshPattern()
},
@@ -693,13 +697,12 @@ export default {
}
},
amplitudeNumberChange (val, type) {
val = val[type]
// type = LOW or HIGHT
if (this.amplitudeNumber[type] == null) {
return false
}
if (typeof (val) === 'string') {
if (isNaN(val) || parseInt(val) > 4000 || parseInt(val) < 5) {
val = '50'
this.amplitudeNumberInput[type] = '50'
this.amplitudeNumber[type] = 50
}
@@ -708,6 +711,7 @@ export default {
}
} else {
if (isNaN(val) || parseInt(val) > 4000 || parseInt(val) < 5) {
val = 50
this.amplitudeNumberInput[type] = '50'
this.amplitudeNumber[type] = 50
}
@@ -716,14 +720,14 @@ export default {
this.amplitudeNumber[type] = val
}
}
if (parseInt(this.amplitudeNumber[type] / 5) !== parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet['STI_AMPLITUDE_' + type[0] + '2'])) {
if (parseInt(this.amplitudeNumber[type] / 5) !== parseInt(taskInfo.getDeviceInfo(this.deviceID).parameterSet['STI_AMPLITUDE_' + this.amplitudeName[type][1]])) {
const content2 = parseInt(this.amplitudeNumber[type] / 5)
const content1 = parseInt(this.amplitudeNumber[type] / 5 / 2)
this.mqttPub(taskInfo.getTaskInfo().controllerID + '_user', JSON.stringify({
header: 'device_parameter/0',
device: taskInfo.getRawDeviceID(this.deviceID),
parameter: 'STI_AMPLITUDE_' + type[0] + '2|STI_AMPLITUDE_' + type[0] + '1',
content: `${content2}|${content1}`,
parameter: `STI_AMPLITUDE_${this.amplitudeName[type][0]}|STI_AMPLITUDE_${this.amplitudeName[type][1]}`,
content: `${content1}|${content2}`,
}))
}
},
@@ -1026,7 +1030,7 @@ export default {
shortContent += String(this.t4Range) + '|'
for (let i = 1; i < 16; i++) {
parameter += `STI_T4_CH${i}|`
content += String(this.t3Range) + '|'
content += String(this.t4Range) + '|'
}
}
if (parameter.length > 0) {
+3 -3
View File
@@ -1,6 +1,6 @@
import golbalMethods from '../global/global'
const NeuliveParameterOrder = ['RECORDING_CH', 'AMP_GAIN', 'ADC_CLOCK']
const NeuliveParameterOrder = ['RECORDING_CH', 'AMP_GAIN', 'SAMPLE_RATE']
const NeuliveAmpGain = [100, 400, 800, 25]
export const exportData = {
@@ -26,8 +26,8 @@ export const exportData = {
parameter.push(['Record channels', result])
} else if (p === 'AMP_GAIN') {
parameter.push(['Amp gain', NeuliveAmpGain[value]])
} else if (p === 'ADC_CLOCK') {
parameter.push(['Sample Rate', parseInt(8e5 / (value * JSON.parse(headers.channels).length))])
} else if (p === 'SAMPLE_RATE') {
parameter.push(['Sample Rate', parseInt(value / (JSON.parse(headers.channels).length))])
}
})
} else if (headers.device.library_name.indexOf('Elite') >= 0) {
@@ -5,7 +5,7 @@ const typePath = types.export
const typePathDownload = types.download
const typePathDownloadStream = types.downloadStream
const NeuliveParameterOrder = ['RECORDING_CH', 'AXIS_CH', 'AMP_GAIN', 'ADC_CLOCK']
const NeuliveParameterOrder = ['RECORDING_CH', 'AXIS_CH', 'AMP_GAIN', 'SAMPLE_RATE']
const NeuliveAmpGain = [100, 400, 800]
const exportActs = {
@@ -52,9 +52,9 @@ const exportActs = {
parameter.push(['Accelrator channels', result])
} else if (p === 'AMP_GAIN') {
parameter.push(['Amp gain', NeuliveAmpGain[value]])
} else if (p === 'ADC_CLOCK') {
} else if (p === 'SAMPLE_RATE') {
const recordChannel = JSON.parse(meta.channels).filter(ch => parseInt(ch) < 256)
parameter.push(['Sample Rate', parseInt(8e5 / (value * recordChannel.length))])
parameter.push(['Sample Rate', parseInt(value / recordChannel.length)])
}
})
} else if (device[0] === 'Elite') {
@@ -27,10 +27,10 @@ const downloadMutations = {
if (device[0] === 'Neulive') {
if (channel < 256) {
sampleRate = parseInt(800000 / parseInt(meta.configuration.ADC_CLOCK))
sampleRate = meta.configuration.SAMPLE_RATE
sampleRateDivideNum = state.downloadInfo.channel.length
} else if (channel >= 256 && channel <= 259) {
sampleRate = parseInt(800000 / parseInt(meta.configuration.ADC_CLOCK) / 78)
sampleRate = parseInt(meta.configuration.SAMPLE_RATE / 78)
}
} else if (device[0] === 'Elite') {
if (device[1] === 'ZM15') {
@@ -8,17 +8,21 @@ const paramActs = {
const device = payload.device
let status = true
let message = ''
const channelList = []
const channelSet = taskInfo.getDeviceInfo(device.id).parameterSet.RECORDING_CH.toString(2).split('').reverse()
channelSet.forEach((element, index) => {
if (parseInt(element) > 0) {
channelList.push(index + 1)
if (device.library_name.indexOf('Neulive') !== -1) {
if (device.library_version.indexOf('3.0') !== -1 || device.library_version.indexOf('3.1') !== -1) {
if (taskInfo.getDeviceInfo(device.id).parameterSet.RECORDING_CH <= 0) {
status = false
message += '\nRecording need at least one channel,'
}
}
if (device.library_version.indexOf('3.5') !== -1) {
if (taskInfo.getDeviceInfo(device.id).parameterSet.RECORDING_CH_L <= 0 && taskInfo.getDeviceInfo(device.id).parameterSet.RECORDING_CH_H <= 0) {
status = false
message += '\nRecording need at least one channel,'
}
}
})
if (channelList.length <= 0) {
status = false
message += '\nRecording need at least one channel,'
}
return { status: status, message: message }
},
[typePath.checkIfStimulationSetDone]: async ({ state, getters, commit }, payload) => {