py2ls 0.1.8.2__py3-none-any.whl → 0.1.8.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
    
        py2ls/plot.py
    CHANGED
    
    | 
         @@ -983,9 +983,8 @@ def get_color( 
     | 
|
| 
       983 
983 
     | 
    
         
             
                cmap: str = "auto",
         
     | 
| 
       984 
984 
     | 
    
         
             
                by: str = "start",
         
     | 
| 
       985 
985 
     | 
    
         
             
                alpha: float = 1.0,
         
     | 
| 
       986 
     | 
    
         
            -
                output: str = " 
     | 
| 
      
 986 
     | 
    
         
            +
                output: str = "hue",
         
     | 
| 
       987 
987 
     | 
    
         
             
            ):
         
     | 
| 
       988 
     | 
    
         
            -
                # Extract the colormap as a list
         
     | 
| 
       989 
988 
     | 
    
         
             
                def cmap2hex(cmap_name):
         
     | 
| 
       990 
989 
     | 
    
         
             
                    cmap_ = matplotlib.pyplot.get_cmap(cmap_name)
         
     | 
| 
       991 
990 
     | 
    
         
             
                    colors = [cmap_(i) for i in range(cmap_.N)]
         
     | 
| 
         @@ -1018,6 +1017,22 @@ def get_color( 
     | 
|
| 
       1018 
1017 
     | 
    
         
             
                        rgba_values = [hex_to_rgba(hex_color, alpha) for hex_color in hex_colors]
         
     | 
| 
       1019 
1018 
     | 
    
         
             
                        return rgba_values
         
     | 
| 
       1020 
1019 
     | 
    
         | 
| 
      
 1020 
     | 
    
         
            +
                def rgba2hue(rgba_color):
         
     | 
| 
      
 1021 
     | 
    
         
            +
                    if len(rgba_color) == 3:
         
     | 
| 
      
 1022 
     | 
    
         
            +
                        r, g, b = rgba_color
         
     | 
| 
      
 1023 
     | 
    
         
            +
                        a = 1
         
     | 
| 
      
 1024 
     | 
    
         
            +
                    else:
         
     | 
| 
      
 1025 
     | 
    
         
            +
                        r, g, b, a = rgba_color
         
     | 
| 
      
 1026 
     | 
    
         
            +
                    # Convert each component to a scale of 0-255
         
     | 
| 
      
 1027 
     | 
    
         
            +
                    r = int(r * 255)
         
     | 
| 
      
 1028 
     | 
    
         
            +
                    g = int(g * 255)
         
     | 
| 
      
 1029 
     | 
    
         
            +
                    b = int(b * 255)
         
     | 
| 
      
 1030 
     | 
    
         
            +
                    a = int(a * 255)
         
     | 
| 
      
 1031 
     | 
    
         
            +
                    if a < 255:
         
     | 
| 
      
 1032 
     | 
    
         
            +
                        return "#{:02X}{:02X}{:02X}{:02X}".format(r, g, b, a)
         
     | 
| 
      
 1033 
     | 
    
         
            +
                    else:
         
     | 
| 
      
 1034 
     | 
    
         
            +
                        return "#{:02X}{:02X}{:02X}".format(r, g, b)
         
     | 
| 
      
 1035 
     | 
    
         
            +
             
     | 
| 
       1021 
1036 
     | 
    
         
             
                # Determine color list based on cmap parameter
         
     | 
| 
       1022 
1037 
     | 
    
         
             
                if "aut" in cmap:
         
     | 
| 
       1023 
1038 
     | 
    
         
             
                    colorlist = [
         
     | 
| 
         @@ -1042,15 +1057,17 @@ def get_color( 
     | 
|
| 
       1042 
1057 
     | 
    
         
             
                        for i in [int(i) for i in np.linspace(0, len(colorlist) - 1, n)]
         
     | 
| 
       1043 
1058 
     | 
    
         
             
                    ]
         
     | 
| 
       1044 
1059 
     | 
    
         | 
| 
       1045 
     | 
    
         
            -
                if  
     | 
| 
      
 1060 
     | 
    
         
            +
                if "rgb" in output.lower():
         
     | 
| 
       1046 
1061 
     | 
    
         
             
                    return hue2rgb(clist, alpha)
         
     | 
| 
       1047 
     | 
    
         
            -
                elif  
     | 
| 
       1048 
     | 
    
         
            -
                     
     | 
| 
      
 1062 
     | 
    
         
            +
                elif "h" in output.lower():
         
     | 
| 
      
 1063 
     | 
    
         
            +
                    hue_list = []
         
     | 
| 
      
 1064 
     | 
    
         
            +
                    [hue_list.append(rgba2hue(i)) for i in hue2rgb(clist, alpha)]
         
     | 
| 
      
 1065 
     | 
    
         
            +
                    return hue_list
         
     | 
| 
       1049 
1066 
     | 
    
         
             
                else:
         
     | 
| 
       1050 
1067 
     | 
    
         
             
                    raise ValueError("Invalid output type. Choose 'rgb' or 'hue'.")
         
     | 
| 
       1051 
1068 
     | 
    
         | 
| 
       1052 
1069 
     | 
    
         
             
                # # Example usage
         
     | 
| 
       1053 
     | 
    
         
            -
                # colors = get_color(n=5, cmap="viridis", by="linear", alpha=0.5)
         
     | 
| 
      
 1070 
     | 
    
         
            +
                # colors = get_color(n=5, cmap="viridis", by="linear", alpha=0.5,output='rgb')
         
     | 
| 
       1054 
1071 
     | 
    
         
             
                # print(colors)
         
     | 
| 
       1055 
1072 
     | 
    
         | 
| 
       1056 
1073 
     | 
    
         | 
| 
         @@ -136,12 +136,12 @@ py2ls/export_requirements.py,sha256=x2WgUF0jYKz9GfA1MVKN-MdsM-oQ8yUeC6Ua8oCymio, 
     | 
|
| 
       136 
136 
     | 
    
         
             
            py2ls/freqanalysis.py,sha256=F4218VSPbgL5tnngh6xNCYuNnfR-F_QjECUUxrPYZss,32594
         
     | 
| 
       137 
137 
     | 
    
         
             
            py2ls/ips.py,sha256=nGGA9Xqa5MzU5X7aE7Mfkk0qrnOkn3DGYulKuh-Ew48,100571
         
     | 
| 
       138 
138 
     | 
    
         
             
            py2ls/netfinder.py,sha256=MY_0TQY_zaRBZ6wfR4RxNCGrU93HFmDVDRRy1EXl75o,47566
         
     | 
| 
       139 
     | 
    
         
            -
            py2ls/plot.py,sha256= 
     | 
| 
      
 139 
     | 
    
         
            +
            py2ls/plot.py,sha256=WIAUDd4cRjFTX_Y_SWwsSw9_gIQF_Ye6R_-MvhB9G1k,50437
         
     | 
| 
       140 
140 
     | 
    
         
             
            py2ls/setuptools-70.1.0-py3-none-any.whl,sha256=2bi3cUVal8ip86s0SOvgspteEF8SKLukECi-EWmFomc,882588
         
     | 
| 
       141 
141 
     | 
    
         
             
            py2ls/sleep_events_detectors.py,sha256=bQA3HJqv5qnYKJJEIhCyhlDtkXQfIzqksnD0YRXso68,52145
         
     | 
| 
       142 
142 
     | 
    
         
             
            py2ls/stats.py,sha256=Wd9yCKQ_61QD29WMEgMuEcreFxF91NmlPW65iWT2B5w,39041
         
     | 
| 
       143 
143 
     | 
    
         
             
            py2ls/translator.py,sha256=bc5FB-wqC4TtQz9gyCP1mE38HqNRJ_pmuRIgKnAlMzM,30581
         
     | 
| 
       144 
144 
     | 
    
         
             
            py2ls/wb_detector.py,sha256=7y6TmBUj9exCZeIgBAJ_9hwuhkDh1x_-yg4dvNY1_GQ,6284
         
     | 
| 
       145 
     | 
    
         
            -
            py2ls-0.1.8. 
     | 
| 
       146 
     | 
    
         
            -
            py2ls-0.1.8. 
     | 
| 
       147 
     | 
    
         
            -
            py2ls-0.1.8. 
     | 
| 
      
 145 
     | 
    
         
            +
            py2ls-0.1.8.3.dist-info/METADATA,sha256=-paqLVPq6PniDxsUdZ0UVwJQIry2DrS958ohish7h2o,20017
         
     | 
| 
      
 146 
     | 
    
         
            +
            py2ls-0.1.8.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
         
     | 
| 
      
 147 
     | 
    
         
            +
            py2ls-0.1.8.3.dist-info/RECORD,,
         
     | 
| 
         
            File without changes
         
     |