tbplas.ProgressBar

class tbplas.ProgressBar(num_tasks: int, num_scales: int = 10)

Class for reporting the progress for a time-consuming task.

_num_tasks

total number of tasks For example, if you are going to do some calculation for a vector with length of 1000, then set it to 1000.

Type:

int

_num_scales

total number of scales in the progress bar For example, if you want to split the whole task into 10 parts, then set it to 10.

Type:

int

_scale_unit

amount of tasks between two neighboring scales See the schematic plot below for demonstration.

Type:

float

_next_scale

the next scale waiting for counter If counter exceeds next_scale, then we can know one part of the task finish. See the schematic plot for demonstration.

Type:

float

_counter

number of finished jobs

Type:

int

Notes

Schematic plot of the working mechanism:

num_tasks: 50 num_scales: 10 scale_unit: 5 scales: 0—-5—-10—-15—-20—-25—-30—-35—-40—-45—-50 next_scale: ………………….* -> * -> * -> * -> * -> * -> * counter: …………….^

__init__(num_tasks: int, num_scales: int = 10) None
Parameters:
  • num_tasks – total number of tasks

  • num_scales – total number of scales in the progress bar

Methods

__init__(num_tasks[, num_scales])

param num_tasks:

total number of tasks

count()

Increase the counter by 1.

__init__(num_tasks: int, num_scales: int = 10) None
Parameters:
  • num_tasks – total number of tasks

  • num_scales – total number of scales in the progress bar

count() None

Increase the counter by 1.

Returns:

None

__weakref__

list of weak references to the object (if defined)