Utility functions (pesfit.utils)
¶
-
pesfit.utils.
argpick
(cliargs, argkey, defaults)¶ Argument picker.
-
pesfit.utils.
df_collect
(params, extra_params=None, currdf=None)¶ Collect parameters from fitting outcome.
Parameters
- params: instance of
lmfit.parameter.Parameters
. Collection of fitting parameters.
- extra_params: dict | None
Extra parameters supplied as a dictionary
- currdf: instance of
pandas.DataFrame
| None An existing dataframe to append new data to.
Return
- df: instance of
pandas.DataFrame
Fitting parameters reformatted as a dataframe (keeps only names and values).
- params: instance of
-
pesfit.utils.
dict_depth
(dic, level=0)¶ Check the depth of a dictionary.
Parameters
- dic: dict
Instance of dictionary object or its subclass.
- level: int | 0
Starting level of the depth counting.
-
pesfit.utils.
dictmerge
(D, others)¶ Merge a dictionary with other dictionaries
Parameters
- D: dict
Main dictionary.
- others: list/tuple/dict
Other dictionary or composite dictionarized elements.
Return
- D: dict
Merged dictionary.
-
pesfit.utils.
partial_flatten
(arr, axis)¶ Partially flatten a multidimensional array.
Parameters
- arr: numpy array
Multidimensional array for partial flattening.
- axis: list/tuple
Axes to flatten.
Return
- arr_pf: numpy array
Partially flattened array.
-
pesfit.utils.
riffle
(*arr)¶ Interleave multiple arrays of the same number of elements.
Parameter
- *arr: array
A number of arrays
Return
- riffarr: 1D array
An array with interleaving elements from each input array.
-
pesfit.utils.
tqdmenv
(env)¶ Choose tqdm progress bar executing environment.
Parameter
- env: str
Name of the environment, ‘classic’ for ordinary environment, ‘notebook’ for Jupyter notebook.