dbdicom.Record.progress#

Record.progress(value: float, maximum: float, message: str | None = None)[source]#

Print progress message to the terminal..

Parameters:
  • value (float) – current status

  • maximum (float) – maximal value

  • message (str, optional) – Message to include in the update. Defaults to None.

Note

When working through a terminal this could easily be replicated with a print statement. The advantage of using the progress interface is that the code does not need to be changed when the computation is run through a graphical user interface (assuming this uses a compatible API).

Another advantage is that messaging can be muted/unmuted using .mute() and .unmute(), for instance when the object is passed to a subroutine.

Example

>>> nr_of_slices = 3
>>> series = db.zeros((nr_of_slices,128,128))
>>> for slice in range(nr_of_slices):
    series.progress(1+slice, nr_of_slices, 'Looping over slices')
Looping over slices [33 %]
Looping over slices [67 %]
Looping over slices [100 %]