aspcore.utilities.PhaseCounter
- class aspcore.utilities.PhaseCounter(phase_lengths, verbose=False)
Bases:
object
An index counter to keep track of non-overlapping continous phases
Example: A processor needs the first 2000 samples for an initialization, then must wait 5000 samples before beginning the real processing step. The class can then be used by providing phase_def = { ‘init’ : 2000, ‘wait’ : 5000, ‘process’ : np.inf } and then checking if phase_counter.phase == ‘init’ or if phase_counter.current_phase_is(‘init’):
The number is how many samples that each phase should be The first phase will start at sample 0.
np.inf represents an infinite length This should naturally only be used for the last phase If all phases has finished, the phase will be None.
first_sample will be True on the first sample of each phase, allowing running one-time functions in each phase
Extended implementation to blocksize != 1 can be done later
- __init__(phase_lengths, verbose=False)
Methods
__init__
(phase_lengths[, verbose])current_phase_is
(phase_name)next_phase
()progress
()