예제 #1
0
    def check_complex_entries(self, lineEdit_real, lineEdit_imag, label):

        self.stop = False
        if lineEdit_real.text() != "":
            try:
                real_F = float(lineEdit_real.text())
            except Exception:
                error("Wrong input for real part of {}!".format(label),
                      "Error")
                self.stop = True
                return
        else:
            real_F = 0

        if lineEdit_imag.text() != "":
            try:
                imag_F = float(lineEdit_imag.text())
            except Exception:
                error("Wrong input for imaginary part of {}!".format(label),
                      "Error")
                self.stop = True
                return
        else:
            imag_F = 0

        if real_F == 0 and imag_F == 0:
            return None
        else:
            return real_F + 1j * imag_F
예제 #2
0
    def loadList(self):

        self.list_names = []
        self.list_ids = []
        self.list_colors = []

        try:
            config = configparser.ConfigParser()
            config.read(self.materialPath)

            for mat in config.sections():
                material = config[mat]
                name = str(material['name'])
                identifier = str(material['identifier'])
                density = str(material['density'])
                young_modulus = str(material['young modulus'])
                poisson = str(material['poisson'])
                color = str(material['color'])

                load_material = QTreeWidgetItem(
                    [name, identifier, density, young_modulus, poisson, color])
                colorRGB = getColorRGB(color)
                self.list_names.append(name)
                self.list_ids.append(identifier)
                self.list_colors.append(colorRGB)
                load_material.setBackground(
                    5, QBrush(QColor(colorRGB[0], colorRGB[1], colorRGB[2])))
                load_material.setForeground(
                    5, QBrush(QColor(colorRGB[0], colorRGB[1], colorRGB[2])))
                self.treeWidget.addTopLevelItem(load_material)
        except Exception as e:
            error(str(e), "Error while loading the material list")
            self.close()
예제 #3
0
    def admittance(self, area_fluid, frequencies):
        # Only one impedance can be given.
        # More than one must raise an error

        if self.specific_impedance is not None:
            Z = self.specific_impedance / area_fluid
        elif self.radiation_impedance != 0:
            Z = self.radiation_impedance / area_fluid

        if isinstance(self.specific_impedance, np.ndarray):
            admittance = np.divide(1, Z)
        elif isinstance(self.specific_impedance, complex) or isinstance(
                self.specific_impedance, float):
            admittance = 1 / Z * np.ones_like(frequencies)
        elif len([Z]) != len(frequencies):
            error(
                " The vectors of Impedance Z and frequencies must be\n the same lengths to calculate the admittance properly!"
            )
            return

        # if isinstance(Z, float):
        #     admittance = 1/Z * np.ones_like(frequencies)
        # elif len([Z]) != len(frequencies):
        #     error(" The vectors of Impedance Z and frequencies must be\n the same lengths to calculate the admittance properly!")
        #     return
        # else:
        #     admittance = np.divide(1,Z)

        return admittance.reshape([len(frequencies), 1])
예제 #4
0
    def loadList(self):

        self.list_names = []
        self.list_ids = []
        self.list_colors = []

        try:
            config = configparser.ConfigParser()
            config.read(self.fluidPath)

            for fluid in config.sections():
                rFluid = config[fluid]
                name = str(rFluid['name'])
                identifier =  str(rFluid['identifier'])
                fluid_density =  str(rFluid['fluid density'])
                speed_of_sound =  str(rFluid['speed of sound'])
                impedance =  str(rFluid['impedance'])
                color =  str(rFluid['color'])

                load_fluid = QTreeWidgetItem([name, identifier, fluid_density, speed_of_sound, impedance, color])
                colorRGB = getColorRGB(color)
                self.list_names.append(name)
                self.list_ids.append(identifier)
                self.list_colors.append(colorRGB)
                load_fluid.setBackground(5,QBrush(QColor(colorRGB[0], colorRGB[1], colorRGB[2])))
                load_fluid.setForeground(5,QBrush(QColor(colorRGB[0], colorRGB[1], colorRGB[2])))
                self.treeWidget.addTopLevelItem(load_fluid)
        except Exception as e:
            error(str(e), "Error while loading the fluid list")
            self.close()
