The utilities.py module#
Summary#
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. |
|
Build a PyChemkin mixture recipe/formula from a species fraction array. |
|
Calculate the stoichiometric coefficients. |
|
Generate a (reproducible) random floating number. |
|
Find the correct version of the given partial file name. |
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.create_mixture_recipe_from_fractions(chemistry_set: ansys.chemkin.core.chemistry.Chemistry, frac: numpy.typing.NDArray[numpy.double]) tuple[int, list[tuple[str, float]]]#
Build a PyChemkin mixture recipe/formula from a species fraction array.
- utilities.calculate_stoichiometrics(chemistryset: ansys.chemkin.core.chemistry.Chemistry, fuel_molefrac: numpy.typing.NDArray[numpy.double], oxid_molefrac: numpy.typing.NDArray[numpy.double], prod_index: numpy.typing.NDArray[numpy.int32]) tuple[float, numpy.typing.NDArray[numpy.double]]#
Calculate the stoichiometric coefficients.
- utilities.random(range: None | tuple[float, float] = None) float#
Generate a (reproducible) random floating number.
- utilities.find_file(filepath: str, partialfilename: str, fileext: str) str#
Find the correct version of the given partial file name.
- utilities.ck_rng = None#