def _grouped_in_projections(self, ptype): """ Return a dictionary of lists of incoming Projections, grouped by type. Each projection of type <ptype> is grouped according to the name of the port, into a single list within the dictionary. The entry None will contain those that are not of type <ptype>, while the other entries will contain a list of Projections, each of which has type ptype. Example: to obtain the lists of projections that should be jointly normalised together, call __grouped_in_projection('JointNormalize'). """ in_proj = OrderedDict() in_proj[None] = [] # Independent (ungrouped) connections for c in self.in_connections: d = c.dest_port if not isinstance(c, Projection): self.debug("Skipping non-Projection " + c.name) elif isinstance(d, tuple) and len(d) > 2 and d[1] == ptype: if in_proj.get(d[2]): in_proj[d[2]].append(c) else: in_proj[d[2]] = [c] #elif isinstance(d,tuple): # raise ValueError("Unable to determine appropriate action for dest_port: %s (connection %s)." % (d,c.name)) else: in_proj[None].append(c) return in_proj
def _grouped_in_projections(self, ptype): """ Return a dictionary of lists of incoming Projections, grouped by type. Each projection of type <ptype> is grouped according to the name of the port, into a single list within the dictionary. The entry None will contain those that are not of type <ptype>, while the other entries will contain a list of Projections, each of which has type ptype. Example: to obtain the lists of projections that should be jointly normalised together, call __grouped_in_projection('JointNormalize'). """ in_proj = OrderedDict() in_proj[None] = [] # Independent (ungrouped) connections for c in self.in_connections: d = c.dest_port if not isinstance(c, Projection): self.debug("Skipping non-Projection " + c.name) elif isinstance(d, tuple) and len(d) > 2 and d[1] == ptype: if in_proj.get(d[2]): in_proj[d[2]].append(c) else: in_proj[d[2]] = [c] # elif isinstance(d,tuple): # raise ValueError("Unable to determine appropriate action for dest_port: %s (connection %s)." % (d,c.name)) else: in_proj[None].append(c) return in_proj
def refresh_plots_menu(self): plots_menu = self['Plots'] plots_menu.delete(0, 'end') # create menu entries, and get list of categories entries = OrderedDict( ) # keep the order of plotgroup_templates (which is also KL) categories = [] for label, plotgroup in plotgroups.items(): entries[label] = PlotsMenuEntry(plotgroup) categories.append(plotgroup.category) categories = sorted(set(categories)) # The Basic category items appear on the menu itself. assert 'Basic' in categories, "'Basic' is the category for the standard Plots menu entries." for label, entry in entries.items(): if entry.plotgroup.category == 'Basic': plots_menu.add_command(label=label, command=entry.__call__) categories.remove('Basic') plots_menu.add_separator() # Add the other categories to the menu as cascades, and the plots of each category to # their cascades. for category in categories: category_menu = ControllableMenu(plots_menu, tearoff=0) plots_menu.add_cascade(label=category, menu=category_menu) # could probably search more efficiently than this for label, entry in entries.items(): if entry.plotgroup.category == category: category_menu.add_command(label=label, command=entry.__call__) plots_menu.add_separator() plots_menu.add_command( label="Help", command=(lambda x=plotting_help_locations: self.open_location(x)))
def refresh_plots_menu(self): plots_menu = self['Plots'] plots_menu.delete(0,'end') # create menu entries, and get list of categories entries=OrderedDict() # keep the order of plotgroup_templates (which is also KL) categories = [] for label,plotgroup in plotgroups.items(): entries[label] = PlotsMenuEntry(plotgroup) categories.append(plotgroup.category) categories = sorted(set(categories)) # The Basic category items appear on the menu itself. assert 'Basic' in categories, "'Basic' is the category for the standard Plots menu entries." for label,entry in entries.items(): if entry.plotgroup.category=='Basic': plots_menu.add_command(label=label,command=entry.__call__) categories.remove('Basic') plots_menu.add_separator() # Add the other categories to the menu as cascades, and the plots of each category to # their cascades. for category in categories: category_menu = ControllableMenu(plots_menu,tearoff=0) plots_menu.add_cascade(label=category,menu=category_menu) # could probably search more efficiently than this for label,entry in entries.items(): if entry.plotgroup.category==category: category_menu.add_command(label=label,command=entry.__call__) plots_menu.add_separator() plots_menu.add_command(label="Help",command=(lambda x=plotting_help_locations: self.open_location(x)))
index = p.targets.index("allsnapshottests") p.targets[index] = "snapshots" p.targets.insert(index,"pickle") # ->params ? tests_dir = param.resolve_path("topo/tests",path_to_file=False) scripts_dir = param.resolve_path(".",path_to_file=False) ### XXX topographica_script = xvfb + " " + timing_cmd + " " + sys.argv[0] + " " + " " def _runc(cmd): print cmd return os.system(cmd) from dataviews.odict import OrderedDict target = OrderedDict() speedtarget = OrderedDict() # CEBALERT: need to pick which scripts to include for training and # speedtests and startupspeedtests (see test_script.py). # # From the Makefile: # SCRIPTS= ^hierarchical.ty ^lissom_or.ty ^lissom_oo_or.ty ^som_retinotopy.ty ^sullivan_neurocomputing04.ty ^lissom.ty ^lissom_fsa.ty ^gcal.ty ^lissom_whisker_barrels.ty # CEB: tests on these scripts temporarily suspended (SF.net #2053538) # ^lissom_oo_or_homeostatic.ty ^lissom_oo_or_homeostatic_tracked.ty # ^lissom_or_noshrinking.ty - only matches to 4 dp with IMPORT_WEAVE=0 # Now I'm using this list for train-tests: # CEBALERT: this list should be defined in one place. #from setup import TRAINSCRIPTS
p.targets[index] = "snapshots" p.targets.insert(index, "pickle") # ->params ? tests_dir = param.resolve_path("topo/tests", path_to_file=False) scripts_dir = param.resolve_path(".", path_to_file=False) ### XXX topographica_script = xvfb + " " + timing_cmd + " " + sys.argv[0] + " " + " " def _runc(cmd): print cmd return os.system(cmd) from dataviews.odict import OrderedDict target = OrderedDict() speedtarget = OrderedDict() # CEBALERT: need to pick which scripts to include for training and # speedtests and startupspeedtests (see test_script.py). # # From the Makefile: # SCRIPTS= ^hierarchical.ty ^lissom_or.ty ^lissom_oo_or.ty ^som_retinotopy.ty ^sullivan_neurocomputing04.ty ^lissom.ty ^lissom_fsa.ty ^gcal.ty ^lissom_whisker_barrels.ty # CEB: tests on these scripts temporarily suspended (SF.net #2053538) # ^lissom_oo_or_homeostatic.ty ^lissom_oo_or_homeostatic_tracked.ty # ^lissom_or_noshrinking.ty - only matches to 4 dp with IMPORT_WEAVE=0 # Now I'm using this list for train-tests: # CEBALERT: this list should be defined in one place. #from setup import TRAINSCRIPTS TRAINSCRIPTS = [