当前位置: 首页>>代码示例>>Python>>正文


Python sync.sync_network函数代码示例

本文整理汇总了Python中pyclustering.nnet.sync.sync_network函数的典型用法代码示例。如果您正苦于以下问题:Python sync_network函数的具体用法?Python sync_network怎么用?Python sync_network使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sync_network函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: templateDynamicSimulationConnectionTypeTest

    def templateDynamicSimulationConnectionTypeTest(self, num_osc, weight, connection_type):
        network = sync_network(num_osc, weight, type_conn = connection_type);
        output_dynamic = network.simulate_dynamic(collect_dynamic = False);  # Just current state of network is required
        
        clusters = output_dynamic.allocate_sync_ensembles(0.1);

        assert len(clusters) == 1;
开发者ID:RuhiSharma,项目名称:pyclustering,代码行数:7,代码来源:sync_tests.py

示例2: templateVisualizerNoFailures

 def templateVisualizerNoFailures(self, size, velocity, ccore_flag):
     net = sync_network(size, ccore = ccore_flag);
     output_dynamic = net.simulate_dynamic(solution = solve_type.FAST, collect_dynamic = True);
     
     sync_visualizer.animate_correlation_matrix(output_dynamic, velocity);
     sync_visualizer.animate_output_dynamic(output_dynamic, velocity);
     sync_visualizer.show_correlation_matrix(output_dynamic);
     sync_visualizer.show_output_dynamic(output_dynamic);
开发者ID:terry07,项目名称:pyclustering,代码行数:8,代码来源:sync_tests.py

示例3: testVisualizeLocalOrderParameterNoFailures

    def testVisualizeLocalOrderParameterNoFailures(self):
        net = sync_network(10, ccore = False);
        output_dynamic = net.simulate_static(20, 10, solution = solve_type.FAST, collect_dynamic = True);

        sync_visualizer.show_local_order_parameter(output_dynamic, net);
        sync_visualizer.show_local_order_parameter(output_dynamic, net, 0);
        sync_visualizer.show_local_order_parameter(output_dynamic, net, 5);
        sync_visualizer.show_local_order_parameter(output_dynamic, net, 5, 20);
开发者ID:annoviko,项目名称:pyclustering,代码行数:8,代码来源:ut_sync.py

示例4: templateConnectionsApi

 def templateConnectionsApi(size, ccore_flag):
     network = sync_network(size, 1, type_conn = conn_type.ALL_TO_ALL, ccore = ccore_flag);
     for i in range(len(network)):
         for j in range(len(network)):
             if (i != j):
                 assert network.has_connection(i, j) == True;
                 assert len(network.get_neighbors(i)) == size - 1, str(network.get_neighbors(i));
                 assert len(network.get_neighbors(j)) == size - 1;
开发者ID:annoviko,项目名称:pyclustering,代码行数:8,代码来源:sync_templates.py

示例5: testOutputNormalization

 def testOutputNormalization(self):
     network = sync_network(20, 1);
      
     (t, dyn) = network.simulate(50, 20, solve_type.RK4);
      
     for iteration in range(len(dyn)):
         for index_oscillator in range(len(dyn[iteration])):
             assert (dyn[iteration][index_oscillator] >= 0);
             assert (dyn[iteration][index_oscillator] <= 2.0 * pi);
开发者ID:weihuang0908,项目名称:pyclustering,代码行数:9,代码来源:sync_tests.py

示例6: testSyncOrderNetwork

 def testSyncOrderNetwork(self):
     # Check for order parameter of network with several oscillators
     network = sync_network(2, 1, ccore=False);
         
     sync_state = 1;
     tolerance = 0.1;
         
     network.simulate(50, 20, solve_type.RK4);
     assert (abs(network.sync_order() - sync_state) < tolerance) == True;
开发者ID:annoviko,项目名称:pyclustering,代码行数:9,代码来源:ut_sync.py

示例7: templateOutputDynamicCalculateLocalOrderParameter

 def templateOutputDynamicCalculateLocalOrderParameter(ccore_flag):
     net = sync_network(5, ccore = ccore_flag);
     output_dynamic = net.simulate_static(20, 10, solution = solve_type.FAST, collect_dynamic = True);
     
     assert len(output_dynamic.calculate_local_order_parameter(net, 0, 20)) == 20;
     assert len(output_dynamic.calculate_local_order_parameter(net)) == 1;
     assert len(output_dynamic.calculate_local_order_parameter(net, 5)) == 1;
     assert len(output_dynamic.calculate_local_order_parameter(net, 5, 10)) == 5;
     assert output_dynamic.calculate_local_order_parameter(net, 20)[0] > 0.9;
开发者ID:annoviko,项目名称:pyclustering,代码行数:9,代码来源:sync_templates.py

示例8: template_animate_phase_matrix

def template_animate_phase_matrix(num_osc, strength = 1.0, steps = None, time = None, conn = conn_type.ALL_TO_ALL, type_solution = solve_type.FAST, ccore_flag = True):
    network = sync_network(num_osc, strength, type_conn = conn, ccore = ccore_flag);

    if ( (steps is not None) and (time is not None) ):
        sync_output_dynamic = network.simulate(steps, time, solution = type_solution, collect_dynamic = True);
    else:
        sync_output_dynamic = network.simulate_dynamic(collect_dynamic = True, order = 0.999, solution = type_solution);

    sync_visualizer.animate_phase_matrix(sync_output_dynamic);
    return network;