예제 #5
0
 def ExportResults(self):
     
     if self.lineEdit_FileName.text() != "":
         if self.save_path != "":
             self.export_path_folder = self.save_path + "/"
         else:
             error("Plese, choose a folder before trying export the results!")
             return
     else:
         error("Inform a file name before trying export the results!")
         return
     
     self.check(export=True)
     freq = self.frequencies
     self.export_path = self.export_path_folder + self.lineEdit_FileName.text() + ".dat"
     if self.save_Absolute:
         response = get_reactions(self.mesh, self.reactions, self.nodeID, self.localDof)
         header = ("Frequency[Hz], Real part [{}], Imaginary part [{}], Absolute [{}]").format(self.unit_label, self.unit_label, self.unit_label)
         data_to_export = np.array([freq, np.real(response), np.imag(response), np.abs(response)]).T
     elif self.save_Real_Imaginary:
         response = get_reactions(self.mesh, self.reactions, self.nodeID, self.localDof)
         header = ("Frequency[Hz], Real part [{}], Imaginary part [{}]").format(self.unit_label, self.unit_label)
         data_to_export = np.array([freq, np.real(response), np.imag(response)]).T        
         
     np.savetxt(self.export_path, data_to_export, delimiter=",", header=header)
     self.messages("The results has been exported.")
예제 #6
0
    def check_complex_entries(self, lineEdit_real, lineEdit_imag):

        self.stop = False
        if lineEdit_real.text() != "":
            try:
                real_F = float(lineEdit_real.text())
            except Exception:
                error("Wrong input for real part of specific impedance.", title="Error")
                self.stop = True
                return
        else:
            real_F = 0

        if lineEdit_imag.text() != "":
            try:
                imag_F = float(lineEdit_imag.text())
            except Exception:
                error("Wrong input for imaginary part of specific impedance.", title="Error")
                self.stop = True
                return
        else:
            imag_F = 0
        
        if real_F == 0 and imag_F == 0:
            return None
        else:
            return real_F + 1j*imag_F
예제 #7
0
    def _get_acoustic_bc_from_string(self, value, message):

        load_path_table = ""
        value = value[1:-1].split(',')

        output = None
        if len(value) == 1:
            if value[0] != 'None':

                try:
                    output = complex(value[0])
                except Exception:

                    try:
                        path = os.path.dirname(self.projectFilePath)
                        if "/" in path:
                            load_path_table = "{}/{}".format(path, value[0])
                        elif "\\" in path:
                            load_path_table = "{}\\{}".format(path, value[0])
                        data = np.loadtxt(load_path_table, delimiter=",")
                        output = data[:, 1] + 1j * data[:, 2]
                        self.frequencies = data[:, 0]
                        self.f_min = self.frequencies[0]
                        self.f_max = self.frequencies[-1]
                        self.f_step = self.frequencies[1] - self.frequencies[0]

                    except Exception:
                        error(message)
                        # error(str(e), title="ERROR WHILE LOADING ACOUSTIC BOUNDARY CONDITIONS")
        return output
예제 #8
0
 def info_continue(self):
     if self.hasError:
         error(
             "Material ou Cross Section não foi definido para alguma entidade",
             "Error")
         return
     print("Ok")
     self.close()
예제 #9
0
 def check(self):
     if self.lineEdit.text() == "":
         error("Select a frequency")
         return
     else:
         frequency_selected = float(self.lineEdit.text())
         self.frequency = self.frequency_to_index[frequency_selected]
     self.close()
예제 #10
0
 def get_volume_velocity(self, frequencies):
     if isinstance(self.volume_velocity, np.ndarray):
         if len(self.volume_velocity) == len(frequencies):
             return self.volume_velocity
         else:
             error(
                 "The frequencies vector should have same length.\n Please, check the frequency analysis setup."
             )
             return
     else:
         return self.volume_velocity * np.ones_like(frequencies)
예제 #11
0
 def check(self):
     if self.lineEdit.text() == "":
         error("Insert a value!")
         return
     else:
         try:
             self.modes = int(self.lineEdit.text())
         except Exception:
             error("Invalid input value!")
             return
     self.complete = True
     self.close()
예제 #12
0
    def check(self):
        if self.lineEdit.text() == "":
            error("Select a frequency")
            return
        else:
            frequency_selected = float(self.lineEdit.text())
            if frequency_selected in self.frequencies:
                self.frequency = self.frequency_to_index[frequency_selected]
            else:
                error("  You typed an invalid frequency!  ")
                return

        self.close()
