1010from rmgpy .tools .canteramodel import generate_cantera_conditions
1111from rmgpy .tools .data import GenericData
1212
13+ from arc .common import save_yaml_file
14+
1315from t3 .common import get_observable_label_from_header , get_parameter_from_header
1416from t3 .logger import Logger
1517from t3 .simulate .adapter import SimulateAdapter
@@ -382,12 +384,23 @@ def simulate(self):
382384
383385 self .all_data .append ((time , condition_data , reaction_sensitivity_data , thermodynamic_sensitivity_data ))
384386
385- def get_sa_coefficients (self ):
387+ def get_sa_coefficients (self ,
388+ top_SA_species : int = 10 ,
389+ top_SA_reactions : int = 10 ,
390+ max_workers : int = 24 ,
391+ save_yaml : bool = True ,
392+ ) -> Optional [dict ]:
386393 """
387394 Obtain the SA coefficients.
388395
396+ Args:
397+ top_SA_species (int, optional): The number of top sensitive species to return.
398+ top_SA_reactions (int, optional): The number of top sensitive reactions to return.
399+ max_workers (int, optional): The maximal number of workers to use for parallel processing.
400+ save_yaml (bool, optional): Save the SA dictionary to a YAML file.
401+
389402 Returns:
390- sa_dict (dict): a SA dictionary, whose structure is given in the docstring for T3/t3/main.py
403+ sa_dict (Optional[ dict] ): a SA dictionary, whose structure is given in the docstring for T3/t3/main.py
391404 """
392405 sa_dict = {'kinetics' : dict (), 'thermo' : dict (), 'time' : list ()}
393406
@@ -411,7 +424,8 @@ def get_sa_coefficients(self):
411424 sa_dict ['thermo' ][observable_label ] = dict ()
412425 parameter = get_parameter_from_header (spc )
413426 sa_dict ['thermo' ][observable_label ][parameter ] = spc .data
414-
427+ if save_yaml :
428+ save_yaml_file (path = self .paths ['SA dict' ], content = sa_dict )
415429 return sa_dict
416430
417431 def get_idt_by_T (self ):
0 commit comments