示例#1
0
    def templateSynchronousEnsemblesAllocation(self, num_osc, own_weight,
                                               neigh_weight, steps, time,
                                               initial_states, initial_outputs,
                                               sync_ensembles_sizes):
        network = hysteresis_network(num_osc, own_weight, neigh_weight)

        if (initial_states is not None):
            network.states = initial_states

        if (initial_outputs is not None):
            network.outputs = initial_outputs

        output_dynamic = network.simulate(steps, time, collect_dynamic=True)
        ensembles = output_dynamic.allocate_sync_ensembles(0.5, 5)

        assert len(ensembles) == len(sync_ensembles_sizes)

        obtained_ensembles_sizes = [len(cluster) for cluster in ensembles]
        total_length = sum(obtained_ensembles_sizes)

        assert total_length == len(network)

        obtained_ensembles_sizes.sort()
        sync_ensembles_sizes.sort()

        assert obtained_ensembles_sizes == sync_ensembles_sizes
示例#2
0
    def templateOscillationExistance(self,
                                     num_osc,
                                     own_weight,
                                     neigh_weight,
                                     steps,
                                     time,
                                     initial_states=None,
                                     initial_outputs=None,
                                     conn_repr=conn_represent.MATRIX):
        network = hysteresis_network(num_osc,
                                     own_weight,
                                     neigh_weight,
                                     type_conn_represent=conn_repr)

        if (initial_states is not None):
            network.states = initial_states

        if (initial_outputs is not None):
            network.outputs = initial_outputs

        output_dynamic = network.simulate(steps, time)

        oscillations = []
        for index in range(num_osc):
            number_oscillations = extract_number_oscillations(
                output_dynamic.output, index, 0.9)
            oscillations.append(number_oscillations)

            assert number_oscillations > 1
def template_dynamic(num_osc, own_weight = -3, neigh_weight = -1, initial_states = None, initial_outputs = None, steps = 1000, time = 10):
    network = hysteresis_network(num_osc, own_weight, neigh_weight);
    
    if (initial_states is not None):
        network.states = initial_states;
        
    if (initial_outputs is not None):
        network.outputs = initial_outputs;
    
    (t, x) = network.simulate(steps, time);
    draw_dynamics(t, x, x_title = "Time", y_title = "x(t)");
def template_dynamic(num_osc, own_weight = -3, neigh_weight = -1, initial_states = None, initial_outputs = None, steps = 1000, time = 10):
    network = hysteresis_network(num_osc, own_weight, neigh_weight);
    
    if (initial_states is not None):
        network.states = initial_states;
        
    if (initial_outputs is not None):
        network.outputs = initial_outputs;
    
    output_dynamic = network.simulate(steps, time);
    hysteresis_visualizer.show_output_dynamic(output_dynamic);
    
    ensembles = output_dynamic.allocate_sync_ensembles(tolerance = 0.5, threshold_steps = 5);
    print("Allocated synchronous ensembles ( amout:", len(ensembles), "):", ensembles);
示例#5
0
def template_dynamic(num_osc,
                     own_weight=-3,
                     neigh_weight=-1,
                     initial_states=None,
                     initial_outputs=None,
                     steps=1000,
                     time=10):
    network = hysteresis_network(num_osc, own_weight, neigh_weight)

    if (initial_states is not None):
        network.states = initial_states

    if (initial_outputs is not None):
        network.outputs = initial_outputs

    (t, x) = network.simulate(steps, time)
    draw_dynamics(t, x, x_title="Time", y_title="x(t)")
 def templateOscillationExistance(self, num_osc, own_weight, neigh_weight, steps, time, initial_states = None, initial_outputs = None, conn_repr = conn_represent.MATRIX):
     network = hysteresis_network(num_osc, own_weight, neigh_weight, type_conn_represent = conn_repr);
     
     if (initial_states is not None):
         network.states = initial_states;
         
     if (initial_outputs is not None):
         network.outputs = initial_outputs;
     
     (t, x) = network.simulate(steps, time);
     
     oscillations = [];
     for index in range(num_osc):
         number_oscillations = extract_number_oscillations(x, index, 0.9);
         oscillations.append(number_oscillations)
         
         assert number_oscillations > 1;
         
     return oscillations;
def template_dynamic(num_osc,
                     own_weight=-3,
                     neigh_weight=-1,
                     initial_states=None,
                     initial_outputs=None,
                     steps=1000,
                     time=10):
    network = hysteresis_network(num_osc, own_weight, neigh_weight)

    if (initial_states is not None):
        network.states = initial_states

    if (initial_outputs is not None):
        network.outputs = initial_outputs

    output_dynamic = network.simulate(steps, time)
    hysteresis_visualizer.show_output_dynamic(output_dynamic)

    ensembles = output_dynamic.allocate_sync_ensembles(tolerance=0.5,
                                                       threshold_steps=5)
    print("Allocated synchronous ensembles ( amout:", len(ensembles), "):",
          ensembles)