예제 #13
0
    def check_single_values(self):

        self.check_input_nodes()

        if self.lineEdit_real_alldofs.text(
        ) != "" or self.lineEdit_imag_alldofs.text() != "":
            prescribed_dofs = self.check_complex_entries(
                self.lineEdit_real_alldofs, self.lineEdit_imag_alldofs,
                "all dofs")
            if self.stop:
                return
        else:

            ux = self.check_complex_entries(self.lineEdit_real_ux,
                                            self.lineEdit_imag_ux, "ux")
            if self.stop:
                return
            uy = self.check_complex_entries(self.lineEdit_real_uy,
                                            self.lineEdit_imag_uy, "uy")
            if self.stop:
                return
            uz = self.check_complex_entries(self.lineEdit_real_uz,
                                            self.lineEdit_imag_uz, "uz")
            if self.stop:
                return

            rx = self.check_complex_entries(self.lineEdit_real_rx,
                                            self.lineEdit_imag_rx, "rx")
            if self.stop:
                return
            ry = self.check_complex_entries(self.lineEdit_real_ry,
                                            self.lineEdit_imag_ry, "ry")
            if self.stop:
                return
            rz = self.check_complex_entries(self.lineEdit_real_rz,
                                            self.lineEdit_imag_rz, "rz")
            if self.stop:
                return

            prescribed_dofs = [ux, uy, uz, rx, ry, rz]

        if prescribed_dofs.count(None) != 6:
            self.prescribed_dofs = prescribed_dofs
            self.project.set_prescribed_dofs_bc_by_node(
                self.nodes_typed, self.prescribed_dofs, False)
            self.transform_points(self.nodes_typed)
            self.close()
        else:
            error(
                "You must to inform at least one nodal load to confirm the input!",
                title=" ERROR ")
예제 #14
0
    def check_node(self, node_string):
        try:
            tokens = node_string.text().strip().split(',')
            try:
                tokens.remove('')
            except:
                pass
            node_typed = list(map(int, tokens))
            if len(node_typed) == 1:
                try:
                    self.mesh.nodes[node_typed[0]].external_index
                except:
                    message = [
                        " The Node ID input values must be\n major than 1 and less than {}."
                        .format(len(self.nodes))
                    ]
                    error(message[0], title=" INCORRECT NODE ID INPUT! ")
                    return
            elif len(node_typed) == 0:
                error("Please, enter a valid Node ID!")
                return
            else:
                error("Multiple Node IDs", title="Error Node ID's")
                return
        except Exception:
            error("Wrong input for Node ID's!", title="Error Node ID's")
            return

        return node_typed[0], True
예제 #15
0
    def check(self):
        try:
            tokens = self.lineEdit_nodeID.text().strip().split(',')
            try:
                tokens.remove('')
            except:
                pass
            self.nodes_typed = list(map(int, tokens))
        except Exception:
            error("Wrong input for Node ID's!", title = "Error Node ID's")
            return

        try:
            for node in self.nodes_typed:
                self.nodes[node].external_index
        except:
            message = [" The Node ID input values must be\n major than 1 and less than {}.".format(len(self.nodes))]
            error(message[0], title = " INCORRECT NODE ID INPUT! ")
            return

        radiation_impedance = None
        if self.lineEdit_radiation_impedance.text() != "":
            try:
                radiation_impedance = float(self.lineEdit_radiation_impedance.text())
            except Exception:
                error("Wrong input for the Radiation Impedance!", title = " ERROR ")
                return
        else:
            error("You must to input a valid value for the Radiation Impedance!", title = " ERROR ")
            return

        self.radiation_impedance = radiation_impedance
        self.close()
예제 #16
0
    def check(self, export=False):
        try:
            tokens = self.lineEdit_nodeID.text().strip().split(',')
            try:
                tokens.remove('')
            except:
                pass
            node_typed = list(map(int, tokens))
            if len(node_typed) == 1:
                try:
                    self.nodeID = self.mesh.nodes[node_typed[0]].external_index
                except:
                    message = [
                        " The Node ID input values must be\n major than 1 and less than {}."
                        .format(len(self.nodes))
                    ]
                    error(message[0], title=" INCORRECT NODE ID INPUT! ")
                    return
            elif len(node_typed) == 0:
                error("Please, enter a valid Node ID!")
                return
            else:
                error("Multiple Node IDs", title="Error Node ID's")
                return
        except Exception:
            error("Wrong input for Node ID's!", title="Error Node ID's")
            return

        if self.checkBox_dB.isChecked():
            self.scale_dB = True
        elif not self.checkBox_dB.isChecked():
            self.scale_dB = False

        if not export:
            self.plot()
