Code Duplication    Length = 4-5 lines in 6 locations

pyclustering/utils/__init__.py 4 locations

@@ 677-680 (lines=4) @@
674
    for index_dyn in range(0, len(dynamic[0]), 1):
675
        if ((ignore is not None) and (index_dyn in ignore)):
676
            continue;
677
        
678
        time_stop_simulation = len(dynamic) - 1;
679
        active_state = False;
680
        
681
        if (dynamic[time_stop_simulation][index_dyn] > threshold):
682
            active_state = True;
683
            
@@ 656-659 (lines=4) @@
653
    return number_oscillations;
654
655
656
def allocate_sync_ensembles(dynamic, tolerance = 0.1, threshold = 1.0, ignore = None):
657
    """!
658
    @brief Allocate clusters in line with ensembles of synchronous oscillators where each
659
           synchronous ensemble corresponds to only one cluster.
660
    
661
    @param[in] dynamic (dynamic): Dynamic of each oscillator.
662
    @param[in] tolerance (double): Maximum error for allocation of synchronous ensemble oscillators.
@@ 812-816 (lines=5) @@
809
                else:
810
                    axes.plot(data[item][0], data[item][1], color = color, marker = marker_descr);
811
                    
812
            elif (dimension == 3):
813
                if (data is None):
814
                    axes.scatter(item[0], item[1], item[2], c = color, marker = marker_descr);
815
                else:
816
                    axes.scatter(data[item][0], data[item][1], data[item][2], c = color, marker = marker_descr);
817
        
818
        color_index += 1;
819
    
@@ 791-795 (lines=5) @@
788
        # Check for dimensions
789
        if ((dimension) == 1 or (dimension == 2)):
790
            axes = fig.add_subplot(111);
791
        elif (dimension == 3):
792
            axes = fig.gca(projection='3d');
793
        else:
794
            raise NameError('Drawer supports only 2d and 3d data representation');
795
    
796
    color_index = 0;
797
    for cluster in clusters:
798
        color = colors[color_index];

pyclustering/cluster/__init__.py 2 locations

@@ 330-333 (lines=4) @@
327
    
328
    """!
329
    @brief Draw canvas cluster descriptor.
330
    
331
    @param[in] ax (Axis): Axis of the canvas where canvas cluster descriptor should be displayed.
332
    @param[in] dimension (uint): Canvas dimension.
333
    @param[in] cluster_descr (canvas_cluster_descr): Canvas cluster descriptor that should be displayed.
334
335
    @return (fig) Figure where clusters are shown.
336
    
@@ 323-327 (lines=5) @@
320
            ax.grid(visible_grid);
321
        
322
        if (display is True):
323
            plt.show();
324
        
325
        return cluster_figure;
326
    
327
    
328
    """!
329
    @brief Draw canvas cluster descriptor.
330