Code Duplication    Length = 4-5 lines in 6 locations

pyclustering/utils/__init__.py 4 locations

@@ 677-680 (lines=4) @@
674
        active_state = False;
675
        
676
        if (dynamic[time_stop_simulation][index_dyn] > threshold):
677
            active_state = True;
678
            
679
        # if active state is detected, it means we don't have whole oscillatory period for the considered oscillator, should be skipped.
680
        if (active_state is True):
681
            while ( (dynamic[time_stop_simulation][index_dyn] > threshold) and (time_stop_simulation > 0) ):
682
                time_stop_simulation -= 1;
683
            
@@ 656-659 (lines=4) @@
653
    @brief Allocate clusters in line with ensembles of synchronous oscillators where each
654
           synchronous ensemble corresponds to only one cluster.
655
    
656
    @param[in] dynamic (dynamic): Dynamic of each oscillator.
657
    @param[in] tolerance (double): Maximum error for allocation of synchronous ensemble oscillators.
658
    @param[in] threshold (double): Amlitude trigger when spike is taken into account.
659
    @param[in] ignore (bool): Set of indexes that shouldn't be taken into account.
660
    
661
    @return (list) Grours (lists) of indexes of synchronous oscillators, for example, 
662
            [ [index_osc1, index_osc3], [index_osc2], [index_osc4, index_osc5] ].
@@ 812-816 (lines=5) @@
809
                    axes.scatter(item[0], item[1], item[2], c = color, marker = marker_descr);
810
                else:
811
                    axes.scatter(data[item][0], data[item][1], data[item][2], c = color, marker = marker_descr);
812
        
813
        color_index += 1;
814
    
815
    for item in noise:
816
        if (dimension == 1):
817
            if (data is None):
818
                axes.plot(item[0], 0.0, 'w' + marker_descr);
819
            else:
@@ 791-795 (lines=5) @@
788
        else:
789
            raise NameError('Drawer supports only 2d and 3d data representation');
790
    
791
    color_index = 0;
792
    for cluster in clusters:
793
        color = colors[color_index];
794
        for item in cluster:
795
            if (dimension == 1):
796
                if (data is None):
797
                    axes.plot(item[0], 0.0, color = color, marker = marker_descr);
798
                else:

pyclustering/cluster/__init__.py 2 locations

@@ 330-333 (lines=4) @@
327
                    ax.plot(data[item][0], 0.0, color = color, marker = marker, markersize = markersize);
328
329
            elif (dimension == 2):
330
                if (data is None):
331
                    ax.plot(item[0], item[1], color = color, marker = marker, markersize = markersize);
332
                else:
333
                    ax.plot(data[item][0], data[item][1], color = color, marker = marker, markersize = markersize);
334
        
335
            elif (dimension == 3):
336
                if (data is None):
@@ 323-327 (lines=5) @@
320
        color = cluster_descr.color;
321
        
322
        for item in cluster:
323
            if (dimension == 1):
324
                if (data is None):
325
                    ax.plot(item[0], 0.0, color = color, marker = marker, markersize = markersize);
326
                else:
327
                    ax.plot(data[item][0], 0.0, color = color, marker = marker, markersize = markersize);
328
329
            elif (dimension == 2):
330
                if (data is None):