pytams.utils¶
A set of utility functions for TAMS.
Functions¶
|
Indicates Windows platform. |
|
Indicates MacOS platform. |
|
Setup the logger parameters. |
|
Get the nworker lower scored trajectories or more if equal score. |
|
Return the moving average of a 1D numpy array. |
|
Helper function getting local imported mods list. |
|
Generate a subclass skeleton. |
Module Contents¶
- setup_logger(params: dict[Any, Any]) None[source]¶
Setup the logger parameters.
- Parameters:
params – a dictionary of parameters
- get_min_scored(maxes: numpy.typing.NDArray[Any], nworkers: int) tuple[list[int], numpy.typing.NDArray[Any]][source]¶
Get the nworker lower scored trajectories or more if equal score.
- Parameters:
maxes – array of maximas across all trajectories
nworkers – number of workers
- Returns:
list of indices of the nworker lower scored trajectories array of minimas
- moving_avg(arr_in: numpy.typing.NDArray[Any], window_l: int) numpy.typing.NDArray[Any][source]¶
Return the moving average of a 1D numpy array.
- Parameters:
arr_in – 1D numpy array
window_l – length of the moving average window
- Returns:
1D numpy array
- get_module_local_import(module_name: str) list[str][source]¶
Helper function getting local imported mods list.
When pickling the forward model code, the model itself can import from several other local files. We also want to pickle those by value so let’s get the list.
- Parameters:
module_name – a module name we want the locally imported modules
- Returns:
A list of local modules names imported within the provide module