开发者ID:annoviko,项目名称:pyclustering,代码行数:10,代码来源:sync_examples.py

示例9: template_dynamic_sync

def template_dynamic_sync(num_osc, k = 1, q = 1, sim_arg = None, conn = conn_type.ALL_TO_ALL, type_solution = solve_type.FAST, collect_dyn = True, ccore_flag = False):
    network = sync_network(num_osc, k, type_conn = conn, ccore = ccore_flag);
    network.cluster = q;

    if (sim_arg is not None):
        (t, dyn_phase) = network.simulate(sim_arg[0], sim_arg[1], solution = type_solution, collect_dynamic = collect_dyn);
    else:
        (t, dyn_phase) = network.simulate_dynamic(collect_dynamic = collect_dyn, solution = type_solution);
        
    draw_dynamics(t, dyn_phase, x_title = "Time", y_title = "Phase", y_lim = [0, 2 * 3.14]);
    return network;
开发者ID:weihuang0908,项目名称:pyclustering,代码行数:11,代码来源:sync_examples.py

示例10: testOutputNormalization

 def testOutputNormalization(self):
     network = sync_network(20, 1, ccore=False);
       
     output_dynamic = network.simulate(50, 20, solve_type.RK4);
      
     t = output_dynamic.time;
     dyn = output_dynamic.output;
      
     for iteration in range(len(dyn)):
         for index_oscillator in range(len(dyn[iteration])):
             assert (dyn[iteration][index_oscillator] >= 0);
             assert (dyn[iteration][index_oscillator] <= 2.0 * pi);
开发者ID:annoviko,项目名称:pyclustering,代码行数:12,代码来源:ut_sync.py

示例11: template_dynamic_sync

def template_dynamic_sync(num_osc, k = 1, sim_arg = None, conn = conn_type.ALL_TO_ALL, type_solution = solve_type.FAST, collect_dyn = True, ccore_flag = False):
    network = sync_network(num_osc, k, type_conn = conn, ccore = ccore_flag);

    if (sim_arg is not None):
        sync_output_dynamic = network.simulate(sim_arg[0], sim_arg[1], solution = type_solution, collect_dynamic = collect_dyn);
    else:
        sync_output_dynamic = network.simulate_dynamic(collect_dynamic = collect_dyn, solution = type_solution);

    sync_visualizer.show_output_dynamic(sync_output_dynamic);
    sync_visualizer.animate_output_dynamic(sync_output_dynamic);
    sync_visualizer.animate_correlation_matrix(sync_output_dynamic);
    return network;
开发者ID:terry07,项目名称:pyclustering,代码行数:12,代码来源:sync_examples.py

示例12: templateSimulateTest

 def templateSimulateTest(self, nodes = 10, weight = 1, solution = solve_type.FAST, ccore_flag = False):
     sim_time = 20;
     sim_steps = 50;
     tolerance = 0.01;
       
     network = sync_network(nodes, weight, ccore = ccore_flag);
             
     (t, dyn_phase) = network.simulate(sim_steps, sim_time, solution);
       
     index = len(dyn_phase) - 1;
     value = dyn_phase[index][0];
       
     for item in dyn_phase[index]:
         assert (abs(item - value) < tolerance) == True;
开发者ID:weihuang0908,项目名称:pyclustering,代码行数:14,代码来源:sync_tests.py

示例13: templateDynamicSimulationConnectionTypeTest

 def templateDynamicSimulationConnectionTypeTest(self, num_osc, weight, connection_type):
     testing_result = False;
     
     for _ in range(3):
         network = sync_network(num_osc, weight, type_conn = connection_type);
         output_dynamic = network.simulate_dynamic(collect_dynamic = False);  # Just current state of network is required
         
         clusters = output_dynamic.allocate_sync_ensembles(0.1);
         
         if (len(clusters) != 1):
             continue;
         
         testing_result = True;
         break;
     
     assert testing_result == True;
开发者ID:terry07,项目名称:pyclustering,代码行数:16,代码来源:sync_tests.py

示例14: templateSimulateTest

 def templateSimulateTest(nodes, weight, solution, ccore_flag):
     sim_time = 20;
     sim_steps = 50;
     tolerance = 0.01;
        
     network = sync_network(nodes, weight, ccore = ccore_flag);
              
     output_dynamic = network.simulate(sim_steps, sim_time, solution);
      
     dyn_phase = output_dynamic.output;
      
     index = len(dyn_phase) - 1;
     value = dyn_phase[index][0];
        
     for item in dyn_phase[index]:
         if ((abs(item - value) < tolerance) != True):
             print(dyn_phase[:][0]);
              
         assert (abs(item - value) < tolerance) == True;
开发者ID:annoviko,项目名称:pyclustering,代码行数:19,代码来源:sync_templates.py

示例15: testSyncLocalOrderSingleOscillator

 def testSyncLocalOrderSingleOscillator(self):
     network = sync_network(1, 1);
     assert network.sync_local_order() == 0;
开发者ID:annoviko,项目名称:pyclustering,代码行数:3,代码来源:ut_sync.py


注:本文中的pyclustering.nnet.sync.sync_network函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。