예제 #17
0
    def check_complex_entries(self, lineEdit_real, lineEdit_imag, label):

        self.stop = False
        if lineEdit_real.text() != "":
            try:
                _real = float(lineEdit_real.text())
            except Exception:
                error("Wrong input for real part of {}!".format(label),
                      "Error")
                self.stop = True
                return
        else:
            _real = None

        if lineEdit_imag.text() != "":
            try:
                _imag = float(lineEdit_imag.text())
            except Exception:
                error("Wrong input for imaginary part of {}!".format(label),
                      "Error")
                self.stop = True
                return
        else:
            _imag = None

        if label == 'all dofs':

            if _real is None and _imag is None:
                value = None
            elif _real is None:
                value = 1j * _imag
            elif _imag is None:
                value = complex(_real)
            else:
                value = _real + 1j * _imag
            output = [value, value, value, value, value, value]

        else:

            if _real is None and _imag is None:
                output = None
            elif _real is None:
                output = 1j * _imag
            elif _imag is None:
                output = complex(_real)
            else:
                output = _real + 1j * _imag

        return output
예제 #18
0
    def check_single_values(self):

        self.check_input_nodes()
        specific_impedance = self.check_complex_entries(self.lineEdit_specific_impedance_real, self.lineEdit_specific_impedance_imag)
 
        if self.stop:
            return

        if specific_impedance is not None:
            self.specific_impedance = specific_impedance
            self.project.set_specific_impedance_bc_by_node(self.nodes_typed, self.specific_impedance, False)
            self.transform_points(self.nodes_typed)
            self.close()
        else:    
            error("You must to inform at least one nodal load to confirm the input!", title = " ERROR ")
예제 #19
0
    def _get_structural_bc_from_string(self, first, last):

        first = first[1:-1].split(',')
        last = last[1:-1].split(',')

        bc_1 = bc_2 = bc_3 = bc_4 = bc_5 = bc_6 = None

        if len(first) == 3 and len(last) == 3:

            try:

                if first[0] != 'None':
                    bc_1 = complex(first[0])
                if first[1] != 'None':
                    bc_2 = complex(first[1])
                if first[2] != 'None':
                    bc_3 = complex(first[2])

                if last[0] != 'None':
                    bc_4 = complex(last[0])
                if last[1] != 'None':
                    bc_5 = complex(last[1])
                if last[2] != 'None':
                    bc_6 = complex(last[2])

                output = [bc_1, bc_2, bc_3, bc_4, bc_5, bc_6]

            except Exception:

                output = []

                try:

                    for i in range(3):
                        tables_first = self.structural_tables_load(first[i])
                        output.append(tables_first)

                    for i in range(3):
                        tables_last = self.structural_tables_load(last[i])
                        output.append(tables_last)

                except Exception as e:
                    error(str(e),
                          title=
                          "ERROR WHILE LOADING STRUCTURAL BOUNDARY CONDITIONS")

        return output
예제 #20
0
    def check(self, export=False):
        self.localDof = None
        try:
            tokens = self.lineEdit_nodeID.text().strip().split(',')
            try:
                tokens.remove('')
            except:
                pass
            node_typed = list(map(int, tokens))
            if len(node_typed) == 1:
                try:
                    self.nodeID = self.mesh.nodes[node_typed[0]].external_index
                except:
                    error("Incorrect Node ID input!")
                    return
            elif len(node_typed) == 0:
                error("Please, enter a valid Node ID!")
                return
            else:
                error("Multiple Node IDs", "Error Node ID's")
                return
        except Exception:
            error("Wrong input for Node ID's!", "Error Node ID's")
            return

        if self.radioButton_ux.isChecked():
            self.localDof = 0
            self.localdof_label = "Ux"
            self.unit_label = "m"

        if self.radioButton_uy.isChecked():
            self.localDof = 1
            self.localdof_label = "Uy"
            self.unit_label = "m"

        if self.radioButton_uz.isChecked():
            self.localDof = 2
            self.localdof_label = "Uz"
            self.unit_label = "m"

        if self.radioButton_rx.isChecked():
            self.localDof = 3
            self.localdof_label = "Rx"
            self.unit_label = "rad"

        if self.radioButton_ry.isChecked():
            self.localDof = 4
            self.localdof_label = "Ry"
            self.unit_label = "rad"

        if self.radioButton_rz.isChecked():
            self.localDof = 5
            self.localdof_label = "Rz"
            self.unit_label = "rad"

        if not export:
            self.plot()
