Changeset 506

Show
Ignore:
Timestamp:
11/19/08 16:08:43 (2 months ago)
Author:
apdavison
Message:

Added a measure of the difference between Vm traces to the test_synaptic_integration.py script.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/test/explore_space.py

    r505 r506  
    33object. If run on a cluster, the runs will be distributed across different nodes. 
    44 
    5 Run: 
     5For a full description of usage, run: 
    66 
    77python3 explore_space.py --help 
    8  
    9 for a full description of usage. 
    108 
    119""" 
     
    7775    test_module.parameters = test_module.load_parameters(job.args[0]) 
    7876    print ds.retrieve(test_module, 'distances') 
     77    print ds.retrieve(test_module, 'vm_diff') 
    7978    ds.store(test_module, 'output', job.output) 
    8079 
  • trunk/test/simple_network.py

    r504 r506  
    115115                                           dt=self.parameters.system.timestep, 
    116116                                           t_start=min(vm_arr[:,1]), 
    117                                            t_stop=max(vm_arr[:,1])
     117                                           t_stop=max(vm_arr[:,1])+self.parameters.system.timestep
    118118        return vm 
    119119     
  • trunk/test/test_synaptic_integration.py

    r504 r506  
    3535from NeuroTools.stgen import StGen 
    3636from NeuroTools.plotting import SimpleMultiplot 
     37from NeuroTools.signals import VmList 
    3738from pyNN.utility import MultiSim, init_logging 
    3839from simple_network import SimpleNetwork 
     
    8182    return distances 
    8283 
     84def calc_Vm_diff(vm_data): 
     85    mean_stdev = {} 
     86    for sim1 in sim_list: 
     87        mean_stdev[sim1.__name__] = {} 
     88        v1 = vm_data[sim1.__name__]['post'][0] 
     89        for sim2 in sim_list: 
     90            v2 = vm_data[sim2.__name__]['post'][0] 
     91            vmlist = VmList([],[], dt=v1.dt) 
     92            # NEST seems to be missing some values at the start and end of the trace, 
     93            # so we trim all signals to the minimum length. This should be fixed in PyNN 
     94            t_start = max(v1.t_start, v2.t_start) 
     95            t_stop = min(v1.t_stop, v2.t_stop) 
     96            v1 = v1.time_slice(t_start, t_stop) 
     97            v2 = v2.time_slice(t_start, t_stop) 
     98             
     99            vmlist.append(0, v1) 
     100            vmlist.append(1, v2) 
     101            mean_stdev[sim1.__name__][sim2.__name__] = vmlist.std().mean() 
     102    return mean_stdev 
     103 
    83104def plot_figure(spike_data, vm_data, model_parameters): 
    84105    fig = SimpleMultiplot(2, 1, xlabel="Time (ms)") 
     
    121142    distances = calc_distances(spike_data) 
    122143    print distances 
     144    vm_diff = calc_Vm_diff(vm_data) 
     145    print vm_diff 
    123146 
    124147    ds = datastore.ShelveDataStore(root_dir=parameters.results_dir, key_generator=datastore.keygenerators.hash_pickle) 
    125148    this = sys.modules[__name__] 
    126149    ds.store(this, 'distances', distances) 
     150    ds.store(this, 'vm_diff', vm_diff) 
    127151    ds.store(this, 'spike_data', spike_data) 
    128152    ds.store(this, 'vm_data', vm_data)