Skip to main content

weighted_tqdm

Install via pip install weighted-tqdm

Import via from weighted_tqdm import *

Description

weighted_tqdm works equivalently to tqdm, accepting all the same arguments, but also accepts a weights argument. This argument specifies the weights of each item in the iterable and can be given as a function of the iterable or be any iterable (list, array, tuple...). The progress bar will then take into account the weights of each item in it's prediciton of the time, and it's progress bar will be weighted accordingly. To the left of the progress bar an iteration counter is shown.

how_many_qubits = [1,2,3,4,5]
qubits weights = lambda x: (2**x)**3
for i in weighted_tqdm(how_many_qubits, weights=weights):
    # do something

New: Now supports p_tqdm with an additionally passed function handle for parallel execution. This functionality extends to the generators.

qudit_tqdm is a special variant of tqdm, that predicts the remaining time for calculations in quantum mechanics, with the added arguments dit specifying whether its a calculation of qubits (default dit=2 or dit=3 for qutrits), and the argument exp specifying the scaling of computational time with the dimension of a hilbert space.

for i in qudit_tqdm(how_many_qubits, dim=2, exp=3):
    time.sleep((2**i)**3)

progress is a generator of progress bars which allows each iteration within a nested set of loops to update a single progress bar. It allows adding classic tqdm, but also weighted_tqdm or qudit_tqdm to different nested loops.

p = progress()
for i in p.weighted_tqdm(range(5), weights=lambda i: (i+1), name='outer'):
    for j in p.tqdm((1,2,3,4,5), name='inner'):
        time.sleep(0.1*(i+1))

weighted_kronbinations_tqdm is the final progress bar, which allows the use of weighted progress bars for kronbination loops. Unlike the other functions, tehe update has to manually be added to every iteration.

list_of_iterators = [range(3), [1,2,3]]    # list of the iterators
list_of_weights = [ones(3), lambda x: (2**x)**3]    # weights for each iterator
indexes = np.array([[0,0], [0,1], [0,2], [1,0], [1,1], [1,2]]])    # specify the indexes which are being executed 
p = weighted_kronbinations_tqdm(list_of_iterators, list_of_weights)    # initialize the generator
p.init(indexes)    # prepare a progress bar 
for i in indexes:
    p.increment()  # update the progress bar
    time.sleep((2**list_of_iterators[1][i[1]])**3)    # do something

Authors:

By Michael Schilling

Metadata

Release files for weighted-tqdm 0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for weighted-tqdm 0.9
File Size Uploaded Provenance
weighted_tqdm-0.9.tar.gz 8.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for weighted-tqdm 0.9
File Interpreter ABI Platform
weighted_tqdm-0.9-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 kB

Release files / weighted_tqdm-0.9.tar.gz

Download URL weighted_tqdm-0.9.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5d66ec55e37b37d99c79bd7498601fffc339fb3f93423a613cfc3d0ecc696012
BLAKE2b-256 checksum
How to use checksums
ef0b8a5b8510a49e54a9f6f39fde54ef21c4094c892415c9ca0878ba334d2446
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / weighted_tqdm-0.9-py3-none-any.whl

Download URL weighted_tqdm-0.9-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c90075052475bee58d6a8c5f64d40e5b4ded0adfed2a5d57413191561bc63548
BLAKE2b-256 checksum
How to use checksums
df990616f058cceab827cf7d5e5e0a6ba684b4e4dcf4588bb1a3e3489114c11e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for weighted-tqdm 0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page