Exemple #1
0
def write_and_compile_nmodl(component):
    build_dir = os.path.join(BUILD_DIR, component.name.replace('-', '_'))
    clear_and_recreate_dir(build_dir)
    if not component.is_flat():
        component = flatten(component)
    ComponentModifier.close_all_reduce_ports(component=component)
    print '  -- Writing Component to .mod'
    modfilename = os.path.join(build_dir, component.name + '.mod').replace('-', '_')
    write_nmodldirect(component=component, mod_filename=modfilename, weight_variables={})
    compile_nmodl(build_dir)
Exemple #2
0
from nineml.abstraction_layer.testing_utils import TestableComponent
from nineml.abstraction_layer.flattening import flatten
#from nineml.abstraction_layer.flattening import ComponentFlattener
from nineml.abstraction_layer.component_modifiers import ComponentModifier
from nineml.utility import LocationMgr
#from nineml.abstraction_layer.visitors import RenameSymbol

LocationMgr.StdAppendToPath()

comp_data = TestableComponent('nestequivalent_iaf_cond_exp')

# Build the component:
component = comp_data()
component = flatten(component)
component.backsub_all()
ComponentModifier.close_all_reduce_ports(component=component)

# Copy the descriptive strings:
component.short_description = comp_data.metadata.short_description
component.long_description = comp_data.metadata.long_description

# Get the initial regime. If this component comes from an flattened component,
# then we should look up the new regime from the locations in the old
# components, hence the nedd for this code:
initial_regime = comp_data.metadata.initial_regime
if component.was_flattened():
    new_regime = component.flattener.get_new_regime(initial_regime)
    initial_regime = new_regime.name

from nestbuilder import NestFileBuilder
nfb = NestFileBuilder(
Exemple #3
0
from nineml.abstraction_layer.flattening import flatten
#from nineml.abstraction_layer.flattening import ComponentFlattener
from nineml.abstraction_layer.component_modifiers import ComponentModifier
from nineml.utility import LocationMgr
#from nineml.abstraction_layer.visitors import RenameSymbol

LocationMgr.StdAppendToPath()


comp_data = TestableComponent('nestequivalent_iaf_cond_exp')

# Build the component:
component = comp_data()
component = flatten( component )
component.backsub_all()
ComponentModifier.close_all_reduce_ports(component=component)


# Copy the descriptive strings:
component.short_description = comp_data.metadata.short_description 
component.long_description = comp_data.metadata.long_description 



# Get the initial regime. If this component comes from an flattened component, 
# then we should look up the new regime from the locations in the old
# components, hence the nedd for this code:
initial_regime = comp_data.metadata.initial_regime
if component.was_flattened():
    new_regime = component.flattener.get_new_regime(initial_regime)
    initial_regime = new_regime.name