예제 #21
0
    def check_entries(self, lineEdit, label):

        self.stop = False
        if lineEdit.text() != "":
            try:
                value = float(lineEdit.text())
            except Exception:
                error("Wrong input for real part of {}!".format(label), "Error")
                self.stop = True
                return
        else:
            value = 0

        if value == 0:
            return None
        else:
            return value
예제 #22
0
    def select_fluid_to_remove(self):

        if self.clicked_item is None:
            error("Select a fluid in the list to be edited.")
            return
        
        try:

            self.lineEdit_name_remove.setText(self.clicked_item.text(0))
            self.lineEdit_id_remove.setText(self.clicked_item.text(1))
            self.lineEdit_fluid_density_remove.setText(self.clicked_item.text(2))
            self.lineEdit_speed_of_sound_remove.setText(self.clicked_item.text(3))
            self.lineEdit_impedance_remove.setText(self.clicked_item.text(4))
            self.lineEdit_color_remove.setText(self.clicked_item.text(5))

        except Exception as e:
            error(str(e), "Error with the fluid list data")
            return
예제 #23
0
 def check(self):
     if self.clicked_item is None:
         error("Select a fluid in the list")
         return
     
     try:
         name = self.clicked_item.text(0)
         identifier = int(self.clicked_item.text(1))
         fluid_density = float(self.clicked_item.text(2))
         speed_of_sound = float(self.clicked_item.text(3))
         # impedance = float(self.clicked_item.text(4))
         color = self.clicked_item.text(5)
         new_fluid = Fluid(name, fluid_density, speed_of_sound, identifier=identifier, color=color)
         self.fluid = new_fluid
         self.close()
     except Exception as e:
         error(str(e), "Error with the fluid list data")
         return
예제 #24
0
    def check_all_table_values_inputs(self):

        self.check_table_values_lumped_masses()
        if self.stop:
            return

        self.check_table_values_lumped_stiffness()
        if self.stop:
            return

        self.check_table_values_lumped_dampings()
        if self.stop:
            return

        if not (self.flag_lumped_masses or self.flag_lumped_stiffness or self.flag_lumped_dampings):
            error("You must to add at least one external element before confirm the input!", title = " ERROR ")
            return

        self.close()      
예제 #25
0
    def select_material_to_remove(self):

        if self.clicked_item is None:
            error("Select a material in the list to be edited.")
            return

        try:

            self.lineEdit_name_remove.setText(self.clicked_item.text(0))
            self.lineEdit_id_remove.setText(self.clicked_item.text(1))
            self.lineEdit_density_remove.setText(self.clicked_item.text(2))
            self.lineEdit_youngModulus_remove.setText(
                self.clicked_item.text(3))
            self.lineEdit_poisson_remove.setText(self.clicked_item.text(4))
            self.lineEdit_color_remove.setText(self.clicked_item.text(5))

        except Exception as e:
            error(str(e), "Error with the material list data")
            return
예제 #26
0
    def check_single_values(self):

        self.check_input_nodes()
        volume_velocity = self.check_complex_entries(
            self.lineEdit_volume_velocity_real,
            self.lineEdit_volume_velocity_imag)

        if self.stop:
            return

        if volume_velocity is not None:
            self.volume_velocity = volume_velocity
            self.project.set_volume_velocity_bc_by_node(
                self.nodes_typed, self.volume_velocity, False)
            self.transform_points(self.nodes_typed)
            self.close()
        else:
            error(
                "You must to inform at least one nodal load to confirm the input!",
                title=" ERROR ")
예제 #27
0
    def check_input_nodes(self):
        try:
            tokens = self.lineEdit_nodeID.text().strip().split(',')
            try:
                tokens.remove('')
            except:
                pass
            self.nodes_typed = list(map(int, tokens))

            if self.lineEdit_nodeID.text() == "":
                error("Inform a valid Node ID before to confirm the input!",
                      title="Error Node ID's")
                return

        except Exception:
            error("Wrong input for Node ID's!", "Error Node ID's")
            return

        try:
            for node in self.nodes_typed:
                self.nodes[node].external_index
        except:
            message = [
                " The Node ID input values must be\n major than 1 and less than {}."
                .format(len(self.nodes))
            ]
            error(message[0], title=" INCORRECT NODE ID INPUT! ")
            return
