eval_model¶
Evaluate chemical kinetic models against experimental ignition-delay data.
- members:
- pyteck.eval_model.calculate_error_function(ignition_delays_exp, ignition_delays_sim, standard_dev)[source]¶
Calculate the error and deviation functions for a dataset.
Cases that did not ignite—indicated by a simulated ignition delay of zero or a non-finite value—are excluded from the averages, so that a single non-ignition does not drive the whole dataset’s error to infinity (see issues #1 and #18).
- Parameters:
ignition_delays_exp (numpy.ndarray) – Experimental ignition delays
ignition_delays_sim (numpy.ndarray) – Simulated ignition delays (zero or non-finite where no ignition occurred)
standard_dev (float) – Standard deviation of the experimental data
- Returns:
error_func (float) – Mean squared logarithmic error over the igniting cases (
nanif none of the cases ignited)dev_func (float) – Mean logarithmic deviation over the igniting cases (
nanif none of the cases ignited)
- pyteck.eval_model.create_simulations(dataset, properties)[source]¶
Set up individual simulations for each ignition delay value.
- Parameters:
dataset (str) – Name of dataset file
properties (pyked.chemked.ChemKED) – ChemKED object with full set of experimental properties
- Returns:
simulations – List of simulation cases (
BaseSimulationsubclass instances), one per datapoint- Return type:
- pyteck.eval_model.estimate_std_dev(indep_variable, dep_variable)[source]¶
Estimate standard deviation of experimental data via a spline fit.
- Parameters:
indep_variable (numpy.ndarray or list of float) – Independent variable (e.g., temperature, pressure)
dep_variable (numpy.ndarray or list of float) – Dependent variable (e.g., ignition delay)
- Returns:
standard_dev – Standard deviation of difference between data and best-fit line
- Return type:
- pyteck.eval_model.evaluate_model(model_name, spec_keys_file, dataset_file, data_path='data', model_path='models', results_path='results', model_variant_file=None, num_threads=None, print_results=False, restart=False, skip_validation=False)[source]¶
Evaluate the ignition delay error of a model for a given dataset.
- Parameters:
model_name (str) – Chemical kinetic model filename
spec_keys_file (str) – Name of YAML file identifying important species
dataset_file (str) – Name of file with list of data files
data_path (str, optional) – Local path for data files (default:
"data")model_path (str, optional) – Local path for the model file (default:
"models")results_path (str, optional) – Local path for creating results files (default:
"results")model_variant_file (str, optional) – Name of YAML file identifying ranges of conditions for variants of the kinetic model (default:
None)num_threads (int, optional) – Number of CPU threads to use for running simulations in parallel. The default (
None) uses the number of available cores minus one.print_results (bool, optional) – If
True, print results of the model evaluation to screen (default:False).restart (bool, optional) – If
True, reuse existing results files and only compute new cases (default:False).skip_validation (bool, optional) – If
True, skip validation of ChemKED files (default:False).
- Returns:
output – Dictionary with all information about model evaluation results
- Return type:
- pyteck.eval_model.get_changing_variable(cases)[source]¶
Identify variable changing across multiple cases.
- Parameters:
cases (list of pyked.chemked.DataPoint) – List of DataPoint with experimental case data
- Returns:
variable – Values of the changing experimental variable
- Return type:
- pyteck.eval_model.min_deviation = 0.1¶
minimum allowable standard deviation for experimental data
- Type:
- pyteck.eval_model.read_dataset_list(dataset_file)[source]¶
Read the list of dataset files, skipping blank or whitespace-only lines.
- Parameters:
dataset_file (str or pathlib.Path) – Name of file listing dataset files, one per line
- Returns:
Names of the dataset files, stripped of surrounding whitespace and with blank lines removed
- Return type:
- pyteck.eval_model.select_variant_suffix(variant, properties)[source]¶
Build the model-file suffix for a model variant from a case’s properties.
Some models ship as several files that differ by bath gas and/or nominal pressure. The
model_variantmapping records, for each such model, the filename suffix to use for each bath gas and pressure. This selects the suffix appropriate for a given experimental case.- Parameters:
variant (dict) – Model-variant entry, optionally with
"bath gases"and/or"pressures"maps from a bath-gas name / pressure to a filename suffixproperties (pyked.chemked.DataPoint) – Experimental case properties (
compositionis a dict keyed by species name, andpressureis a pint quantity)
- Returns:
Suffix to append to the model filename (empty if no variant applies)
- Return type:
- pyteck.eval_model.simulation_worker(sim_tuple)[source]¶
Worker for multiprocessing of simulation cases.
- Parameters:
sim_tuple (tuple) – Contains a
BaseSimulationinstance and the parameters needed to set up and run the case:(sim, model_file, model_spec_key, path, restart)- Returns:
sim – Simulation case with results ready for
process_results- Return type: