Beispiel #1
0
    def reduce_raw_data(self):
        """
        Use the raw data in self.raw_data to populate the A and K_dex matrices
        """

        # find the maximum v and j from the Einstein and collisional rates data
        # sets and adjust the labels of the energy levels according to that
        v_max_data, j_max_data = population.find_v_max_j_max_from_data(
            self.raw_data.a_info_nnz, self.raw_data.collision_rates_info_nnz)

        self.energy_levels = self.raw_data.energy_levels
        self.energy_levels.set_labels(v_max=v_max_data + 1)

        #
        # reduce the Einstein coefficients to a 2D matrix (construct the A
        # matrix) [n_levels, n_levels]
        # A_reduced_slow = population.reduce_einstein_coefficients_slow(
        #                                 self.raw_data.A_info_nnz,
        #                                 self.energy_levels)
        a_matrix = population.reduce_einstein_coefficients(
            self.raw_data.a, self.energy_levels)
        self.a_matrix = a_matrix

        # getting the collisional de-excitation matrix (K_dex) (for all
        # tabulated values)  [n_level, n_level, n_T_kin_values]
        k_dex_matrix = population.reduce_collisional_coefficients_slow(
            self.raw_data.collision_rates_info_nnz,
            self.energy_levels,
            reduced_data_is_upper_to_lower_only=True)

        # compute the interpolator that produces K_dex at a certain temperature
        k_dex_matrix_interpolator = population.compute_k_dex_matrix_interpolator(
            k_dex_matrix, self.raw_data.collision_rates_t_range)
        self.k_dex_matrix_interpolator = k_dex_matrix_interpolator
Beispiel #2
0
    def reduce_raw_data(self):
        """
        Use the raw data in self.raw_data to populate the A and K_dex matrices
        """
        self.energy_levels = self.raw_data.energy_levels

        # find the maximum v and j from the Einstein and collisional rates
        # datasets and adjust the labels of the energy levels accordingly
        v_max_data, j_max_data = population.find_v_max_j_max_from_data(
            self.raw_data.a_info_nnz, self.raw_data.collision_rates_info_nnz,
            self.energy_levels)

        self.energy_levels.set_labels(v_max=v_max_data + 1)

        # reduce the Einstein coefficients to a 2D matrix (construct the A
        # matrix) [n_levels, n_levels]
        # A_reduced_slow = population.reduce_einstein_coefficients_slow(
        #                                 self.raw_data.A_info_nnz,
        #                                 self.energy_levels)
        a_matrix = population.reduce_einstein_coefficients(
            self.raw_data.a, self.energy_levels)

        # check that the upper triangular elements are zero. If not, issue a
        # warning and set them to zero. This check has been introduced because
        # for H2 the data by Simbotin has non-zero values in the uppter tri
        # part that are identified with the - sign in the paper
        if (a_matrix[numpy.triu_indices(a_matrix.shape[0])] != 0.0).any():
            print('warning: non-zero elements found in the reduced upper ')
            print(
                'warning: triangular part of the A matrix, set them to zero.')
            a_matrix[numpy.triu_indices(a_matrix.shape[0])] = 0.0

        self.a_matrix = a_matrix

        # DEBUG
        # utils.display_matrix(a_matrix.value, None)

        # get the collisional de-excitation matrix (K_dex) (for all
        # tabulated values)  [n_level, n_level, n_T_kin_values]
        k_dex_matrix = population.reduce_collisional_coefficients_slow(
            self.raw_data.collision_rates_info_nnz,
            self.energy_levels,
            reduced_data_is_upper_to_lower_only=True)

        # compute the interpolator that produces K_dex at a certain temperature
        k_dex_matrix_interpolator = population.compute_k_dex_matrix_interpolator(
            k_dex_matrix, self.raw_data.collision_rates_t_range)
        self.k_dex_matrix_interpolator = k_dex_matrix_interpolator