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

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

weighted_tqdm-0.5.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

weighted_tqdm-0.5-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file weighted_tqdm-0.5.tar.gz.

File metadata

  • Download URL: weighted_tqdm-0.5.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.15

File hashes

Hashes for weighted_tqdm-0.5.tar.gz
Algorithm Hash digest
SHA256 c6ca3a91f626d4051bede77e4c910bfb4c88a7abf6fcd07236528bad171e0a11
MD5 67d03b3e67b00d53a84b6f40b9074088
BLAKE2b-256 4c9a6cfa1b0e927bc024da2a421eb9edc02b77a84dacbeaf3b92ec5bfbd1b2c1

See more details on using hashes here.

File details

Details for the file weighted_tqdm-0.5-py3-none-any.whl.

File metadata

  • Download URL: weighted_tqdm-0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.15

File hashes

Hashes for weighted_tqdm-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2eadce2d2d0503da532f10cc7c38bb78d4157e679b6ef47bdb920d50c0eab365
MD5 240a41bc763576461bf45c1c0e95be83
BLAKE2b-256 de96f5427059e9192a9562cf40ffe00bae97bbb5a8ae0d21b29a268d64204428

See more details on using hashes here.

Release history Release notifications | RSS feed

0.9

2 files

0.8

2 files

0.7

2 files

0.6

2 files

This release

0.5 This release

2 files

0.4

2 files

0.3

2 files

0.2

2 files

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