SetContVarStartTimeAndValues16bit

Sets start time and continuous values of a continuous variable with a single fragment.

Syntax

var.SetContVarStartTimeAndValues16bit(startTime, values)

Parameters

Parameter

Type

Description

startTime

number

start time in seconds

values

list

list containing raw recorded values

Return

None.

Note

Python only.

Examples

Python

import nex
import numpy as np
doc = nex.GetActiveDocument()
# assume that we know the coefficient c to convert raw recorded 16-bit values to milliVolts
c = .12345e-5
# we need ymin and ymax values for nex.NewContVar()
# calculate ymin and ymax values so that NeuroExplorer will calculate the same coefficient
# to convert raw recorded 16-bit values to milliVolts:
ymax = c*32768.
ymin = -ymax
doc['ScriptGeneratedContVar'] = nex.NewContVar(doc, 1000, ymin, ymax)
# create a test numpy array with 16-bit values
testValues = np.array([7, 8, 9, 11], dtype=np.int16)

# the first data point is recorded at 0.5 seconds. add 16-bit values
doc['ScriptGeneratedContVar'].SetContVarStartTimeAndValues16bit(0.5, testValues)

# verify that values in milliVolts are the same
valuesInMV = testValues*c
valuesFromNex = doc['ScriptGeneratedContVar'].ContinuousValues()
for i in range(len(testValues)):
   print(valuesFromNex[i] - valuesInMV[i])