def OnOpenFile(self, event): filename = wx.FileSelector("Choose a file to open", nameUtils.genResultDirectoryPath(), default_extension='h5r', wildcard='PYME Results Files (*.h5r)|*.h5r|Tab Formatted Text (*.txt)|*.txt|Matlab data (*.mat)|*.mat') #print filename if not filename == '': self.OpenFile(filename)
def OnPerFrame(self, event): import numpy as np import os from PYME.FileUtils import nameUtils filename = wx.FileSelector("Choose a per frame variable to open", nameUtils.genResultDirectoryPath(), default_extension='npy', wildcard='Saved numpy array (*.npy)|*.npy') #print filename if not filename == '': #open file var = np.load(filename).astype('f') dlg = wx.TextEntryDialog(self.visFr, 'What do you want the new variable to be called?', 'Enter variable name', os.path.split(filename)[-1]) if dlg.ShowModal() == wx.ID_OK: varname = dlg.GetValue().encode() pipeline = self.visFr.pipeline #perform lookup values = var[pipeline.inputMapping['t'].astype('i')] #print values #add looked up values to input mapping pipeline.inputMapping.__dict__[varname + '_'] = values pipeline.inputMapping.setMapping(varname, '%s_' % varname) print type('%s_' % varname) print pipeline.inputMapping.mappings #regenerate the pipeline self.visFr.RegenFilter() self.visFr.CreateFoldPanel()