def columndata(self): "columndata(self) - extract x,y vectors from column oriented text array" try: data = self.data NPT = len(data) self.NPT = NPT NC = len(data[0]) self.NC = NC self.xa = arange(self.NPT) self.ya = arange(self.NC) if NC <= 1: print 'bad file' return self.W[0].setentry(self.fname) da = transposeA(data) xid = int(self.xcid.get()) yid = int(self.ycid.get()) if xid < 0: x = range(NPT) y = da[0:NC] else: x = da[xid] y=[] for i in range(NC): # if i != xid: if i >= yid: y.append(da[i]) self.initfields(x,y) except AttributeError: self.message() return
def initData(self,fname=None): "initData(self,fname=None) - initialized data array loaded in from fname " self.minY = 0 self.minX = 0 if os.path.isfile(fname): da = readArray(fname) da = transposeA(da) # column oriented else: da = indgen([100,50]) print '***Test data: indgen([100,50]) used' v1,v2 = minmax(da) self.vmax = v2 self.vmin = v1 self.steps = len(da[0]) #100 self.rows = len(da) #30 #10 self.maxX = self.steps self.maxY = self.rows self.data = da self.extractSubArray(da) self.data0 = self.data self.spectrum = Pmw.Color.spectrum(self.steps, saturation=0.8, intensity=0.8, extraOrange=1) self.lineColor = 'gray80' self.lowThresh = 0 # 30 self.highThresh = 255 # 70
def columndata(self): "columndata(self) - extract x,y vectors from column oriented text array" try: from plotAscii import transposeA data = self.data NPT = len(data) self.NPT = NPT NC = len(data[0]) if NC <= 1: print 'bad file' return self.W[0].setentry(self.fname) da = transposeA(data) try: xid = int(self.xcid.get()) yid = int(self.ycid.get()) except ValueError: self.message(nm='Column: X col #:\nonly single integer # allowed') return if xid < 0: x = range(NPT) y = da[0:NC] else: x = da[xid] y=[] for i in range(NC): if i >= yid: y.append(da[i]) self.initfields(x,y) self.xcord = x except AttributeError: self.message() return
def displayImage(self): data = readArray(self.fname) data = transposeA(data) self.H = len(data) self.W = len(data[0]) self.raw_data = data self.createImage(data)
def initData(self, fname=None): "initData(self,fname=None) - initialized data array loaded in from fname " self.minY = 0 self.minX = 0 if os.path.isfile(fname): da = readArray(fname) da = transposeA(da) # column oriented else: da = indgen([100, 50]) print '***Test data: indgen([100,50]) used' v1, v2 = minmax(da) self.vmax = v2 self.vmin = v1 self.steps = len(da[0]) #100 self.rows = len(da) #30 #10 self.maxX = self.steps self.maxY = self.rows self.data = da self.extractSubArray(da) self.data0 = self.data self.spectrum = Pmw.Color.spectrum(self.steps, saturation=0.8, intensity=0.8, extraOrange=1) self.lineColor = 'gray80' self.lowThresh = 0 # 30 self.highThresh = 255 # 70
def resetIRange(self): if self.fname == '': return data = readArray(self.fname) data = transposeA(data) self.H = len(data) self.W = len(data[0]) self.raw_data = data self.createImage(data)
def transpose(self): 'transpose(self) - transpose and redraw the data array' da = self.data data = transposeA(da) self.extractSubArray(data) self.spectrum = Pmw.Color.spectrum(self.steps, saturation=0.8, intensity=0.8, extraOrange=1) self.clearcanvas() self.createAxis() self.draw() if self.CRFrame != None: self.CRFclose()
def pickFile(): "pickFile() - use file selection dialog to load in Ascii data array" import tkFileDialog,os path = '.' if os.path.isfile('fit.config'): fi =open('fit.config') fname = fi.read() fi.close() (path,fn) = os.path.split(fname) fname = tkFileDialog.askopenfilename(initialdir=path, initialfile='*.txt') if fname ==(): exit() FIT['fname'] = fname xdisplayfile(fname) arr = readArray(fname) cols = transposeA(arr) FIT['cols'] = cols FIT['ncol'] = len(cols) fo = open('fit.config','w') fo.write(fname) fo.close()
def transposeA(self): if self.fname == '': return data = self.data data = transposeA(data) self.createImage(data)