Пример #1
0
def compare_channel_data(series,
                         channelname,
                         param,
                         simulator,
                         x_range=None,
                         plot=False):
    if simulator == 'moose':
        ref_file = os.path.join(config.mydir, 'testdata',
                                '%s_%s.dat.gz' % (channelname, param))
    elif simulator == 'neuron':
        ref_file = os.path.join(config.mydir, '..', 'nrn', 'data',
                                '%s_%s.dat.gz' % (channelname, param))
    else:
        raise ValueError('Unrecognised simulator: %s' % (simulator))
    try:
        ref_series = np.loadtxt(ref_file)
    except IOError as e:
        print(e)
        return -1.0
    if plot:
        plt.figure()
        plt.title(channelname)
    return testutils.compare_data_arrays(ref_series,
                                         series,
                                         relative='meany',
                                         x_range=x_range,
                                         plot=plot)
Пример #2
0
def compare_channel_data(series, channelname, param, simulator, x_range=None, plot=False):
    if simulator == 'moose':
        ref_file = 'testdata/%s_%s.dat.gz' % (channelname, param)
    elif simulator == 'neuron':
        ref_file = '../nrn/data/%s_%s.dat.gz' % (channelname, param)
    else:
        raise ValueError('Unrecognised simulator: %s' % (simulator))
    try:
        ref_series = np.loadtxt(ref_file)
    except IOError as e:
        print(e)
        return -1.0
    if plot:
        plt.figure()
        plt.title(channelname)
    return testutils.compare_data_arrays(ref_series, series, relative='meany', x_range=x_range, plot=plot)
Пример #3
0
    np.savetxt(gk_file, data)
    print 'Saved Gk in', gk_file
    data = np.c_[tseries, ik_data.vec]
    np.savetxt(ik_file, data)
    print 'Saved Gk in', ik_file
    return params

def compare_channel_data(series, channelname, param, simulator, x_range=None, plot=False):
    if simulator == 'moose':
        ref_file = 'testdata/%s_%s.dat.gz' % (channelname, param)
    elif simulator == 'neuron':
        ref_file = '../nrn/data/%s_%s.dat.gz' % (channelname, param)
    else:
        raise ValueError('Unrecognised simulator: %s' % (simulator))
    try:
        ref_series = np.loadtxt(ref_file)
    except IOError, e:
        print e
        return -1.0
    if plot:
        plt.figure()
        plt.title(channelname)
    return testutils.compare_data_arrays(ref_series, series, relative='meany', x_range=x_range, plot=plot)

class ChannelTestBase(unittest.TestCase):
    def __init__(self, *args, **kwargs):
        unittest.TestCase.__init__(self, *args, **kwargs)

# 
# channel_test_util.py ends here