def loadLocalAdjust(self, localAdjustList, forceupdate=list()): channelCount = self.hardware.channelCount if self.hardware else 0 for index, record in enumerate(localAdjustList): path = record.path if index in forceupdate or record.solutionPath != record.path: if os.path.exists(path): linelist = list() itf = itfParser() itf.eMapFilePath = self.mappingpath itf.open(path) for _ in range(itf.getNumLines()): line = itf.eMapReadLine() for index, value in enumerate(line): if math.isnan(value): line[index] = 0 line = numpy.append(line, [0.0] * max(0, channelCount - len(line))) linelist.append(line) itf.close() record.solution = linelist record.solutionPath = path else: logging.getLogger(__name__).warning( "Local Adjust file '{0}' not found".format(path)) if self.electrodes: self.dataChanged.emit(0, 0, len(self.electrodes) - 1, 3) self.localAdjustVoltages = localAdjustList
def __init__(self, globalDict, dacController): logger = logging.getLogger(__name__) super(VoltageBlender, self).__init__() self.dacController = dacController if hardwareObjName==FPGAObjName and hardwareDict: self.hardware = FPGAHardware(self.dacController) elif hardwareObjName==NIObjName and hardwareDict: self.hardware = NIHardware() else: self.hardware = NoneHardware() self.itf = itfParser() self.lines = list() # a list of lines with numpy arrays self.adjustDict = SequenceDict() # names of the lines presented as possible adjusts self.adjustLines = [] self.lineGain = 1.0 self.globalGain = 1.0 self.lineno = 0 self.mappingpath = None self.outputVoltage = None self.electrodes = None self.aoNums = None self.dsubNums = None self.tableHeader = list() self.globalDict = globalDict self.adjustGain = 1.0 self.localAdjustVoltages = list() self.uploadedDataHash = None
def __init__(self, globalDict, dacController): logger = logging.getLogger(__name__) super(VoltageBlender, self).__init__() self.dacController = dacController if hardwareObjName == FPGAObjName and hardwareDict: self.hardware = FPGAHardware(self.dacController) elif hardwareObjName == NIObjName and hardwareDict: self.hardware = NIHardware() else: self.hardware = NoneHardware() self.itf = itfParser() self.lines = list() # a list of lines with numpy arrays self.adjustDict = SequenceDict( ) # names of the lines presented as possible adjusts self.adjustLines = [] self.lineGain = 1.0 self.globalGain = 1.0 self.lineno = 0 self.mappingpath = None self.outputVoltage = None self.electrodes = None self.aoNums = None self.dsubNums = None self.tableHeader = list() self.globalDict = globalDict self.adjustGain = 1.0 self.localAdjustVoltages = list() self.uploadedDataHash = None
def loadGlobalAdjust(self, path): channelCount = self.hardware.channelCount if self.hardware else 0 self.adjustLines = list() self.adjustDict = SequenceDict() itf = itfParser() itf.eMapFilePath = self.mappingpath itf.open(path) for _ in range(itf.getNumLines()): line = itf.eMapReadLine() for index, value in enumerate(line): if math.isnan(value): line[index]=0 line = numpy.append( line, [0.0]*max(0, channelCount-len(line))) self.adjustLines.append( line ) for name, value in itf.meta.items(): try: if int(value)<len(self.adjustLines): self.adjustDict[name] = AdjustValue(name=name, line=int(value), globalDict=self.globalDict) except ValueError: pass # if it's not an int we will ignore it here itf.close() self.dataChanged.emit(0, 0, len(self.electrodes)-1, 3)
def loadGlobalAdjust(self, path): channelCount = self.hardware.channelCount if self.hardware else 0 self.adjustLines = list() self.adjustDict = SequenceDict() itf = itfParser() itf.eMapFilePath = self.mappingpath itf.open(path) for _ in range(itf.getNumLines()): line = itf.eMapReadLine() for index, value in enumerate(line): if math.isnan(value): line[index] = 0 line = numpy.append(line, [0.0] * max(0, channelCount - len(line))) self.adjustLines.append(line) for name, value in itf.meta.items(): try: if int(value) < len(self.adjustLines): self.adjustDict[name] = AdjustValue( name=name, line=int(value), globalDict=self.globalDict) except ValueError: pass # if it's not an int we will ignore it here itf.close() self.dataChanged.emit(0, 0, len(self.electrodes) - 1, 3)
def loadLocalAdjust(self, localAdjustList, forceupdate=list() ): channelCount = self.hardware.channelCount if self.hardware else 0 for index, record in enumerate(localAdjustList): path = record.path if index in forceupdate or record.solutionPath != record.path: if os.path.exists(path): linelist = list() itf = itfParser() itf.eMapFilePath = self.mappingpath itf.open(path) for _ in range(itf.getNumLines()): line = itf.eMapReadLine() for index, value in enumerate(line): if math.isnan(value): line[index]=0 line = numpy.append( line, [0.0]*max(0, channelCount-len(line))) linelist.append( line ) itf.close() record.solution = linelist record.solutionPath = path else: logging.getLogger(__name__).warning("Local Adjust file '{0}' not found".format(path)) if self.electrodes: self.dataChanged.emit(0, 0, len(self.electrodes)-1, 3) self.localAdjustVoltages = localAdjustList
# ***************************************************************** # IonControl: Copyright 2016 Sandia Corporation # This Software is released under the GPL license detailed # in the file "license.txt" in the top-level IonControl directory # ***************************************************************** from Chassis.itfParser import itfParser sinPath ='../config/SineWave.itf' testPath = '../config/voltage_test.itf' itf = itfParser() itf.eMapFilePath = '../config/test_map.txt' itf.open(testPath) for i in range(itf.getNumLines()): data= itf.eMapReadLine() print(data) itf.close() # Test the ability to read a specified line. itf= None itf = itfParser() itf.eMapFilePath = '../config/test_map.txt' itf.open(sinPath) data = itf.eMapReadLine(0) print(data) data = itf.eMapReadLine(5) print(data) data = itf.eMapReadLine(0)
import numpy from Chassis.itfParser import itfParser def deleteIfExists(filePath): directory = os.getcwd() for item in os.listdir(directory): if item == filepath: os.remove(filepath) break filepath = 'example.itf' deleteIfExists(filepath) test = itfParser() for j in range(9): test.open(filepath) for i in range(9): data = 'test{0}{1}' test.appendline([data.format(j, i), data.format(j, i + 1)]) test.close() filepath = 'numpyExample.itf' deleteIfExists(filepath) test = itfParser() data = numpy.linspace(1, 10, 10) test.open(filepath) for i in range(9): test.appendline(data) test.close()
import numpy from Chassis.itfParser import itfParser def deleteIfExists(filePath): directory = os.getcwd() for item in os.listdir(directory): if item == filepath: os.remove(filepath) break filepath = 'example.itf' deleteIfExists(filepath) test = itfParser() for j in range(9): test.open(filepath) for i in range(9): data = 'test{0}{1}' test.appendline([data.format(j, i), data.format(j, i+1)]) test.close() filepath = 'numpyExample.itf' deleteIfExists(filepath) test = itfParser() data = numpy.linspace(1, 10, 10) test.open(filepath) for i in range(9): test.appendline(data) test.close()
from Chassis.itfParser import itfParser sinPath ='../config/SineWave.itf' testPath = '../config/voltage_test.itf' itf = itfParser() itf.eMapFilePath = '../config/thunderbird_map.txt' itf.open(testPath) for i in range(itf.getNumLines()): data= itf.eMapReadLine() print(data) itf.close() # Test the ability to read a specified line. itf= None itf = itfParser() itf.eMapFilePath = '../config/thunderbird_map.txt' itf.open(sinPath) data = itf.eMapReadLine(0) print(data) data = itf.eMapReadLine(5) print(data) data = itf.eMapReadLine(0) print(data) itf.close() # Test ReadLines itf = None