__import__(name) return sys.modules[name] from collections import namedtuple import topo import param from lancet import PrettyPrinted from lancet import CommandTemplate from lancet import Launcher, review_and_launch from lancet import NumpyFile from topo.misc.commandline import default_output_path review_and_launch.output_directory = default_output_path() Launcher.output_directory = default_output_path() class param_formatter(param.ParameterizedFunction): """ This class is closely related to the param_formatter class in topo/command/__init__.py. Like that default class, it formats parameters as a string for use in a directory name. Unlike that default class, it does not use the parameters repr methods but the exact, succinct commandline representation as returned by a Lancet Args object. This version has several advantages over the default: - It formats values exactly as they appear in a command. For
from lancet import List, Args import topo try: from external import sys_paths submodule_paths = sys_paths() ordering = ['topographica', 'param', 'paramtk', 'imagen', 'lancet'] summarized = ['topographica', 'param', 'imagen', 'lancet'] submodules = [[p for p in submodule_paths if p.endswith(name)][0] for name in ordering] except: submodules = [] from topo.misc.commandline import default_output_path review_and_launch.output_directory = default_output_path() Launcher.output_directory = default_output_path() class topo_metadata(param.Parameterized): """ Topographica specific helper function that expands on Lancet's vcs_metadata function to generate suitable metadata information for logging with Lancet. Records Topographica version control information as well as information about all relevant submodules and the current numpy version. No arguments should be necessary when either contructing or calling this object as the default behaviour is designed to be useful. The summary method prints out the key information collected to assist with reproducibility. For instance, this may be called to print all
# Configuration file for ipython. c = get_config() import sys, os profile_dir = os.path.split(__file__)[0] project_dir = os.path.join(profile_dir, "..", "..", "..") sys.path = [os.path.abspath(project_dir)] + sys.path import external import param from topo.misc.commandline import default_output_path param.resolve_path.search_paths.append(default_output_path()) # To customize your personal settings, (e.g default settings of the # Topographica or Imagen IPython extensions), add a python script file # to the 'startup' folder. For instance, you could introduce a startup # file 'settings.py' with the following contents: # import dataviews # dataviews.ipython.VIDEO_FORMAT = 'gif' # dataviews.ipython.WARN_MISFORMATTED_DOCSTRINGS = True # For more information, please consult the README file in the # 'startup' directory.
# Configuration file for ipython. c = get_config() import sys, os profile_dir = os.path.split(__file__)[0] project_dir = os.path.join(profile_dir, '..', '..', '..') sys.path = [os.path.abspath(project_dir)] + sys.path import external import param from topo.misc.commandline import default_output_path param.resolve_path.search_paths.append(default_output_path()) # To customize your personal settings, (e.g default settings of the # Topographica or Imagen IPython extensions), add a python script file # to the 'startup' folder. For instance, you could introduce a startup # file 'settings.py' with the following contents: # import dataviews # dataviews.ipython.VIDEO_FORMAT = 'gif' # dataviews.ipython.WARN_MISFORMATTED_DOCSTRINGS = True # For more information, please consult the README file in the # 'startup' directory.