Esempio n. 1
0
def test_mechanism_serialize():
    """ephys.mechanisms: Testing serialize"""
    mech = utils.make_mech()
    serialized = mech.to_dict()
    nt.ok_(isinstance(json.dumps(serialized), str))
    deserialized = instantiator(serialized)
    nt.ok_(isinstance(deserialized, ephys.mechanisms.NrnMODMechanism))
Esempio n. 2
0
def test_mechanism_serialize():
    """ephys.mechanisms: Testing serialize"""
    mech = utils.make_mech()
    serialized = mech.to_dict()
    nt.assert_true(isinstance(json.dumps(serialized), str))
    deserialized = instantiator(serialized)
    nt.assert_true(isinstance(deserialized, ephys.mechanisms.NrnMODMechanism))
Esempio n. 3
0
def test_create_hoc():
    mech = utils.make_mech()
    parameters = utils.make_parameters()

    hoc = create_hoc.create_hoc([mech, ], parameters, template_name='CCell')
    nt.ok_('load_file' in hoc)
    nt.ok_('CCell' in hoc)
    nt.ok_('begintemplate' in hoc)
    nt.ok_('endtemplate' in hoc)
Esempio n. 4
0
def test__generate_channels_by_location():
    mech = utils.make_mech()
    channels = create_hoc._generate_channels_by_location([mech, ])

    nt.eq_(len(channels['apical']), 1)
    nt.eq_(len(channels['basal']), 1)

    nt.eq_(channels['apical'], ['Ih'])
    nt.eq_(channels['basal'], ['Ih'])
Esempio n. 5
0
def test_create_hoc():
    """ephys.create_hoc: Test create_hoc"""
    mech = utils.make_mech()
    parameters = utils.make_parameters()

    hoc = create_hoc.create_hoc([mech, ], parameters, template_name='CCell')
    nt.ok_('load_file' in hoc)
    nt.ok_('CCell' in hoc)
    nt.ok_('begintemplate' in hoc)
    nt.ok_('endtemplate' in hoc)
Esempio n. 6
0
def test__generate_channels_by_location():
    """ephys.create_hoc: Test _generate_channels_by_location"""
    mech = utils.make_mech()
    channels = create_hoc._generate_channels_by_location([mech, ])

    nt.assert_equal(len(channels['apical']), 1)
    nt.assert_equal(len(channels['basal']), 1)

    nt.assert_equal(channels['apical'], ['Ih'])
    nt.assert_equal(channels['basal'], ['Ih'])
Esempio n. 7
0
def test__generate_channels_by_location():
    """ephys.create_hoc: Test _generate_channels_by_location"""
    mech = utils.make_mech()
    channels = create_hoc._generate_channels_by_location(
        [mech, ], DEFAULT_LOCATION_ORDER)

    nt.assert_equal(len(channels['apical']), 1)
    nt.assert_equal(len(channels['basal']), 1)

    nt.assert_equal(channels['apical'], ['Ih'])
    nt.assert_equal(channels['basal'], ['Ih'])
def test__generate_channels_by_location():
    mech = utils.make_mech()
    channels = create_hoc._generate_channels_by_location([
        mech,
    ])

    nt.eq_(len(channels['apical']), 1)
    nt.eq_(len(channels['basal']), 1)

    nt.eq_(channels['apical'], ['Ih'])
    nt.eq_(channels['basal'], ['Ih'])
Esempio n. 9
0
def test_create_hoc_filename():
    """ephys.create_hoc: Test create_hoc template_filename"""
    mech = utils.make_mech()
    parameters = utils.make_parameters()

    hoc = create_hoc.create_hoc([mech, ],
                                parameters, template_name='CCell',
                                template_filename='test.jinja2',
                                template_dir=os.path.join(
                                    os.path.dirname(__file__),
                                    'testdata'))
    nt.ok_('load_file' in hoc)
    nt.ok_('CCell' in hoc)
    nt.ok_('begintemplate' in hoc)
    nt.ok_('endtemplate' in hoc)
    nt.ok_('Test template' in hoc)
Esempio n. 10
0
def test_create_hoc_filename():
    """ephys.create_hoc: Test create_hoc template_filename"""
    mech = utils.make_mech()
    parameters = utils.make_parameters()

    hoc = create_hoc.create_hoc([
        mech,
    ],
                                parameters,
                                template_name='CCell',
                                template_filename='test.jinja2',
                                template_dir=os.path.join(
                                    os.path.dirname(__file__), 'testdata'))
    nt.ok_('load_file' in hoc)
    nt.ok_('CCell' in hoc)
    nt.ok_('begintemplate' in hoc)
    nt.ok_('endtemplate' in hoc)
    nt.ok_('Test template' in hoc)
Esempio n. 11
0
def test_create_hoc_filename():
    """ephys.create_hoc: Test create_hoc template_filename"""
    mech = utils.make_mech()
    parameters = utils.make_parameters()
    custom_param_val = 'printf("Hello world!")'

    hoc = create_hoc.create_hoc([mech, ],
                                parameters, template_name='CCell',
                                template_filename='test.jinja2',
                                template_dir=os.path.join(
                                    os.path.dirname(__file__),
                                    'testdata'),
                                custom_jinja_params={
                                    'custom_param': custom_param_val})
    nt.ok_('load_file' in hoc)
    nt.ok_('CCell' in hoc)
    nt.ok_('begintemplate' in hoc)
    nt.ok_('endtemplate' in hoc)
    nt.ok_('Test template' in hoc)
    nt.ok_(custom_param_val in hoc)