brainstate.util.split_total#
- brainstate.util.split_total(total, fraction)[source]#
Calculate the number of epochs for simulation based on a total and a fraction.
This function determines the number of epochs to simulate given a total number of epochs and either a fraction or a specific number of epochs to run.
- Parameters:
- Returns:
The calculated number of epochs to simulate.
- Return type:
- Raises:
TypeError – If total is not an integer.
ValueError – If total is not positive, fraction is negative, or if fraction as float is > 1 or as int is > total.
Examples
>>> split_total(100, 0.5) 50 >>> split_total(100, 25) 25 >>> split_total(100, 1.5) # Raises ValueError ValueError: 'fraction' value cannot be greater than 1.