예제 #28
0
    def check_single_values(self):

        self.check_input_nodes()

        Fx = self.check_complex_entries(self.lineEdit_real_Fx,
                                        self.lineEdit_imag_Fx, "Fx")
        if self.stop:
            return
        Fy = self.check_complex_entries(self.lineEdit_real_Fy,
                                        self.lineEdit_imag_Fy, "Fy")
        if self.stop:
            return
        Fz = self.check_complex_entries(self.lineEdit_real_Fz,
                                        self.lineEdit_imag_Fz, "Fz")
        if self.stop:
            return
        Mx = self.check_complex_entries(self.lineEdit_real_Mx,
                                        self.lineEdit_imag_Mx, "Mx")
        if self.stop:
            return
        My = self.check_complex_entries(self.lineEdit_real_My,
                                        self.lineEdit_imag_My, "My")
        if self.stop:
            return
        Mz = self.check_complex_entries(self.lineEdit_real_Mz,
                                        self.lineEdit_imag_Mz, "Mz")
        if self.stop:
            return

        loads = [Fx, Fy, Fz, Mx, My, Mz]

        if loads.count(None) != 6:
            self.loads = loads
            self.project.set_loads_by_node(self.nodes_typed, self.loads, False)
            self.transform_points(self.nodes_typed)
            self.close()
        else:
            error(
                "You must to inform at least one nodal load to confirm the input!",
                title=" ERROR ")
예제 #29
0
    def load_table(self, lineEdit, text, header):

        self.basename = ""
        window_label = 'Choose a table to import the {} nodal load'.format(
            text)
        self.path_imported_table, _type = QFileDialog.getOpenFileName(
            None, window_label, self.userPath, 'Dat Files (*.dat)')

        if self.path_imported_table == "":
            return "", ""

        self.basename = os.path.basename(self.path_imported_table)
        lineEdit.setText(self.path_imported_table)
        if self.basename != "":
            self.imported_table_name = self.basename

        if "\\" in self.project_file_path:
            self.new_load_path_table = "{}\\{}".format(self.project_file_path,
                                                       self.basename)
        elif "/" in self.project_file_path:
            self.new_load_path_table = "{}/{}".format(self.project_file_path,
                                                      self.basename)

        try:
            imported_file = np.loadtxt(self.path_imported_table, delimiter=",")
        except Exception as e:
            error(str(e))

        if imported_file.shape[1] < 2:
            error(
                "The imported table has insufficient number of columns. The spectrum \ndata must have frequencies, real and imaginary columns."
            )
            return

        try:
            self.imported_values = imported_file[:,
                                                 1] + 1j * imported_file[:, 2]
            if imported_file.shape[1] > 2:

                self.frequencies = imported_file[:, 0]
                self.f_min = self.frequencies[0]
                self.f_max = self.frequencies[-1]
                self.f_step = self.frequencies[1] - self.frequencies[0]
                self.imported_table = True

                real_values = np.real(self.imported_values)
                imag_values = np.imag(self.imported_values)
                abs_values = np.imag(self.imported_values)
                data = np.array(
                    [self.frequencies, real_values, imag_values, abs_values]).T
                np.savetxt(self.new_load_path_table,
                           data,
                           delimiter=",",
                           header=header)

        except Exception as e:
            error(str(e))

        return self.imported_values, self.basename
예제 #30
0
    def check(self):
        if self.clicked_item is None:
            error("Select a material in the list")
            return

        try:
            name = self.clicked_item.text(0)
            identifier = int(self.clicked_item.text(1))
            density = float(self.clicked_item.text(2))
            young = float(self.clicked_item.text(3)) * (10**(9))
            poisson = float(self.clicked_item.text(4))
            color = self.clicked_item.text(5)
            new_material = Material(name,
                                    density,
                                    poisson_ratio=poisson,
                                    young_modulus=young,
                                    identifier=identifier,
                                    color=color)
            self.material = new_material
            self.close()
        except Exception as e:
            error(str(e), "Error with the material list data")
            return