if dialog.exec_(): self.project = dialog.project for pl in self.project.dicoPlates.values(): pl.setDicoEch() self.populateEch() def addAm(self): dialog = AmountDialog(self, project=self.project) if dialog.exec_(): self.project = dialog.project self.project.setDicoAm() self.populateAm() def addGene(self): dialog = GeneDialog(self, project=self.project) if dialog.exec_(): self.project = dialog.project for pl in self.project.dicoPlates.values(): pl.setDicoGene() self.populateGene() if __name__ == "__main__": import sys from project import * app = QApplication(sys.argv) pl = project('sortiesrealplex/test_2.txt') f = EditDialog(project=pl) f.show() app.exec_()
def __init__(self): """ Creates pose editor window. """ print ("creating the frame named " + VERSION) wx.Frame.__init__(self, None, -1, VERSION, style = wx.DEFAULT_FRAME_STYLE)# & ~ (wx.RESIZE_BORDER | wx.MAXIMIZE_BOX)) # key data for our program self.project = project() # holds data for our project self.tools = dict() # our tool instances self.toolIndex = dict() # holds tool folder classes self.saveReq = False self.panel = None #the main panel self.port = None #the serial port self.filename = "" #name of the current file being edoted self.dirname = "" #directy that the file is saved in self.robot_color = robot_color() #0.3,1,.1 # for clearing red color on status bar self.timer = wx.Timer(self, self.ID_TIMER) self.timeout = 0 # build our menu bar menubar = wx.MenuBar() prjmenu = wx.Menu() prjmenu.Append(self.ID_NEW, "new") # dialog with name, # of servos prjmenu.Append(self.ID_OPEN, "open") # open file dialog prjmenu.Append(self.ID_SAVE,"save") # if name unknown, ask, otherwise save prjmenu.Append(self.ID_SAVE_AS,"save as") # ask for name, save prjmenu.AppendSeparator() prjmenu.Append(self.ID_EXIT,"exit") menubar.Append(prjmenu, "project") toolsmenu = wx.Menu() # find our tools toolFiles = list() for file in os.listdir("tools"): if file[-3:] == '.py' and file != "__init__.py" and file != "ToolPane.py": toolFiles.append(file[0:-3]) # load tool names, give them IDs print "Importing the following modules from the tools folder:" for t in toolFiles:#this imports commander.py I think it gets path from operating system module = __import__(t, globals(), locals(), ["NAME"]) name = getattr(module, "NAME") if name == "SKIP": continue id = wx.NewId() self.toolIndex[id] = (t, name) toolsmenu.Append(id,name) #toolsmenu.Append(self.ID_EXPORT,"export to AVR") # save as dialog for t in self.toolIndex: print t menubar.Append(toolsmenu,"tools") configmenu = wx.Menu() configmenu.Append(self.ID_PORT,"port") # dialog box: arbotix/thru, speed, port menubar.Append(configmenu, "config") #build settings menu settings_menu = wx.Menu() settings_menu.Append(self.ID_ROB_COL,"robot_color") self.enable_safety_limits = settings_menu.Append(self.ID_ENABLE_SAFETY, "Enable Limits", kind=wx.ITEM_CHECK) self.collision_detect = settings_menu.Append(self.ID_SET_COLLISION,"Collision_Detect",kind=wx.ITEM_CHECK) settings_menu.Append(self.ID_SET_LIMITS,"Set Limits") settings_menu.Append(self.ID_SET_SPHERE_SIZE, "Spheres_size") self.show_force_fields = settings_menu.Append(self.ID_FORCE_FIELDS,"Show Force Fields",kind=wx.ITEM_CHECK) self.show_tool_path = settings_menu.Append(self.ID_SHOW_TOOL_PATH,"Show Tool Path",kind=wx.ITEM_CHECK) menubar.Append(settings_menu, "settings") helpmenu = wx.Menu() helpmenu.Append(self.ID_ABOUT,"about") menubar.Append(helpmenu,"help") self.SetMenuBar(menubar) # configure events wx.EVT_MENU(self, self.ID_NEW, self.newFile) wx.EVT_MENU(self, self.ID_OPEN, self.openFile) wx.EVT_MENU(self, self.ID_SAVE, self.saveFile) wx.EVT_MENU(self, self.ID_SAVE_AS, self.saveFileAs) wx.EVT_MENU(self, self.ID_EXIT, sys.exit) for t in self.toolIndex.keys(): wx.EVT_MENU(self, t, self.loadTool) #wx.EVT_MENU(self, self.ID_EXPORT, self.export) wx.EVT_MENU(self, self.ID_RELAX, self.doRelax) wx.EVT_MENU(self, self.ID_PORT, self.doPort) wx.EVT_MENU(self, self.ID_TEST, self.doTest) wx.EVT_MENU(self, self.ID_ABOUT, self.doAbout) self.Bind(wx.EVT_CLOSE, self.doClose) self.Bind(wx.EVT_TIMER, self.OnTimer, id=self.ID_TIMER) wx.EVT_MENU(self, self.ID_ROB_COL, self.robot_color_dlg) #wx.EVT_MENU(self, self.ID_LIVE_UPDATE, self.setLiveUpdate) wx.EVT_MENU(self, self.ID_FORCE_FIELDS, self.set_force_fields) wx.EVT_MENU(self, self.ID_SET_COLLISION, self.set_collision_detect) wx.EVT_MENU(self, self.ID_SET_SPHERE_SIZE, self.set_sphere_size) wx.EVT_MENU(self, self.ID_SHOW_TOOL_PATH, self.set_show_tool_path) wx.EVT_MENU(self, self.ID_ENABLE_SAFETY, self.enable_safety) wx.EVT_MENU(self, self.ID_SET_LIMITS, self.set_safety_limits) # editor area self.sb = self.CreateStatusBar(2) self.sb.SetStatusWidths([-1,150]) self.sb.SetStatusText('not connected',1) self.loadTool() self.sb.SetStatusText('please create or open a project...',0) self.Centre() # small hack for windows... 9-25-09 MEF self.color = (211,211,211) self.SetBackgroundColour(self.color) self.Show(True)
def project_branch(): return 'ticket-'+project()
def __init__(self): """ Creates pose editor window. """ wx.Frame.__init__(self, None, -1, VERSION, style = wx.DEFAULT_FRAME_STYLE & ~ (wx.RESIZE_BORDER | wx.MAXIMIZE_BOX)) # key data for our program self.project = project() # holds data for our project self.tools = dict() # our tool instances self.toolIndex = dict() # existant tools self.saveReq = False self.panel = None self.port = None self.filename = "" self.dirname = "" self.columns = 2 # column count for pose editor # for clearing red color on status bar self.timer = wx.Timer(self, self.ID_TIMER) self.timeout = 0 # build our menu bar menubar = wx.MenuBar() prjmenu = wx.Menu() prjmenu.Append(self.ID_NEW, "new") # dialog with name, # of servos prjmenu.Append(self.ID_OPEN, "open") # open file dialog prjmenu.Append(self.ID_SAVE,"save") # if name unknown, ask, otherwise save prjmenu.Append(self.ID_SAVE_AS,"save as") # ask for name, save prjmenu.AppendSeparator() prjmenu.Append(self.ID_EXIT,"exit") menubar.Append(prjmenu, "project") toolsmenu = wx.Menu() # find our tools toolFiles = list() for file in os.listdir("tools"): if file[-3:] == '.py' and file != "__init__.py" and file != "ToolPane.py": toolFiles.append(file[0:-3]) # load tool names, give them IDs for t in toolFiles: module = __import__(t, globals(), locals(), ["NAME"]) name = getattr(module, "NAME") id = wx.NewId() self.toolIndex[id] = (t, name) toolsmenu.Append(id,name) toolsmenu.Append(self.ID_EXPORT,"export to AVR") # save as dialog menubar.Append(toolsmenu,"tools") configmenu = wx.Menu() configmenu.Append(self.ID_PORT,"port") # dialog box: arbotix/thru, speed, port columnmenu = wx.Menu() columnmenu.Append(self.ID_2COL,"2 columns") columnmenu.Append(self.ID_3COL,"3 columns") columnmenu.Append(self.ID_4COL,"4 columns") configmenu.AppendMenu(self.ID_COL_MENU,"pose editor",columnmenu) # live update self.live = configmenu.Append(self.ID_LIVE_UPDATE,"live pose update",kind=wx.ITEM_CHECK) #configmenu.Append(self.ID_TEST,"test") # for in-house testing of boards menubar.Append(configmenu, "config") helpmenu = wx.Menu() helpmenu.Append(self.ID_ABOUT,"about") menubar.Append(helpmenu,"help") self.SetMenuBar(menubar) # configure events wx.EVT_MENU(self, self.ID_NEW, self.newFile) wx.EVT_MENU(self, self.ID_OPEN, self.openFile) wx.EVT_MENU(self, self.ID_SAVE, self.saveFile) wx.EVT_MENU(self, self.ID_SAVE_AS, self.saveFileAs) wx.EVT_MENU(self, self.ID_EXIT, sys.exit) for t in self.toolIndex.keys(): wx.EVT_MENU(self, t, self.loadTool) wx.EVT_MENU(self, self.ID_EXPORT, self.export) wx.EVT_MENU(self, self.ID_RELAX, self.doRelax) wx.EVT_MENU(self, self.ID_PORT, self.doPort) wx.EVT_MENU(self, self.ID_TEST, self.doTest) wx.EVT_MENU(self, self.ID_ABOUT, self.doAbout) self.Bind(wx.EVT_CLOSE, self.doClose) self.Bind(wx.EVT_TIMER, self.OnTimer, id=self.ID_TIMER) wx.EVT_MENU(self, self.ID_LIVE_UPDATE, self.setLiveUpdate) wx.EVT_MENU(self, self.ID_2COL, self.do2Col) wx.EVT_MENU(self, self.ID_3COL, self.do3Col) wx.EVT_MENU(self, self.ID_4COL, self.do4Col) # editor area self.sb = self.CreateStatusBar(2) self.sb.SetStatusWidths([-1,150]) self.sb.SetStatusText('not connected',1) self.loadTool() self.sb.SetStatusText('please create or open a project...',0) self.Centre() # small hack for windows... 9-25-09 MEF self.SetBackgroundColour(wx.NullColor) self.Show(True)
def get_data(): train = pd.read_csv("../public/train.csv") entbase_ = entbase() train = merge(train, entbase_) print("basic done in " + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) del entbase_ alter_ = alter() train = merge(train, alter_) print("alter done in " + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) del alter_ branch_ = branch() train = merge(train, branch_) print("branch done in " + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) del branch_ invest_ = invest() train = merge(train, invest_) print("invest done in " + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) del invest_ right_ = right() train = merge(train, right_) print("right done in " + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) del right_ project_ = project() train = merge(train, project_) print("project done in " + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) del project_ lawsuit_ = lawsuit() train = merge(train, lawsuit_) print("lawsuit done in " + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) del lawsuit_ breakfaith_ = breakfaith() train = merge(train, breakfaith_) print("breakfaith done in " + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) del breakfaith_ recruit_ = recruit() train = merge(train, recruit_) print("recruit done in " + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) del recruit_ qualification_ = qualification() train = merge(train, qualification_) print("qualification done in " + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) del qualification_ return train
''' from scale import * from project import * from get_theta import * # Constants L = 5 # number of bits in linear program mu = 10**5 # something high # Starting point ''' To get a starting point, you need to solve an initial LP, Karger Kkoltech says, although I still have to figure out what that means. ''' # Solution loop while mu > 2**-L: # scale A and x s.t. all the x's = 1 A,x = scale(A,x) # use a projection to solve the linear system dx, dy, ds = project(A, mu) # get theta, which will tell us how *far* to move in the directions dx and ds # note that getting theta also requires knowing "n" but can know that here from #...from the length of the "x" vector. theta = get_theta(x, s, mu)
self.ui.label_3.show() self.ui.pushButton_3.show() self.ui.lineEdit_2.show() def lets_do_it(self): self.ui.label_2.show() tmp=self.ui.lineEdit_2.text() t=self.ui.lineEdit.text() count=0 for line in open('out.txt'): line = line.strip() list = line.split(',') if list[0]==t: if list[1]>=tmp: count+=1 p=count/240 self.ui.label_2.setNum(p) if __name__ == "__main__": app = QApplication(sys.argv) myapp = project() myapp.show() sys.exit(app.exec_())
self.widList.setItemSelected(item, True) def unHide(self): if len(self.listPlates.keys()) == 1: self.widList.clear() item = QListWidgetItem(self.listPlates.keys()[0]) self.widList.addItem(item) self.widList.setItemSelected(item, True) else: self.widList.setVisible(self.ref.isChecked()) def accept(self): self.refPlates = [] if len(self.widList.selectedItems()) != 0: for it in self.widList.selectedItems(): self.refPlates.append(it.text()) else: self.ref.setCheckState(Qt.Unchecked) QDialog.accept(self) if __name__ == "__main__": import sys from project import * app = QApplication(sys.argv) pl = project('toto.csv') f = EchDialog(plaque=pl) f.show() app.exec_()
def projected1(f): csvfile = open('../data/'+argv[1]+'.csv','r') readCsv(csvfile,argv[2]) w = project(argv[2],data)