Exemple #1
0
    def building_matrices(self, loop_counter=0):
        matrix_builder_instance = ml.OptMatrix()
        self.matrix_builder_instance = matrix_builder_instance
        S_matrix = matrix_builder_instance.load_S(self.experiment_dictonaries,
                                                  self.list_of_parsed_yamls,
                                                  dk=self.perturbment)
        self.S_matrix = S_matrix

        if loop_counter == 0:
            Y_matrix, Y_data_frame = matrix_builder_instance.load_Y(
                self.experiment_dictonaries,
                self.list_of_parsed_yamls,
                loop_counter=loop_counter)
        else:
            Y_matrix, Y_data_frame = matrix_builder_instance.load_Y(
                self.experiment_dictonaries,
                self.list_of_parsed_yamls,
                loop_counter=loop_counter,
                X=self.X_to_subtract_from_Y)

        self.Y_matrix = Y_matrix
        self.Y_data_frame = Y_data_frame

        z_matrix, z_data_frame, sigma = matrix_builder_instance.build_Z(
            self.experiment_dictonaries,
            self.list_of_parsed_yamls,
            loop_counter=loop_counter,
            reaction_uncertainty=self.data_directory + '/' +
            self.reaction_uncertainty_csv)
        self.z_matrix = z_matrix
        self.z_data_frame = z_data_frame
        self.sigma = sigma
        return
Exemple #2
0
    def building_matrices(self, loop_counter=0):

        matrix_builder_instance = ml.OptMatrix()
        self.matrix_builder_instance = matrix_builder_instance
        S_matrix = matrix_builder_instance.load_S(
            self.experiment_dictonaries,
            self.list_of_parsed_yamls,
            dk=self.perturbment,
            master_equation_reactions=self.master_equation_reactions,
            mapped_master_equation_sensitivites=self.MP_for_S_matrix,
            master_equation_flag=self.master_equation_flag)
        self.S_matrix = S_matrix

        if loop_counter == 0:
            Y_matrix, Y_data_frame = matrix_builder_instance.load_Y(
                self.experiment_dictonaries,
                self.list_of_parsed_yamls,
                loop_counter=loop_counter,
                master_equation_flag=self.master_equation_flag,
                master_equation_uncertainty_df=self.
                master_equation_uncertainty_df,
                master_equation_reactions=self.master_equation_reactions)
        else:
            Y_matrix, Y_data_frame = matrix_builder_instance.load_Y(
                self.experiment_dictonaries,
                self.list_of_parsed_yamls,
                loop_counter=loop_counter,
                X=self.X_to_subtract_from_Y,
                master_equation_flag=self.master_equation_flag,
                master_equation_uncertainty_df=self.
                master_equation_uncertainty_df,
                master_equation_reactions=self.master_equation_reactions)

        self.Y_matrix = Y_matrix
        self.Y_data_frame = Y_data_frame

        z_matrix, z_data_frame, sigma, active_parameters = matrix_builder_instance.build_Z(
            self.experiment_dictonaries,
            self.list_of_parsed_yamls,
            loop_counter=loop_counter,
            reaction_uncertainty=self.data_directory + '/' +
            self.reaction_uncertainty_csv,
            master_equation_uncertainty_df=self.master_equation_uncertainty_df,
            master_equation_flag=self.master_equation_flag,
            master_equation_reaction_list=self.master_equation_reactions)
        self.z_matrix = z_matrix
        self.z_data_frame = z_data_frame
        self.sigma = sigma
        self.active_parameters = active_parameters
        return
]
yaml_instance = yp.Parser()
list_of_yaml_objects = yaml_instance.load_yaml_list(yaml_list=yaml_file_list)
list_of_experiment_dicts = yaml_instance.parsing_multiple_dictonaries(
    list_of_yaml_objects=list_of_yaml_objects)

optimization_instance = opt.Optimization_Utility()

test = optimization_instance.looping_over_parsed_yaml_files(
    list_of_experiment_dicts,
    yaml_file_list,
    processor=test_p,
    kineticSens=1,
    physicalSens=1,
    dk=.01)
matix_instance = ml.OptMatrix()

Y_matrix, Y1 = matix_instance.load_Y(test,
                                     list_of_experiment_dicts,
                                     loop_counter=0)

z_matrix, z1, sigma = matix_instance.build_Z(
    test,
    list_of_experiment_dicts,
    loop_counter=0,
    reaction_uncertainty='MSI/data/test_data/uncertainty_test.csv')

x1, x2, x3, x4 = matix_instance.breakup_delta_x(z_matrix[257:],
                                                test,
                                                loop_counter=0)
Exemple #4
0
#                          simulation:sim.instruments.shock_tube.shockTube,
#                          interpolated_kinetic_sens:dict,
#                          interpolated_tp_sens:list,
#                          interpolated_species_sens:list,
#                          interpolated_absorbance:list=[]):
optimization_instance = opt.Optimization_Utility()
exp_1 = optimization_instance.build_single_exp_dict(
    1, test_tube, int_ksens_exp_mapped, int_tp_psen_against_experimental,
    int_spec_psen_against_experimental)  #no absorbance in experiment 1

exp_2 = optimization_instance.build_single_exp_dict(
    2,
    test_tube2,
    int_ksens_exp_mapped2,
    int_tp_psen_against_experimental2,
    int_spec_psen_against_experimental2,
    interpolated_absorbance=interp_abs2_exp)  #absorbance in experiment 2
print("Experiments built successfully")
#print(exp_2['ksens']['A'][0].shape)
#print(exp_2['species'][0].shape)
#print(exp_2['species'][1].shape)
#print(exp_2['species'][2].shape)

####################
# Build the S matrix #
####################
mloader = ml.OptMatrix()
S = mloader.load_S([exp_1, exp_2])

print(S)