def run_selection(): result_window.delete(0, "end") start_time = time.time() b = selection.Selection() b.main() result = str(round(time.time() - start_time, 2)) + " Seconds" result_window.insert(0, result)
def __init__(self, parent, **kwargs): Tk.Frame.__init__(self, parent, **kwargs) self.print_filter_jobs = [] self.parent = parent self.config(bg="#e0fcf4") self.jobs_display_frame = Tk.Frame(self, bg="#7afdd6") self.search_frame = Tk.Frame(self, borderwidth=1, relief='solid', bg='#e0fcf4') self.all_jobs_display_frame = Tk.Frame(self, bg="#7afdd6") self.selection = sel.Selection() self.add_delete = addel.AdDel() self.search_table_field_font = tkFont.Font(size=18, weight='bold') self.search_table_results_font = tkFont.Font(size=12, weight='bold') self.job_id_font = tkFont.Font(size=15) self.test_converter = { 2: "Metal", 3: "Potency", 33: "dPotency", 4: "Toxins", 5: "Pests", 7: "Terps", 8: "Solv", 9: "Oth", 1: "M.A", 6: "M.B", 10: "F.ID", 11: "Mushrooms" }
def __init__(self, parent): Tk.Frame.__init__(self, parent) self.parent = parent self.customer_display_frame = Tk.Frame(self) self.search_frame = Tk.Frame(self) self.all_customer_display_frame = Tk.Frame(self) self.selection = sel.Selection()
def __init__(self, parent, **kwargs): Tk.Frame.__init__(self, parent, **kwargs) self.parent = parent self.config(bg="#e0fcf4") self.edit_entry = editentry.EditEntry() self.selection = selection.Selection() self.addel = addel.AdDel() self.search_table_field_font = tkFont.Font(size=18, weight='bold') self.search_table_results_font = tkFont.Font(size=12, weight='bold') self.test_converter = { 2: "Metals (ICP)", 3: "Basic Potency", 33: "Deluxe Potency", 4: "Afloxtoxins", 5: "Pesticides", 7: "Terpenes", 8: "Solvents", 9: "Other Tests", 1: "Micro A", 6: "Micro B", 10: "Fungal ID", 11: "Shrooms" } self.main_customerpage_frame = Tk.Frame(self) self.customer_scroll_frame_canvas = Tk.Frame(self) self.customer_scroll_frame = Tk.Frame(self)
def __init__(self, config): DataContainer.__init__(self, config) self.conditions = dict() self.control = None self.use_scores = True self.normalize_wt = False try: if 'normalize wt' in config: if config['normalize wt'] is True: self.normalize_wt = True for cnd in config['conditions']: if not cnd['label'].isalnum(): raise EnrichError( "Alphanumeric label required for condition '{label}'". format(label=cnd['label']), self.name) for sel_config in cnd[ 'selections']: # assign output base if not present if 'output directory' not in sel_config: sel_config['output directory'] = self.output_base if cnd['label'] not in self.conditions: self.conditions[cnd['label']] = [ selection.Selection(x) for x in cnd['selections'] ] else: raise EnrichError( "Non-unique condition label '{label}'".format( label=cnd['label']), self.name) if 'control' in cnd: if cnd['control']: if self.control is None: self.control = self.conditions[cnd['label']] else: raise EnrichError("Multiple control conditions", self.name) except KeyError as key: raise EnrichError( "Missing required config value {key}".format(key=key), self.name) all_selections = list() for key in self.conditions: all_selections.extend(self.conditions[key]) for dtype in all_selections[0].df_dict: if all(dtype in x.df_dict for x in all_selections): self.df_dict[dtype] = True if len(self.df_dict.keys()) == 0: raise EnrichError( "No enrichment data present across all selections", self.name) # ensure consistency for score usage if not all(x.use_scores for x in all_selections): self.use_scores = False # ensure consistency for wild type normalization for sel in all_selections: sel.normalize_wt = self.normalize_wt
def __init__(self, parent, **kwargs): Tk.Frame.__init__(self, parent, **kwargs) self.parent = parent self.config(bg="#e0fcf4") self.Selection = sel.Selection() self.AddDelete = addel.AdDel() self.search_table_field_font = tkFont.Font(size=18, weight='bold') self.search_table_results_font = tkFont.Font(size=12, weight='bold') self.customer_page_main_frame = Tk.Frame(self) self.customer_list_display_frame = Tk.Frame(self) self.customer_search_info_box = Tk.Frame(self)
def MouseMiddleDown(self, event): if (event.WindowName == None or event.WindowName == "FolderView"): self.dragging = True print("mouse right down while dragging") self.startX = event.Position[0] self.startY = event.Position[1] self.endX = self.startX self.endY = self.startY self.currentSelection = selection.Selection(self.uiParent, self.startX, self.startY) self.currentSelection.deiconify() return True
def __init__(self, parent, **kwargs): Tk.Frame.__init__(self, parent, **kwargs) self.parent = parent self.config(bg="#eceae6") self.people_display_frame = Tk.Frame(self, bg="#eceae6") self.search_frame = Tk.Frame(self, borderwidth=1, relief='solid', bg='#eceae6') self.all_people_display_frame = Tk.Frame(self, bg="#eceae6") self.selection = sel.Selection() self.search_table_field_font = tkFont.Font(size=18, weight='bold') self.search_table_results_font = tkFont.Font(size=14, weight='bold') self.people_id_font = tkFont.Font(size=16)
def DrawLine(self, line, dc): if self.IsLine(line): l = line t = self.lines[l] dc.SetTextForeground(self.fgColor) fragments = selection.Selection(self.SelectBegin, self.SelectEnd, self.sx, self.sw, line, t) x = 0 for (data, selected) in fragments: if selected: dc.SetTextBackground(self.selectColor) if x == 0 and len(data) == 0 and len(fragments) == 1: data = ' ' else: dc.SetTextBackground(self.bgColor) self.DrawEditText(data, x, line - self.sy, dc) x += len(data)
def __init__(self, parent, **kwargs): Tk.Frame.__init__(self, parent, **kwargs) self.parent = parent self.config(bg="#eceae6") self.large_bold_font_choice = tkFont.Font(size=18, weight='bold') self.bold_font_choice = tkFont.Font(size=14, weight='bold') self.add_delete_query = ad.AdDel() self.selection_query = sel.Selection() self.add_new_person_frame = Tk.Frame(self, bg='#eceae6') self.name_entry = Tk.Entry(self.add_new_person_frame, highlightbackground="#eceae6") self.org_entry = Tk.Entry(self.add_new_person_frame, highlightbackground="#eceae6") self.filler_canvas = Tk.Canvas(self, width=1100, height=600, bg="#eceae6", highlightbackground="#eceae6") self.organization_dictionary = {} self.organizations_list = ["None"]
def __init__(self, config): DataContainer.__init__(self, config) self.conditions = dict() self.control = None self.use_scores = True try: for cnd in config['conditions']: if not cnd['label'].isalnum(): raise EnrichError( "Alphanumeric label required for condition '%s'" % cnd['label'], self.name) for sel_config in cnd[ 'selections']: # assign output base if not present if 'output directory' not in sel_config: sel_config['output directory'] = self.output_base self.conditions[cnd['label']] = [ selection.Selection(x) for x in cnd['selections'] ] if cnd['control']: if self.control is None: self.control = self.conditions[cnd['label']] else: raise EnrichError("Multiple control conditions", self.name) except KeyError as key: raise EnrichError("Missing required config value %s" % key, self.name) all_selections = list() for key in self.conditions: all_selections.extend(self.conditions[key]) for dtype in all_selections[0].df_dict: if all(dtype in x.df_dict for x in all_selections): self.df_dict[dtype] = True if len(self.df_dict.keys()) == 0: raise EnrichError( "No enrichment data present across all selections", self.name) for key in self.conditions: if any(len(x.timepoints) == 2 for x in self.conditions[key]): self.use_scores = False
def __init__(self, parent, **kwargs): Tk.Frame.__init__(self, parent, **kwargs) self.parent = parent self.config(bg="#eceae6") self.title_font = tkFont.Font(size=18, weight='bold') self.regular_font = tkFont.Font(size=12, weight='bold') self.basic_information_window = Tk.Frame(self, bg="#eceae6") self.person_font = tkFont.Font(size=24, weight='bold') self.selection = selection.Selection() self.addel = addel.AdDel() self.notes_for_person_frame = Tk.Frame(self, bg="#eceae6") self.notes_for_organization_frame = Tk.Frame(self, bg='#eceae6') self.person_notes = Tk.Text(self.notes_for_person_frame, borderwidth=1, width=55, height=20, font=self.regular_font, wrap="word") self.organization_notes = Tk.Text(self.notes_for_organization_frame, borderwidth=1, width=55, height=20, font=self.regular_font, wrap="word")
def __init__(self, parent, **kwargs): Tk.Frame.__init__(self, parent, **kwargs) self.parent = parent self.config(bg="#e0fcf4") self.large_bold_font_choice = tkFont.Font(size=16, weight='bold') self.smaller_bold_font_choice = tkFont.Font(size=12, weight='bold') self.add_delete_query = ad.AdDel() self.select_query = sel.Selection() self.add_new_job_frame = Tk.Frame(self, bg='#e0fcf4') self.job_notes_frame = Tk.Frame(self, bg='#e0fcf4') self.jobnumber_entry = Tk.Entry(self.add_new_job_frame) self.client_name_entry = Tk.Entry(self.add_new_job_frame) self.job_notes = Tk.Text(self.job_notes_frame, borderwidth=1, width=65, height=20, wrap="word") self.existing_client_variable = Tk.StringVar(self.add_new_job_frame) self.existing_client_variable.set("New Client") # Checkboxes self.metals = Tk.IntVar() self.metals_checkbox = Tk.Checkbutton(self.add_new_job_frame, text='2) metals', variable=self.metals, bg='#e0fcf4') self.basic_potency = Tk.IntVar() self.basic_potency_checkbox = Tk.Checkbutton( self.add_new_job_frame, text='3) basic potency', variable=self.basic_potency, bg='#e0fcf4') self.deluxe_potency = Tk.IntVar() self.deluxe_potency_checkbox = Tk.Checkbutton( self.add_new_job_frame, text='3a) deluxe potency', variable=self.deluxe_potency, bg='#e0fcf4') self.toxins = Tk.IntVar() self.toxins_checkbox = Tk.Checkbutton(self.add_new_job_frame, text='4) Aflotoxins', variable=self.toxins, bg='#e0fcf4') self.pesticides = Tk.IntVar() self.pesticides_checkbox = Tk.Checkbutton(self.add_new_job_frame, text='5) Pesticides', variable=self.pesticides, bg='#e0fcf4') self.terpenes = Tk.IntVar() self.terpenes_checkbox = Tk.Checkbutton(self.add_new_job_frame, text='7) Terpenes', variable=self.terpenes, bg='#e0fcf4') self.solvents = Tk.IntVar() self.solvents_checkbox = Tk.Checkbutton(self.add_new_job_frame, text='8) Solvents', variable=self.solvents, bg='#e0fcf4') self.other = Tk.IntVar() self.other_checkbox = Tk.Checkbutton(self.add_new_job_frame, text='Other', variable=self.other, bg='#e0fcf4') self.micro_a = Tk.IntVar() self.micro_a_checkbox = Tk.Checkbutton(self.add_new_job_frame, text='1) Micro A', variable=self.micro_a, bg='#e0fcf4') self.micro_b = Tk.IntVar() self.micro_b_checkbox = Tk.Checkbutton(self.add_new_job_frame, text='6) Micro B', variable=self.micro_b, bg='#e0fcf4') self.fungal_id = Tk.IntVar() self.fungal_id_checkbox = Tk.Checkbutton(self.add_new_job_frame, text='Fungal ID', variable=self.fungal_id, bg='#e0fcf4') self.mushrooms = Tk.IntVar() self.mushrooms_checkbox = Tk.Checkbutton(self.add_new_job_frame, text='Psilocybin', variable=self.mushrooms, bg='#e0fcf4') self.existing_client_list = ['New Client'] self.filter_list = [ '#', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ] for item in self.select_query.select_all_from_customer_table_descending( 7): self.existing_client_list.append(item[2])
def run(self, env): best_rewards = [] start_time = time() root = Node(None, None) best_actions = [] best_reward = float("-inf") sel = selection.Selection() behv_state = copy.deepcopy(env) behv_last_visit = copy.deepcopy(env) behv_rewards = copy.deepcopy(env) for p in range(self.playouts): if (p % 50 == 0): if (self.ns.behavior_switch): print('exchanging behavior') self.ns.switch_behavior() print(p) state = copy.deepcopy(env) sum_reward = 0 amaf_actions = {} node = root terminal = False actions = [] sel_size = 0 # selection while node.children: #sel_size+=1 #if sel_size > self.max_depth: # break if node.explored_children < len(node.children): child = node.children[node.explored_children] node.explored_children += 1 node = child else: node = sel.select(node.children, ucb_type=self.sel_type, e=self.e) self.e *= self.decay _, reward, terminal = state.step(node.action) if (self.do_ns): behv = (state.posx, state.posy) self.ns.build_behavior(behv, node.action, False, False) #self.ns.put_behavior(behv,action) sum_reward += reward actions.append(node.action) amaf_actions[str(node.action)] = 1 # expansion if not terminal: node.children = expand.default(node, state) #node.children = [Node(node, a) for a in state.get_possible_actions()] random.shuffle(node.children) # playout while not terminal: pactions = state.get_possible_actions() action = pactions[random.randint(0, len(pactions) - 1)] _, reward, terminal = state.step(action) if (self.do_ns): behv = (state.posx, state.posy) #self.ns.put_behavior(behv,action) self.ns.build_behavior(behv, action, False, False) sum_reward += reward actions.append(action) amaf_actions[str(node.action)] = 1 if len(actions) > self.max_depth: sum_reward -= 100 break # remember best if best_reward < sum_reward: best_reward = sum_reward best_actions = actions #Behavior nv_reward = 0 br = behv_rewards.maze[state.posx, state.posy] if (self.do_ns): behv = (state.posx, state.posy) #nv_reward =self.ns.get_approx_novelty(behv) #self.ns.put_behavior(behv) #print('len rollout: ',len(actions)) nv_reward = self.ns.get_approx_novelty( self.ns.episode_behavior, done=True) self.ns.build_behavior(behv, action, True, True) #self.ns.put_behavior(self.ns.episode_behavior,action,done=True) debug(behv_state, behv_last_visit, behv_rewards, nv_reward, p, state) else: debug(behv_state, behv_last_visit, behv_rewards, sum_reward, p, state) #Update update.backpropagate(node, sum_reward, nv_reward, amaf_actions, update_type=self.update_type) sum_reward = 0 nv_reward = 0 print('e: ', self.e) print('##############') print(behv_state.render()) print('last visit') print(behv_last_visit.render()) print('last reward') print(behv_rewards.render()) return best_actions
def __init__(self, parent, **kwargs): Tk.Frame.__init__(self, parent, **kwargs) self.parent = parent self.jobpage_text_font = tkFont.Font(size=10, weight='bold') self.jobpage_font = tkFont.Font(size=10, weight='bold') self.picture_frame = Tk.Frame(self, bg="#e0fcf4", highlightbackground='#613a3a', highlightcolor='#613a3a', highlightthickness=2) self.picture_sub_frame = Tk.Frame(self.picture_frame, bg="#e0fcf4") self.notes_for_job_frame = Tk.Frame(self, bg="#e0fcf4", highlightbackground='#613a3a', highlightcolor='#613a3a', highlightthickness=2) self.job_notes = Tk.Text(self.notes_for_job_frame, borderwidth=1, width=70, height=10, font=self.jobpage_text_font, wrap="word") self.text_reports = Tk.Text(self.notes_for_job_frame, borderwidth=1, width=70, height=15, font=self.jobpage_text_font, wrap="word") self.title_font = tkFont.Font(size=16, weight='bold') self.basic_information_window = Tk.Frame(self, bg="#e0fcf4", highlightbackground='#613a3a', highlightcolor='#613a3a', highlightthickness=2) self.update_information_frame = Tk.Frame(self, bg="#e0fcf4", highlightbackground='#613a3a', highlightcolor='#613a3a', highlightthickness=2) self.test_display_frame = Tk.Frame(self, bg="#e0fcf4", highlightbackground='#613a3a', highlightcolor='#613a3a', highlightthickness=2) self.links_display_frame = Tk.Frame(self, bg="#e0fcf4", highlightbackground='#613a3a', highlightcolor='#613a3a', highlightthickness=2) self.good_copies_display_frame = Tk.Frame( self, bg="#e0fcf4", highlightbackground='#613a3a', highlightcolor='#613a3a', highlightthickness=2) self.update_entry = Tk.Entry(self.update_information_frame) self.job_number_font = tkFont.Font(size=16, weight='bold') self.edit_entry = editentry.EditEntry() self.selection = selection.Selection() self.addel = addel.AdDel() self.cannajobs_converter = { 'Job Number': 2, 'Tests': 3, 'Client Name': 4, 'Receive Date': 5, 'Status': 6 } self.test_converter = { 2: "Metals (ICP)", 3: "Basic Potency", 33: "Deluxe Potency", 4: "Afloxtoxins", 5: "Pesticides", 7: "Terpenes", 8: "Solvents", 9: "Other Tests", 1: "Micro A", 6: "Micro B", 10: "Fungal ID", 11: "Shrooms" }
import bubble as b import insertion as i import selection as s a = [6, 5, 4, 3, 2, 1, 7, 9, 10, 34] b = [1, 2, 3, 4, 5, 6] bub = b.Bubble(a) bub.bubble() sel = s.Selection(a) sel.selection() ins = s.Insertion(a) ins.insertion()
for course in item: isin = False for items in sc: if items == course: isin = True break if isin == False: flag2 = False break if flag2 == False: flag = False break return flag s = sl.Selection(d) print([ sc for sc in s.schemes() if len(sc) >= minnum and nothave(sc) == True and nothavesame(sc) == True and musthave(sc) == True and musthavesame(sc) == True ]) print(minnum) for sc in s.schemes(): if len(sc) >= minnum and nothave(sc) == True and nothavesame( sc) == True and musthave(sc) == True and musthavesame(sc) == True: app = applicaton(sc, d.get_courses()) app.mainloop() ''' print([sc for sc in s.schemes() '''