code: def templateSyncEnsemblesAllocation(
      num_osc, type_conn, steps, stimulus, ccore, ensembles
  ):
      net = pcnn_network(
          num_osc,
          None,
          type_conn,
          conn_represent.MATRIX,
          None,
          None,
          ccore,
      )
      dynamic = net.simulate(steps, stimulus)
  
      assert steps == len(dynamic)
  
      sync_ensembles = dynamic.allocate_sync_ensembles()
  
      if ensembles is not None:
          assert len(ensembles) == len(sync_ensembles)
  
          for expected_ensemble in ensembles:
              ensemble_correct = False
  
              for index_ensemble in range(len(sync_ensembles)):
                  sorted_expected_ensemble = expected_ensemble.sort()
                  sorted_ensemble = sync_ensembles[
                      index_ensemble
                  ].sort()
  
                  if sorted_expected_ensemble == sorted_ensemble:
                      ensemble_correct = True
                      break
  
              assert True == ensemble_correct
  
      unique_indexes = set()
  
      time_signal = dynamic.allocate_time_signal()
      spike_ensembles = dynamic.allocate_spike_ensembles()
      sync_ensembles = dynamic.allocate_sync_ensembles()
  
      for ensemble in spike_ensembles:
          assert len(ensemble) in time_signal
  
      for ensemble in sync_ensembles:
          spike_ensembles_exist = False
          for index in range(len(spike_ensembles)):
              if ensemble == spike_ensembles[index]:
                  spike_ensembles_exist = True
                  break
  
          assert True == spike_ensembles_exist
  
          for index_oscillator in ensemble:
              assert index_oscillator not in unique_indexes
              unique_indexes.add(index_oscillator)
  
file_path: pyclustering/pyclustering/nnet/tests/pcnn_templates.py
imports: from pyclustering.nnet.pcnn import pcnn_network, pcnn_parameters, pcnn_visualizer
  from pyclustering.nnet import conn_represent
label_desc: Use image node_id 4 for calling the PcnnTestTemplates obj's underlying member method code with example usage: obj.templateSyncEnsemblesAllocation(num_osc, type_conn, steps, stimulus, ccore, ensembles) without return types