Example #1
0
def somatic_features_test_JMakara_dataset(model, base_directory):
    # Load target data
    with open('../target_features/feat_rat_CA1_JMakara_more_features.json') as f:
        config_pyr = json.load(f, object_pairs_hook=collections.OrderedDict)

    observation = config_pyr
    # Load stimuli file
    stim_file = pkg_resources.resource_filename("hippounit", "tests/stimuli/somafeat_stim/stim_rat_CA1_PC_JMakara.json")
    with open(stim_file, 'r') as f:
        config = json.load(f, object_pairs_hook=collections.OrderedDict)

    # Instantiate test class
    test = tests.SomaticFeaturesTest(observation=observation, config=config, force_run=False, show_plot=True,
                                     save_all=True, base_directory=base_directory)

    # test.specify_data_set is added to the name of the subdirectory (somaticfeat), so test runs using different data sets can be saved into different directories
    test.specify_data_set = 'JMakara_data'

    # Number of parallel processes
    test.npool = 10

    try:
        # Run the test
        score = test.judge(model)
        # Summarize and print the score achieved by the model on the test using SciUnit's summarize function
        score.summarize()
    except Exception as e:
        print('Model: ' + model.name + ' could not be run')
        print(e)
        pass
from quantities import mV, nA
import sciunit
from hippounit import models
from hippounit import tests
from hippounit import capabilities

import matplotlib.pyplot as plt
import json
from hippounit import plottools
import collections

with open('./stimfeat/PC_newfeat_No14112401_15012303-m990803_stimfeat.json'
          ) as f:
    config = json.load(f, object_pairs_hook=collections.OrderedDict)

observation = config['features']

show_plot = True
test = tests.SomaticFeaturesTest(observation,
                                 force_run=False,
                                 show_plot=show_plot)

model = models.Golding()

score = test.judge(model)

score.summarize()

if show_plot:
    plt.show()