A sleek tool that displays visually appealing progress bars and draws metric based curves in real-time.
Project description
TCurve
A sleek progress bar tool
For better experience of printing on the terminal.
🚀 Spotlight
📈 Fascinating Dashboard
It shows visually appealing progress bars and draws metric based curves in real-time.
⚡ Quick Start
You can simply take it as a wrapper or help you plot curves.
import tcurve as tc
from time import sleep
# a simple wrapper
for i in tc.Dash(range(10)):
time.sleep(0.5)
# wrap a generator
for i in tc.Dash(enumerate(range(30))):
time.sleep(0.3)
# with keyword arguments
for i,n in tc.Dash(enumerate(range(30)), format={'number': [lambda x:x[1], tc.CUSTOM]}, epoch=2, mpe=30, stage='COUNT', interv=1, wipe=False):
time.sleep(0.3)
# in a complicated manner
tcd = tc.Dash(format={'Acc': ['.1f', tc.PERCENT]})
unit_acc = [0.012, 0.045, 0.134, 0.189, 0.234, 0.278, 0.345, 0.378, 0.456, 0.423, 0.51, 0.599, 0.623, 0.62, 0.7] # create a fake array for this tutorial
fake_acc = unit_acc + unit_acc[::-1] + unit_acc + unit_acc[::-1] + unit_acc + unit_acc[::-1]
for i, a in enumerate(fake_acc):
time.sleep(0.1)
tcd({'Accuracy': a}, 0, i, len(fake_acc))
🔥 Dive Deeper
Let's take the last example in previous part to show how could you use more arguments for delicate control.
# below is the common setting
unit_acc = [0.012, 0.045, 0.134, 0.189, 0.234, 0.278, 0.345, 0.378, 0.456, 0.423, 0.51, 0.599, 0.623, 0.62, 0.7] # create a fake array for this tutorial
flat_acc = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
fake_acc = 10 * (unit_acc + unit_acc[::-1] + flat_acc)
We only take this for-loop to demonstrate. First, you can use is_global=True to plot the entire curve.
tcd = tc.Dash(format={'Acc': ['.1f', tc.PERCENT]})
for i, a in enumerate(fake_acc):
time.sleep(0.1)
tcd({'Accuracy': a}, 0, i, len(fake_acc), is_global=True)
Make is_elastic=True to dynamically stretch or squeeze the vertical axis.
tcd = tc.Dash(format={'Acc': ['.1f', tc.PERCENT]})
for i, a in enumerate(fake_acc):
time.sleep(0.1)
tcd({'Accuracy': a}, 0, i, len(fake_acc), is_global=False)
Make is_elastic=True to dynamically stretch or squeeze the vertical axis so that the fluctuation of curves is prominent enough to be observed.
tcd = tc.Dash(format={'Acc': ['.1f', tc.PERCENT]})
for i, a in enumerate(fake_acc):
time.sleep(0.1)
tcd({'Accuracy': a}, 0, i, len(fake_acc), is_elastic=True)
When you have several variables, set in_loop and last_for to switch among them.
e.g in_loop=(0, 1), last_for=5 means dashboard is going to show curves of var[0] and var[1] in turns. The displayed curve changes every 5 steps.
tcd = tc.Dash(format={'Acc': ['.1f', tc.PERCENT], 'Level': ['.d', tc.RAW]})
for i, a in enumerate(fake_acc):
time.sleep(0.1)
tcd({'Accuracy': a, 'Level': i*i}, 0, i, len(fake_acc), in_loop=(0, 1), last_for=5)
What's more, you can even draw the gray image on the terminal.
tcd = tc.Dash(format={'I': [lambda *x:1, tc.IMAGE]})
for i, img in enumerate(images):
time.sleep(0.1)
# read images here
tcd({'I': img}, 0, i, len(images))
Try to squint at the right side. :D
📦 Installation
Install tcurve via pip
pip install tcurve
Install the following libs to access full functions.
- numpy
- pandas
- matplotlib
- seaborn
❤️ Support
If you find TCurve helpful, please give it a ⭐ on GitHub! ▶️ https://github.com/SeriaQ/TCurve
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tcurve-0.1.0.tar.gz.
File metadata
- Download URL: tcurve-0.1.0.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4c390cb05380513bc993330293549d48a16da1bf026bc54531d6590f49affd7
|
|
| MD5 |
47012a50771304f464670bf338a3f3d2
|
|
| BLAKE2b-256 |
577fea432d5d2c4817d62ad0e3cb0a5d121bbd5853be6cba3ac22e68a94d8bce
|
File details
Details for the file tcurve-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tcurve-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
393fef9a32784d9280ede826a1ddfd9f21a31194a8aed65a1e84cbff0c01a017
|
|
| MD5 |
4ee0f2ea1b3c725baa3bde70fa9b4465
|
|
| BLAKE2b-256 |
d66eae68d67cd55a0b0a6712cc700338922d797999269414908cde7c69966553
|