sisl.mixing.StepMixer
- class sisl.mixing.StepMixer(*yield_funcs)
Bases:
BaseMixer
Step between different mixers in a user-defined fashion
This is handy for creating variable mixing schemes that alternates (or differently) between multiple mixers.
Examples
Alternate between two mixers:
>>> mixer = StepMixer( ... StepMixer.yield_repeat(mix1, 1), ... StepMixer.yield_repeat(mix2, 1))
One may also create custom based generators which can interact with the mixers in between different mixers:
>>> def gen(): ... yield mix1 ... mix1.history.clear() ... yield mix1 ... yield mix1 ... yield mix2
A restart mixer for history mixers:
>>> def gen(): ... for _ in range(50): ... yield mix ... mix.history.clear()
Methods
next
()Return the current mixer, and step the internal mixer
yield_chain
(*yield_funcs)Returns a function which yields from each of the function arguments in turn
yield_repeat
(mixer, n)Returns a function which repeats mixer n times
Return the current mixer