pogona.util
Miscellaneous utility functions for the Pogona simulator.
Functions
|
Raise a ValueError if key is not a valid key for enum_class. |
|
|
|
|
|
Iterate over an iterable in n-sized chunks. |
Check if a number is a power of 2. |
|
|
Convert millilitres per minute to litres per second. |
|
Convert millilitres per minute to cubic metres per second. |
- pogona.util.check_enum_key(enum_class: Type[Enum], key: str, param_name: str)[source]
Raise a ValueError if key is not a valid key for enum_class.
- pogona.util.get_random_points_in_geometry_local(n: int, geometry: Geometry, rng: RandomState) List[ndarray] [source]
- pogona.util.grouper(iterable: Iterable, n: int, fillvalue=None)[source]
Iterate over an iterable in n-sized chunks. Based on https://stackoverflow.com/a/434411/1018176
- Parameters
iterable –
n –
fillvalue –
- Returns
- pogona.util.is_power_of_two(n)[source]
Check if a number is a power of 2. Based on https://stackoverflow.com/a/57025941/1018176
- Parameters
n –
- Returns
True iff n is a power of 2.