Exemplo n.º 1
0
    def establish_processor(self, loop_counter=0):
        if loop_counter == 0 and self.master_equation_flag == False:
            new_file, original_rxn_eqs, master_rxn_eqs = ctic.cti_write2(
                original_cti=os.path.join(self.data_directory,
                                          self.cti_file_name),
                working_directory=self.data_directory,
                file_name=self.cti_file_name.replace('.cti', '') + '_updated')
            self.new_cti_file = new_file

        if loop_counter == 0 and self.master_equation_flag == True:
            new_file, original_rxn_eqs, master_rxn_eqs = ctic.cti_write2(
                original_cti=os.path.join(self.data_directory,
                                          self.cti_file_name),
                master_rxns=os.path.join(
                    self.data_directory,
                    self.master_reaction_equation_cti_name),
                master_index=self.master_index,
                working_directory=self.data_directory,
                file_name=self.cti_file_name.replace('.cti', '') + '_updated')
            self.new_cti_file = new_file

        processor = pr.Processor(self.new_cti_file)
        #processor = pr.Processor(self.data_directory +'/'+ self.cti_file_name)
        self.processor = processor
        return
Exemplo n.º 2
0
    def updating_files(self, loop_counter=0):
        if loop_counter == 0:
            updated_file_name_list = self.yaml_instance.yaml_file_updates(
                self.yaml_file_list_with_working_directory,
                self.list_of_parsed_yamls,
                self.experiment_dictonaries,
                self.physical_obervable_updates_list,
                loop_counter=loop_counter)
            self.updated_file_name_list = updated_file_name_list

            updated_absorption_file_name_list = self.yaml_instance.absorption_file_updates(
                self.updated_file_name_list,
                self.list_of_parsed_yamls,
                self.experiment_dictonaries,
                self.absorbance_coef_update_dict,
                loop_counter=loop_counter)

        else:

            updated_file_name_list = self.yaml_instance.yaml_file_updates(
                self.updated_yaml_file_name_list,
                self.list_of_parsed_yamls,
                self.experiment_dictonaries,
                self.physical_obervable_updates_list,
                loop_counter=loop_counter)

            updated_absorption_file_name_list = self.yaml_instance.absorption_file_updates(
                self.updated_yaml_file_name_list,
                self.list_of_parsed_yamls,
                self.experiment_dictonaries,
                self.absorbance_coef_update_dict,
                loop_counter=loop_counter)
            #print(self.original_experimental_conditions_local[0]['coupledCoefficients'],' ',loop_counter,'post simulation')

        self.updated_absorption_file_name_list = updated_absorption_file_name_list
        self.updated_yaml_file_name_list = self.updated_absorption_file_name_list

        if self.master_equation_flag == True and loop_counter / 1 == loop_counter:
            master_equation_surrogate_model_update_dictonary = self.master_equation_instance.surrogate_model_molecular_parameters_chevy(
                self.sensitivity_dict, self.master_equation_reactions,
                self.delta_x_molecular_params_by_reaction_dict)
            self.master_equation_surrogate_model_update_dictonary = master_equation_surrogate_model_update_dictonary

        #this may not be the best way to do this
        if self.master_equation_flag == True and loop_counter / 1 != loop_counter:
            master_equation_surrogate_model_update_dictonary = self.master_equation_instance.surrogate_model_molecular_parameters_chevy(
                self.sensitivity_dict, self.master_equation_reactions,
                self.delta_x_molecular_params_by_reaction_dict)
            self.master_equation_surrogate_model_update_dictonary = master_equation_surrogate_model_update_dictonary

        if self.master_equation_flag == False:
            self.master_equation_surrogate_model_update_dictonary = {}

        #update the cti files pass in the renamed file

        # is this how this function works
        if self.master_equation_flag == True:
            new_file, original_rxn_eqs, master_rxn_eqs = ctic.cti_write2(
                x=self.deltaXAsNsEas,
                original_cti=self.data_directory + '/' + self.cti_file_name,
                master_rxns=self.data_directory + '/' +
                self.master_reaction_equation_cti_name,
                master_index=self.master_index,
                MP=self.master_equation_surrogate_model_update_dictonary,
                working_directory=self.data_directory,
                file_name=self.cti_file_name.replace('.cti', '') + '_updated')

        if self.master_equation_flag == False:
            new_file, original_rxn_eqs, master_rxn_eqs = ctic.cti_write2(
                x=self.deltaXAsNsEas,
                original_cti=self.data_directory + '/' + self.cti_file_name,
                MP=self.master_equation_surrogate_model_update_dictonary,
                working_directory=self.data_directory,
                file_name=self.cti_file_name.replace('.cti', '') + '_updated')
        self.new_cti_file = new_file

        return
Exemplo n.º 3
0
import sys
sys.path.append(
    '.'
)  #get rid of this at some point with central test script or when package is built

import MSI.simulations.instruments.shock_tube as st
import MSI.cti_core.cti_processor as pr
import MSI.optimization.matrix_loader as ml
import MSI.optimization.opt_runner as opt
import MSI.simulations.absorbance.curve_superimpose as csp
import MSI.simulations.yaml_parser as yp
import MSI.cti_core.cti_combine as ctic
import cantera as ct

ctiFile = 'MSI/data/test_data/FFCM1.cti'
test_p = pr.Processor('MSI/data/test_data/FFCM1.cti')
ctiFile_Name = 'FFCM1'
new_file, original_rxn_eqs, master_rxn_eqs = ctic.cti_write2(
    original_cti=ctiFile,
    working_directory='MSI/data/test_data',
    file_name='FFCM1_updated_file')