The utilities.py module#
Summary#
folder/file utilities for multiple runs. |
Find number of occurrence and indices of the target value in an array. |
|
Use bisectional method to find the largest index in the array. |
|
Find the indices branket the given value. |
|
Find the y-value corresponding to the x-value in data pairs. |
|
Generate a (reproducible) random floating number. |
|
Return a list of random integers from a given integer list. |
|
Find the correct version of the given partial file name. |
|
Copy a file from the source folder to the target folder. |
|
Delete files with specified extensions. |
|
Check if Pychemkin is running in any Jupyter environment. |
|
Interpolate value from a binary data array. |
Description#
pychemkin utilities.
Module detail#
- utilities.where_element_in_array_1d(arr: numpy.typing.NDArray[numpy.double] | numpy.typing.NDArray[numpy.int32], target: float) tuple[int, numpy.typing.NDArray[numpy.int32]]#
Find number of occurrence and indices of the target value in an array.
- utilities.bisect(ileft: int, iright: int, x: float, xarray) int#
Use bisectional method to find the largest index in the array.
- utilities.find_interpolate_parameters(x: float, xarray: numpy.typing.NDArray[numpy.double]) tuple[int, float]#
Find the indices branket the given value.
- utilities.interpolate_array(x: float, x_array: numpy.typing.NDArray[numpy.double], y_array: numpy.typing.NDArray[numpy.double]) float#
Find the y-value corresponding to the x-value in data pairs.
- utilities.random(range: None | tuple[float, float] = None) float#
Generate a (reproducible) random floating number.
- utilities.random_pick_integers(numb_picks: int, source_integers: list[int]) tuple[list[int], list[int]]#
Return a list of random integers from a given integer list.
- utilities.find_file(filepath: str, partialfilename: str, fileext: str) str#
Find the correct version of the given partial file name.
- utilities.copy_file(sourcepath: str, targetpath: str, filename: str, new_file_name: str | None = None)#
Copy a file from the source folder to the target folder.
- utilities.delete_files_by_extension(targetpath: str, extensions: list[str])#
Delete files with specified extensions.
- utilities.check_jupyter_notebook() bool#
Check if Pychemkin is running in any Jupyter environment.
- utilities.interpolate_point(x_value: float, x_array: list[float] | numpy.typing.NDArray[numpy.double], y_array: list[float] | numpy.typing.NDArray[numpy.double]) tuple[int, float]#
Interpolate value from a binary data array.
- utilities.ck_rng = None#