plotilleresample 0.5__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.
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env python3
2
+
3
+ from plotilleresample.plotilleresample import resample_plot
4
+ from plotilleresample.plotilleresample import resample_scatter
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env python3
2
+
3
+ # This value is used to avoid Nyquist related problems.
4
+ plot_multiplier = 4
5
+
6
+ list_val = list[int]
7
+
8
+
9
+ def resample_plot(
10
+ X: list_val,
11
+ Y: list_val,
12
+ width: int = 80,
13
+ height: int = 40
14
+ ) -> tuple[list_val, list_val]:
15
+ """
16
+
17
+ :param X: list_val: List of X values.
18
+ :param Y: list_val: List of Y values.
19
+ :param width: int: Width of the plot. (Default value = 80)
20
+ :param height: int: Height of the plot. (Default value = 40)
21
+
22
+ """
23
+ if len(X) > width * plot_multiplier:
24
+ step = round(len(X) / width / plot_multiplier)
25
+ print(step)
26
+
27
+ if step != 0:
28
+ X = [
29
+ X[i] for i in range(
30
+ 0, len(X), step
31
+ )
32
+ ]
33
+ Y = [
34
+ Y[i] for i in range(
35
+ 0, len(Y), step
36
+ )
37
+ ]
38
+
39
+ return X, Y
40
+
41
+
42
+ def resample_scatter(
43
+ X: list_val,
44
+ Y: list_val,
45
+ width: int = 80,
46
+ height: int = 40
47
+ ) -> tuple[list_val, list_val]:
48
+ """
49
+
50
+ :param X: list_val: List of X values.
51
+ :param Y: list_val: List of Y values.
52
+ :param width: int: Width of the plot. (Default value = 80)
53
+ :param height: int: Height of the plot. (Default value = 40)
54
+
55
+ """
56
+ scatter_multiplier = width * 2 * height
57
+ if len(X) > scatter_multiplier:
58
+ step = round(len(X) / scatter_multiplier)
59
+ print(step)
60
+
61
+ if step != 0:
62
+ X = [
63
+ X[i] for i in range(
64
+ 0, len(X), step
65
+ )
66
+ ]
67
+ Y = [
68
+ Y[i] for i in range(
69
+ 0, len(Y), step
70
+ )
71
+ ]
72
+
73
+ return X, Y
@@ -0,0 +1,78 @@
1
+ Metadata-Version: 2.4
2
+ Name: plotilleresample
3
+ Version: 0.5
4
+ Summary: Python module to resample datasets before plotting with Plotille.
5
+ Author-email: "Carlos A. Planchón" <carlosandresplanchonprestes@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Romepage, https://github.com/carlosplanchon/plotilleresample
8
+ Keywords: plotting,ascii,math,resample
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Topic :: Software Development :: Build Tools
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Dynamic: license-file
21
+
22
+ # plotilleresample
23
+ *Python module to resample datasets before plotting with Plotille.*
24
+
25
+ ## Installation
26
+ ### Install with UV:
27
+ ```
28
+ uv add plotilleresample
29
+ ```
30
+
31
+ ## Usage
32
+ ```
33
+ #!/usr/bin/env python3
34
+
35
+ import plotille
36
+
37
+ import plotilleresample
38
+
39
+ import math
40
+
41
+ from shutil import get_terminal_size
42
+
43
+ from vtclear import clear_screen
44
+
45
+ import numpy as np
46
+
47
+
48
+ w = get_terminal_size().columns - 20
49
+ h = get_terminal_size().lines - 7
50
+
51
+ r = 10000
52
+ res = np.random.normal(size=r)
53
+
54
+ # Here I'm testing stuffs with histograms.
55
+ # input("Histogram:")
56
+ # print(plotille.histogram(res, bins=w*2, width=w, height=h))
57
+
58
+ X = [i for i in range(r)]
59
+ Y = [math.sin(i / 100) * 100 for i in range(r)]
60
+
61
+ print(" · Scatter...")
62
+ xs, ys = plotilleresample.dim_reduction_scatter(X, Y, w, h)
63
+ print(" · Plot...")
64
+ xp, yp = plotilleresample.dim_reduction_plot(X, Y, w, h)
65
+ print(" --- READY ---")
66
+
67
+ print(f"Len plot.x {len(xp)}")
68
+
69
+ print(f"Len scatter.x {len(xs)}")
70
+
71
+ input("Plot:")
72
+ clear_screen()
73
+ print(plotille.plot(xp, yp, w, h))
74
+
75
+ input("Scatter:")
76
+ clear_screen()
77
+ print(plotille.plot(xs, ys, w, h))
78
+ ```
@@ -0,0 +1,7 @@
1
+ plotilleresample/__init__.py,sha256=9x-lYLB0RZ-u1mUFzLqmzYyxOH7lly9NhyyGRfxAJUs,147
2
+ plotilleresample/plotilleresample.py,sha256=8lI6_LsbRF969wfF7hFOZ8h6XBuEq2Yh2XtjNYtaeXM,1729
3
+ plotilleresample-0.5.dist-info/licenses/LICENSE,sha256=dUqwRhq9nAYp-zfLbCuFB1d_dlg7PjxGZzNMPCTaa0c,1076
4
+ plotilleresample-0.5.dist-info/METADATA,sha256=FxCr569csqNQvlTEQDZVC17dhGnlzWlkvf7-8pr7wVE,1911
5
+ plotilleresample-0.5.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
6
+ plotilleresample-0.5.dist-info/top_level.txt,sha256=DlcSBzQfxkzLQCgpu-5qILo9UhXtoTVzzcAGZ3DvQEs,17
7
+ plotilleresample-0.5.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Carlos A. Planchón
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ plotilleresample