def accept(self): try: fraction = self.fractionDoubleSpinBox.value() label = self.labelSpinBox.value() minD = self.minDiameterDoubleSpinBox.value() * 1e-3 maxD = self.maxDiameterDoubleSpinBox.value() * 1e-3 nG = self.gradingDoubleSpinBox.value() minAR = self.minAspectRatioDoubleSpinBox.value() maxAR = self.maxAspectRatioDoubleSpinBox.value() except: msgBox = WarningParms() msgBox.exec_() MI, NI = np.shape(self.scenario.I) Pixel_mm = self.scenario.Pixel_mm granulometry = Granulometry(MI, NI, Pixel_mm, minD, maxD, nG, minAR, maxAR, fraction, label) twoPhaseModel = TwoPhaseModel(MI, NI, granulometry, self.scenario.Label) self.image = twoPhaseModel.compute(self.progressBar) self.concrete2PhaseObject = Concrete2Phase(Fraction=fraction, LabelAggregate=label, MinDiameter=minD * 1e3, MaxDiameter=maxD * 1e3, Grading=nG, MinAspectRatio=minAR, MaxAspectRatio=maxAR) QDialog.accept(self)
def addRectangle(self): dlg = AddRectangle() if dlg.exec_(): centerX, centerY, width, height, theta, label = dlg.getParms() if self.SimNDT_Scenario: try: self.SimNDT_Scenario.addRectangle(centerX, centerY, width, height, theta, label) if width != height: obj = Rectangle(centerX, centerY, width, height, theta, label) else: obj = Square(centerX, centerY, width, theta, label) except: msg = WarningParms("Error in the object generation!!!") msg.exec_() return if self.SimNDT_ObjectList is None: self.SimNDT_ObjectList = list() self.SimNDT_ObjectList.append(obj) self.dirty = True self.updateUI()
def addEllipse(self): dlg = AddEllipse() if dlg.exec_(): centerX, centerY, major, minor, theta, label = dlg.getParms() if self.SimNDT_Scenario: try: self.SimNDT_Scenario.addEllipse(centerX, centerY, major, minor, theta, label) if major != minor: obj = Ellipse(centerX, centerY, major, minor, theta, label) else: obj = Circle(centerX, centerY, major, label) except Exception as e: msg = WarningParms( "Error in the object generation!!!. %s" % e) msg.exec_() return if self.SimNDT_ObjectList is None: self.SimNDT_ObjectList = list() self.SimNDT_ObjectList.append(obj) self.dirty = True self.updateUI()
def updateUI(self): if self.SimNDT_Scenario is not None: try: self.GraphicView.imshow(self.SimNDT_Scenario.I) except Exception as e: msgBox = WarningParms("Unable to display GRAPHICS!!!. Incompatible Graphic Card, %s" % e) if msgBox.exec_(): sys.exit() HelperMethods.setEnabled(self.menuNew_Simulation_Scenario, True) HelperMethods.setEnabled(self.fileMenuActions[2:5], True) HelperMethods.setEnabled(self.geometryMenuActions[0:], True) HelperMethods.setEnabled(self.configurationMenuActions[0], True) self.addDockWidget(Qt.LeftDockWidgetArea, self.treeDockWidget) self.treeDockWidget.show() self.geometryToolBar() self.simulationToolBar(2) self.statusBarWidget.zoomSpinBox.setVisible(True) if self.SimNDT_Materials is not None: HelperMethods.setEnabled(self.configurationMenuActions[1], True) self.simulationToolBar(3) if self.SimNDT_Boundaries is not None: aa = np.size(self.SimNDT_Scenario.Iabs) if np.size(self.SimNDT_Scenario.Iabs) == 1: self.GraphicView.imshow(self.SimNDT_Scenario.I) else: self.GraphicView.imshow(self.SimNDT_Scenario.Iabs) HelperMethods.setEnabled(self.menuInspection_Setup, True) HelperMethods.setEnabled(self.inspectionMenuActions[:], True) self.simulationToolBar(6) if self.SimNDT_Inspection is not None: HelperMethods.setEnabled(self.simulationMenuActions[6], True) self.simulationToolBar(7) if self.SimNDT_Simulation is not None: HelperMethods.setEnabled(self.simulationMenuActions[7], True) self.simulationToolBar(8) if self.SimNDT_Check: HelperMethods.setEnabled(self.actionRun_Simulation, True) if not self.OpenSimFile: self.simulationToolBar(9) self.treeWidget.update(self.SimNDT_Scenario, self.SimNDT_ObjectList, self.SimNDT_Materials, self.SimNDT_Boundaries, self.SimNDT_Inspection, self.SimNDT_Source, self.SimNDT_Transducers, self.SimNDT_Signal, self.SimNDT_Simulation)
def accept(self): if self.__IsOkAdd: QDialog.accept(self) else: msgBox = WarningParms("Please Apply your changes") msgBox.exec_()
def OnLicence(self): year = datetime.datetime.today().year month = datetime.datetime.today().month if year >= YEAR and month >= MONTH: dial = WarningParms('Get the new version!!!!, please contact to: [email protected]') if dial.exec_(): self.close() sys.exit()
def apply(self): try: # if True: name, values = self.getAllValues() rho = values[0] c11 = (values[1] + 2 * values[2]) c22 = c11 c12 = values[1] c44 = values[2] label = values[3] damping = values[4] if damping: eta_v = values[5] eta_s = values[6] else: eta_v = 1e-30 eta_s = 1e-30 material = Material(name, rho, c11, c12, c22, c44, label, damping, eta_v, eta_s) if self.SimNDT_Materials is None: self.SimNDT_Materials = list() self.SimNDT_Materials.append(material) else: N = len(self.SimNDT_Materials) if N != 0 and self.__NumMatTmp - 1 < N: self.SimNDT_Materials[self.__NumMatTmp - 1] = material else: self.SimNDT_Materials.append(material) if self.__NumMatTmp <= 1: self.previousPushButton.setEnabled(False) self.nextPushButton.setEnabled(False) else: self.previousPushButton.setEnabled(True) self.nextPushButton.setEnabled(True) self.deleteMaterialPushButton.setEnabled(True) self.addMaterialPushButton.setEnabled(True) self.applyPushButton.setEnabled(False) self.propertiesFrame.setEnabled(False) self.materialLibraryPushButton.setEnabled(False) self.__IsOkAdd = True except: msgBox = WarningParms() msgBox.exec_()
def _chooseModel(self): self.SimNDT_FD = EFIT2D(self.simPack, self.Platform) try: self.SimNDT_FD.setup_CL() except Exception as e: msgBox = WarningParms("Error!!!!!!!!!!!!!!!!!! %s" % e.message) if msgBox.exec_(): sys.exit()
def accept(self): try: self.MaxFreq = float(self.maxFrequencyLineEdit.text()) * 1e6 except: msgBox = WarningParms( "Please give correctly the Maximum Frequency") if msgBox.exec_(): return try: self.SimTime = float(self.simulationTimeLineEdit.text()) * 1e-6 except: msgBox = WarningParms("Please give correctly the Simulation Time") if msgBox.exec_(): return pointCycle = self.pointCycle timeScale = self.timeScale self.Simulation = Simulation(timeScale, self.MaxFreq, pointCycle, self.SimTime, Order=2) try: self.Simulation.job_parameters(self.Materials, self.Transducers[0]) except: msgBox = WarningParms( "Please give correctly the Material Properties") if msgBox.exec_(): return self.Simulation.create_numericalModel(self.Scenario) if self.dx_user is not None or self.dt_user is not None: self.Simulation.jobByUser(self.dx_user, self.dt_user) self.Simulation.create_numericalModel(self.Scenario) if self.Platforms is not None: if self.deviceComboBox.currentText() == "CPU [Serial Processing]": self.Simulation.setPlatform("Serial") self.Simulation.setDevice("CPU") else: PlatformDevice = self.PlatformAndDevices[ self.deviceComboBox.currentIndex()] self.Simulation.setPlatform(PlatformDevice[0].name) self.Simulation.setDevice( cl.device_type.to_string(PlatformDevice[1].type)) print(PlatformDevice[0].name, cl.device_type.to_string(PlatformDevice[1].type)) else: self.Simulation.setPlatform("Serial") self.Simulation.setDevice("CPU") QDialog.accept(self)
def accept(self): try: width = float(self.boxWidthLineEdit.text()) height = float(self.boxHeightLineEdit.text()) matrixLabel = self.matrixLabelSpinBox.value() isCircular = self.circularSpecimenCheckBox.isChecked() fraction = self.fractionDoubleSpinBox.value() label = self.labelSpinBox.value() minD = self.minDiameterDoubleSpinBox.value() * 1e-3 maxD = self.maxDiameterDoubleSpinBox.value() * 1e-3 nG = self.gradingDoubleSpinBox.value() minAR = self.minAspectRatioDoubleSpinBox.value() maxAR = self.maxAspectRatioDoubleSpinBox.value() except: msgBox = WarningParms() msgBox.exec_() MI, NI = np.shape(self.scenario.I) Pixel_mm = self.scenario.Pixel_mm NC, MC = int(width * Pixel_mm), int(height * Pixel_mm) granulometry = Granulometry(MC, NC, Pixel_mm, minD, maxD, nG, minAR, maxAR, fraction, label) twoPhaseModel = TwoPhaseModel(MC, NC, granulometry, matrixLabel) image = twoPhaseModel.compute(self.progressBar) I = np.ones((MI, NI), dtype=np.float32) * self.scenario.Label I[MI / 2 - MC / 2:MI / 2 + MC / 2, NI / 2 - NC / 2:NI / 2 + NC / 2] = np.copy(image) if isCircular: X, Y = np.meshgrid(range(0, NI), range(0, MI)) Circular = ((X - NI / 2.) ** 2) / ((NC / 2.) ** 2) + ((Y - MI / 2.) ** 2) / ((MC / 2.) ** 2) Img = (Circular > 1) indx, indy = np.nonzero(Img == 1) I[indx, indy] = self.scenario.Label self.image = np.copy(I) self.concrete2PhaseObjectImmersion = Concrete2PhaseImmersion(Fraction=fraction, LabelMatrix=matrixLabel, MinDiameter=minD * 1e3, MaxDiameter=maxD * 1e3, Grading=nG, MinAspectRatio=minAR, MaxAspectRatio=maxAR, BoxWidth=width, BoxHeight=height, isCircular=isCircular, LabelAggregate=label) QDialog.accept(self)
def accept(self): try: self.width = float(self.widthLineEdit.text()) self.height = float(self.heightLineEdit.text()) self.pixel = float(self.pixelLineEdit.text()) self.label = int(self.labelSpinBox.value()) except: msgBox = WarningParms() msgBox.exec_() return QDialog.accept(self)
def accept(self): try: fraction = self.fractionDoubleSpinBox.value() label = self.labelSpinBox.value() minD = self.minDiameterDoubleSpinBox.value() * 1e-3 maxD = self.maxDiameterDoubleSpinBox.value() * 1e-3 nG = self.gradingDoubleSpinBox.value() minAR = self.minAspectRatioDoubleSpinBox.value() maxAR = self.maxAspectRatioDoubleSpinBox.value() fraction2 = self.fractionDoubleSpinBox_2.value() label2 = self.labelSpinBox_2.value() minD2 = self.minDiameterDoubleSpinBox_2.value() * 1e-3 maxD2 = self.maxDiameterDoubleSpinBox_2.value() * 1e-3 nG2 = self.gradingDoubleSpinBox_2.value() except: msgBox = WarningParms() msgBox.exec_() MI, NI = np.shape(self.scenario.I) Pixel_mm = self.scenario.Pixel_mm granulometry1 = Granulometry(MI, NI, Pixel_mm, minD, maxD, nG, minAR, maxAR, fraction, label) granulometry2 = Granulometry(MI, NI, Pixel_mm, minD2, maxD2, nG2, 0, 1, fraction2, label2) threePhaseModel = ThreePhaseModel(MI, NI, granulometry1, granulometry2, self.scenario.Label) self.image = threePhaseModel.compute(self.progressBar) self.concrete3PhaseObject = Concrete3Phase(Fraction=fraction, LabelAggregate=label, MinDiameter=minD * 1e3, MaxDiameter=maxD * 1e3, Grading=nG, MinAspectRatio=minAR, MaxAspectRatio=maxAR, FractionsAir=fraction2, LabelAir=label2, MinDiameterAir=minD2 * 1e3, MaxDiameterAir=maxD2 * 1e3, GradingAir=nG2) QDialog.accept(self)
def accept(self): try: self.centerX = float(self.centerXLineEdit.text()) self.centerY = float(self.centerYLineEdit.text()) self.major = float(self.semiMajorAxisLineEdit.text()) self.minor = float(self.semiMinorAxisLineEdit.text()) self.theta = float(self.angleLineEdit.text()) self.label = float(self.labelSpinBox.value()) QDialog.accept(self) except: msgBox = WarningParms() msgBox.exec_()
def accept(self): try: self.centerX = float(self.centerXLineEdit.text()) self.centerY = float(self.centerYLineEdit.text()) self.width = float(self.widthLineEdit.text()) self.height = float(self.heightLineEdit.text()) self.theta = float(self.angleLineEdit.text()) self.label = float(self.labelSpinBox.value()) QDialog.accept(self) except: msgBox = WarningParms() msgBox.exec_()
def getLabeledImage(self): self.labels = None self.mainwindow.colormapComboBox.setEnabled(True) self.mainwindow.statusLabel.setText(self.tr("Procesing......")) QCoreApplication.processEvents() try: M, N, R = np.shape(self.imageToDraw) self.image_gray = rgb2gray(self.imageToDraw) except: M, N = np.shape(self.imageToDraw) n_colors = self.mainwindow.numberLabelsSpinBox.value() self.image = median_filter(self.image_gray, 2) image_array = np.reshape(self.image, (M * N, 1)) centroids, self.labels = kmeans2(image_array, n_colors) check = np.size(np.unique(self.labels)) if check != n_colors: self.image_labeled = np.zeros((M, N)) self.mpl.fig.clear() self.mpl.ax = self.mpl.fig.add_subplot(111) self.mpl.ax.imshow(np.zeros((M, N)), cmap=cm.jet, vmin=0, vmax=255) self.mpl.ax.axis("off") self.mpl.draw() QCoreApplication.processEvents() msgBox = WarningParms("Try again") if msgBox.exec_(): self.mainwindow.statusLabel.clear() QCoreApplication.processEvents() return self.labels *= 40 self.image_labeled = np.reshape(self.labels, (M, N)) self.imageToDraw = self.image_labeled index = self.mainwindow.colormapComboBox.currentIndex() cax = self.changeColormap(index) self.mpl.draw() self.mainwindow.moreInfoLabel.setText( self.tr("<b>Apply several times to change labels")) self.mainwindow.statusLabel.setText(self.tr("Done")) QCoreApplication.processEvents()
def runEngine(self, isView=False, isReceiverPlot=False): self.dirty = True self.menuFile.menuAction().setEnabled(False) self.menuConfiguration.menuAction().setEnabled(False) self.menuPlotting_Tools.menuAction().setEnabled(False) self.menuTools.menuAction().setEnabled(False) HelperMethods.setEnabled(self.fileMenuActions, False) HelperMethods.setEnabled(self.geometryMenuActions, False) HelperMethods.setEnabled(self.inspectionMenuActions, False) HelperMethods.setEnabled(self.simulationMenuActions, False) self.statusBarWidget.startSimulation(self.SimNDT_Simulation.TimeSteps) if isView: self.statusBarWidget.viewOn() else: self.statusBarWidget.updateGeometryFrame() simPack = SimPack(self.SimNDT_Scenario, self.SimNDT_Materials, self.SimNDT_Boundaries, self.SimNDT_Inspection, self.SimNDT_Source, self.SimNDT_Transducers, self.SimNDT_Signal, self.SimNDT_Simulation) engine = EngineController(simPack, isView, isReceiverPlot, self.statusBarWidget, self) state = engine.run() self.statusBarWidget.endSimulation() self.PauseSimulation = False if state == "Stop": self.StopSimulation = False self.status.showMessage("Stop by User!!!!!", 15000) message = WarningParms("Stop by User!!!") message.exec_() else: self.status.showMessage("Done", 15000) message = DoneParms() message.exec_() self.menuFile.menuAction().setEnabled(True) self.menuConfiguration.menuAction().setEnabled(True) self.menuPlotting_Tools.menuAction().setEnabled(True) self.menuTools.menuAction().setEnabled(True) HelperMethods.setEnabled(self.fileMenuActions, True) HelperMethods.setEnabled(self.geometryMenuActions, True) HelperMethods.setEnabled(self.inspectionMenuActions, True) HelperMethods.setEnabled(self.simulationMenuActions, True) self.setPlotInspectionsMenu() self.SimNDT_Receivers = Receivers(self.SimNDT_Inspection.Name) self.SimNDT_Receivers.setReceivers(engine)
def save_fig(self, SV, n, idx=None): SV += self.DB ind = np.nonzero(SV < 0) SV[ind] = 0 SV /= np.max(SV) if self.Color == 0: cmap = plt.get_cmap('jet') elif self.Color == 1: cmap = plt.get_cmap('gray') try: _resize = False M, N = np.shape(SV) if M >= 2000: _resize = True if N >= 2000: _resize = True if _resize: SVV = SV[::3, ::3] rgba_img = cmap(SVV) else: SVV = SV[::2, ::2] rgba_img = cmap(SVV) rgb_img = np.delete(rgba_img, 3, 2) if idx is not None: FILE = self.Filename + "_insp%d_" % idx + str( int(n / self.Step)) + self.Extension else: FILE = self.Filename + str(int(n / self.Step)) + self.Extension imsave(FILE, rgb_img) except: msgBox = WarningParms("Too larger Snapshots Size!!!!!!!!") if msgBox.exec_(): sys.exit()
def advancedSetup(self): try: self.MaxFreq = float(self.maxFrequencyLineEdit.text()) * 1e6 except: msgBox = WarningParms( "Please give correctly the Maximum Frequency") if msgBox.exec_(): return try: self.SimTime = float(self.simulationTimeLineEdit.text()) * 1e-6 except: msgBox = WarningParms("Please give correctly the Simulation Time") if msgBox.exec_(): return dlg = AdvancedSimulationSetup(self.SimTime, self.MaxFreq, self.Scenario, self.Materials, self.Transducers, self.Simulation) if dlg.exec_(): self.pointCycle = dlg.PointCycle self.timeScale = dlg.TimeScale self.dx_user = dlg.dx self.dt_user = dlg.dt
def accept(self): try: items = [ (self.topComboBox, self.topLayerSizeLineEdit, "Top"), (self.bottomComboBox, self.bottomLayerSizeLineEdit, "Bottom"), (self.leftComboBox, self.leftLayerSizeLineEdit, "Left"), (self.rightComboBox, self.rightLayerSizeLineEdit, "Right") ] self.Boundaries = list() for item in items: index = item[0].currentIndex() if index == BC.AirLayer: Size = 0.0 else: Size = float(item[1].text()) if Size == 0: msgBox = WarningParms("Undefined Size (%s)!!!!" % item[2]) if msgBox.exec_(): return self.Boundaries.append(Boundary(item[2], index, Size)) except: msgBox = WarningParms() if msgBox.exec_(): return QDialog.accept(self)
def preview(self): self.previewFrame.setVisible(True) self.setMinimumHeight(300) try: timeScale = float(self.timeScaleDoubleSpinBox.value()) except: msgBox = WarningParms("Please give correctly the Time Scale") if msgBox.exec_(): return try: pointCycle = int(self.pointPerCycleSpinBox.value()) except: msgBox = WarningParms( "Please give correctly the Points Per Cycles") if msgBox.exec_(): return simulation = Simulation(timeScale, self.MaxFreq, pointCycle, self.SimTime, Order=2) try: simulation.job_parameters(self.Materials, self.Transducers[0]) except: msgBox = WarningParms( "Please give correctly the Material Properties") if msgBox.exec_(): return simulation.create_numericalModel(self.Scenario) self.dxLineEdit.setText("%0.4f" % (simulation.dx * 1e3)) self.dtLineEdit.setText("%0.4f" % (simulation.dt * 1e6)) M, N = np.shape(self.Scenario.Iabs) MM, NN = np.shape(simulation.Im) self.geometricSizeLabel.setText("%s x %s" % (M, N)) self.numericalSizeLabel.setText("%s x %s" % (MM, NN))
def accept(self): if self.image_labeled is None: msgBox = WarningParms("Get the labeled Image") if msgBox.exec_(): return try: self.Pixel = float(self.mainwindow.PixelLineEdit.text()) except: msgBox = WarningParms("Please give correctly the Pixel/mm") if msgBox.exec_(): return QDialog.accept(self)
def getValues(self, type): try: amplitude = float(self.widget.amplitudeLineEdit.text()) except: msgBox = WarningParms("Give correctly the Amplitude") if msgBox.exec_(): return True try: frequency = float(self.widget.frequencyLineEdit.text()) * 1e6 if frequency > 1e9: msgBox = WarningParms("Give correctly the Frequency (MHz)") if msgBox.exec_(): return True except: msgBox = WarningParms("Give correctly the Frequency (MHz)") if msgBox.exec_(): return True if type == c.SignalType.RaisedCosinePulse: self.Signal = Signals("RaisedCosine", amplitude, frequency) cycles = 1 elif type == c.SignalType.GaussianSinePulse: try: cycles = float(self.widget.cyclesDoubleSpinBox.value()) if cycles == 0: msgBox = WarningParms("Give correctly the # Cycles") if msgBox.exec_(): return True except: msgBox = WarningParms("Give correctly the # Cycles") self.widget.cyclesDoubleSpinBox.setValue(0) if msgBox.exec_(): return True try: self.Signal = Signals("GaussianSine", amplitude, frequency, cycles) t = self.generate(self.Signal.Frequency) sig = self.Signal.generate(t) except: msgBox = WarningParms("Give lower # Cycles") self.widget.cyclesDoubleSpinBox.setValue(0) if msgBox.exec_(): return True
def accept(self): try: self.TimeScale = float(self.timeScaleDoubleSpinBox.value()) except: msgBox = WarningParms("Please give correctly the Time Scale") if msgBox.exec_(): return try: self.PointCycle = int(self.pointPerCycleSpinBox.value()) except: msgBox = WarningParms( "Please give correctly the Points Per Cycles") if msgBox.exec_(): return try: self.dx = float(self.dxLineEdit.text()) * 1e-3 except: msgBox = WarningParms("Please give correctly dx !!!!") if msgBox.exec_(): return try: self.dt = float(self.dtLineEdit.text()) * 1e-6 except: msgBox = WarningParms("Please give correctly dt !!!!") if msgBox.exec_(): return QDialog.accept(self)
def accept(self): if self.Images is None: msgBox = WarningParms("Please add Images to generate the video") if msgBox.exec_(): return if self.FilenameVideo is None: msgBox = WarningParms("Please define the video name") if msgBox.exec_(): return if len(self.Images) < 10: msgBox = WarningParms("Please add more Images") if msgBox.exec_(): return FPS = self.fPSSpinBox.value() print("start") img = cv2.imread(self.Images[0]) height, width, layers = img.shape fourcc = cv2.cv.CV_FOURCC(*'XVID') video = cv2.VideoWriter(self.FilenameVideo, fourcc=fourcc, fps=FPS, frameSize=(width, height)) try: for item in self.Images: print(item) img = cv2.imread(item) video.write(img) cv2.destroyAllWindows() video.release() print("end") except: msgBox = WarningParms( "Impossible to generate the video using the given images!!!!") if msgBox.exec_(): return QDialog.accept(self)
def accept(self): try: if self.Source is None: self.Source = Source() if self.waveSource == WaveSource.Longitudinal: self.Source.Longitudinal = True self.Source.Shear = False elif self.waveSource == WaveSource.Shear: self.Source.Longitudinal = False self.Source.Shear = True elif self.waveSource == WaveSource.LongitudinalAndShear: self.Source.Longitudinal = True self.Source.Shear = True else: self.Source.Longitudinal = True self.Source.Shear = False if self.sourceType == TypeSource.Pressure: self.Source.Pressure = True self.Source.Displacement = False elif self.sourceType == TypeSource.Displacement: self.Source.Pressure = False self.Source.Displacement = True elif self.sourceType == TypeSource.PressureAndDisplacement: self.Source.Pressure = True self.Source.Displacement = True else: self.Source.Pressure = True self.Source.Displacement = False Point = self.pointSourceCheckBox.isChecked() try: if Point: size = 0 else: size = float(self.transducerSizeLineEdit.text()) except: msgBox = WarningParms("Give correctly the transducer Size") if msgBox.exec_(): return transducer = Transducer('SimNDT-emisor', size, 0, 0, "Top", Point, self.window, False, self.backing) if self.Transducers is None: self.Transducers = list() self.Transducers.append(transducer) else: self.Transducers[0] = transducer ProjectionStep = float(self.projectionStepLineEdit.text()) if ProjectionStep > 180 or ProjectionStep <= 0: msgBox = WarningParms("Incorrect Projection Angle!!!!") if msgBox.exec_(): return DiameterRing = float(self.diameterRingLineEdit.text()) if DiameterRing < 0 or DiameterRing >= self.Scenario.Height or DiameterRing >= self.Scenario.Width: msgBox = WarningParms("Incorrect Diameter Ring!!!!") if msgBox.exec_(): return OneProjection = self.oneProjectionCheckBox.isChecked() tomography = Tomography(ProjectionStep, DiameterRing, OneProjection) self.Inspection = copy.deepcopy(tomography) if self.Signal is None: msgBox = WarningParms("Please Setup Signal Parameters!!!!") if msgBox.exec_(): return except: msgBox = WarningParms() msgBox.exec_() return QDialog.accept(self)
def preview(self): try: Point = self.pointSourceCheckBox.isChecked() try: if Point: size = 0 else: size = float(self.transducerSizeLineEdit.text()) except: msgBox = WarningParms("Give correctly the transducer Size") if msgBox.exec_(): return if size >= self.Scenario.Width: msgBox = WarningParms("Transducer is larger than Scenario Width!!!!") if msgBox.exec_(): return elif size <= 0 and not Point: msgBox = WarningParms("Incorrect Transducer Size!!!!") if msgBox.exec_(): return transducer = Transducer('SimNDT-emisor', size, 0, 0, "Top", Point) ProjectionStep = float(self.projectionStepLineEdit.text()) if ProjectionStep > 180 or ProjectionStep <= 0: msgBox = WarningParms("Incorrect Projection Angle!!!!") if msgBox.exec_(): return DiameterRing = float(self.diameterRingLineEdit.text()) if DiameterRing < 0 or DiameterRing >= self.Scenario.Height or DiameterRing >= self.Scenario.Width: msgBox = WarningParms("Incorrect Diameter Ring!!!!") if msgBox.exec_(): return OneProjection = self.oneProjectionCheckBox.isChecked() tomography = Tomography(ProjectionStep, DiameterRing, OneProjection) except: msgBox = WarningParms() msgBox.exec_() return dlg = PreviewTomography(tomography, self.Scenario, transducer, self) dlg.show()
def accept(self): try: if self.Source is None: self.Source = Source() if self.waveSource == WaveSource.Longitudinal: self.Source.Longitudinal = True self.Source.Shear = False elif self.waveSource == WaveSource.Shear: self.Source.Longitudinal = False self.Source.Shear = True elif self.waveSource == WaveSource.LongitudinalAndShear: self.Source.Longitudinal = True self.Source.Shear = True else: self.Source.Longitudinal = True self.Source.Shear = False if self.sourceType == TypeSource.Pressure: self.Source.Pressure = True self.Source.Displacement = False elif self.sourceType == TypeSource.Displacement: self.Source.Pressure = False self.Source.Displacement = True elif self.sourceType == TypeSource.PressureAndDisplacement: self.Source.Pressure = True self.Source.Displacement = True else: self.Source.Pressure = True self.Source.Displacement = False location = self.locationComboBox.currentText() Point = self.pointSourceCheckBox.isChecked() try: if Point: size = 0 else: size = float(self.transducerSizeLineEdit.text()) except: msgBox = WarningParms("Give correctly the transducer Size") if msgBox.exec_(): return centerOffset = float(self.centerOffsetLineEdit.text()) borderOffset = float(self.borderOffsetLineEdit.text()) if size >= self.Scenario.Width: msgBox = WarningParms( "Transducer is larger than Scenario Width!!!!") if msgBox.exec_(): return elif size <= 0 and not Point: msgBox = WarningParms("Incorrect Transducer Size!!!!") if msgBox.exec_(): return if (np.abs(centerOffset) + size / 2.0 >= self.Scenario.Width / 2.0): msgBox = WarningParms("Transducer is out of Scenario!!!!") if msgBox.exec_(): return if borderOffset < 0 or borderOffset >= self.Scenario.Height: msgBox = WarningParms("Transducer is out of Scenario!!!!") if msgBox.exec_(): return transducer = Transducer('SimNDT-emisor', size, centerOffset, borderOffset, location, Point, self.window, False, self.backing) if self.Transducers is None: self.Transducers = list() self.Transducers.append(transducer) else: self.Transducers[0] = transducer self.Inspection = Transmission( location) if self.transmissionRadioButton.isChecked( ) else PulseEcho(location) if self.Signal is None: msgBox = WarningParms("Please Setup Signal Parameters!!!!") if msgBox.exec_(): return except: msgBox = WarningParms() msgBox.exec_() return QDialog.accept(self)
def preview(self): try: location = self.locationComboBox.currentText() Point = self.pointSourceCheckBox.isChecked() try: if Point: size = 0 else: size = float(self.transducerSizeLineEdit.text()) except: msgBox = WarningParms("Give correctly the transducer Size") if msgBox.exec_(): return centerOffset = float(self.centerOffsetLineEdit.text()) borderOffset = float(self.borderOffsetLineEdit.text()) if size >= self.Scenario.Width: msgBox = WarningParms( "Transducer is larger than Scenario Width!!!!") if msgBox.exec_(): return elif size <= 0 and not Point: msgBox = WarningParms("Incorrect Transducer Size!!!!") if msgBox.exec_(): return if (np.abs(centerOffset) + size / 2.0 >= self.Scenario.Width / 2.0): msgBox = WarningParms("Transducer is out of Scenario!!!!") if msgBox.exec_(): return if borderOffset < 0 or borderOffset >= self.Scenario.Height: msgBox = WarningParms("Transducer is out of Scenario!!!!") if msgBox.exec_(): return transducer = Transducer('SimNDT-emisor', size, centerOffset, borderOffset, location, Point) method = Transmission( location) if self.transmissionRadioButton.isChecked( ) else PulseEcho(location) except: msgBox = WarningParms() msgBox.exec_() return dlg = PreviewSingleLaunch(method, self.Scenario, transducer, self) dlg.show()
def accept(self): try: if self.Source is None: self.Source = Source() if self.waveSource == WaveSource.Longitudinal: self.Source.Longitudinal = True self.Source.Shear = False elif self.waveSource == WaveSource.Shear: self.Source.Longitudinal = False self.Source.Shear = True elif self.waveSource == WaveSource.LongitudinalAndShear: self.Source.Longitudinal = True self.Source.Shear = True else: self.Source.Longitudinal = True self.Source.Shear = False if self.sourceType == TypeSource.Pressure: self.Source.Pressure = True self.Source.Displacement = False elif self.sourceType == TypeSource.Displacement: self.Source.Pressure = False self.Source.Displacement = True elif self.sourceType == TypeSource.PressureAndDisplacement: self.Source.Pressure = True self.Source.Displacement = True else: self.Source.Pressure = True self.Source.Displacement = False location = self.locationComboBox.currentText() Point = self.pointSourceCheckBox.isChecked() try: if Point: size = 0 else: size = float(self.transducerSizeLineEdit.text()) except: msgBox = WarningParms("Give correctly the transducer Size") if msgBox.exec_(): return try: ini = float(self.startOffsetLineEdit.text()) except: msgBox = WarningParms("Please give correctly the Start Value") if msgBox.exec_(): return try: end = float(self.stopOffsetLineEdit.text()) except: msgBox = WarningParms("Please give correctly the Stop Value") if msgBox.exec_(): return try: step = float(self.stepOffsetLineEdit.text()) except: msgBox = WarningParms("Please give correctly the Step Value") if msgBox.exec_(): return vectorString = "(%g,%g,%g)" % (ini, end, step) OffsetVector = tuple(map(float, vectorString[1:-1].split(','))) if OffsetVector[0] >= OffsetVector[1]: msgBox = WarningParms("Please set correctly the Start and Stop Values") if msgBox.exec_(): return if OffsetVector[2] <= 0: msgBox = WarningParms("Please give correctly the Step Value") if msgBox.exec_(): return if np.abs(OffsetVector[0]) + size / 2.0 >= self.Scenario.Width / 2.0 or np.abs( OffsetVector[1]) + size / 2.0 >= self.Scenario.Width / 2.0: msgBox = WarningParms("Transducer is out of Scenario for the given Start, Stop, Step Values!!!!") if msgBox.exec_(): return borderOffset = float(self.borderOffsetLineEdit.text()) if size >= self.Scenario.Width: msgBox = WarningParms("Transducer is larger than Scenario Width!!!!") if msgBox.exec_(): return elif size <= 0 and not Point: msgBox = WarningParms("Incorrect Transducer Size!!!!") if msgBox.exec_(): return if borderOffset < 0 or borderOffset >= self.Scenario.Height: msgBox = WarningParms("Transducer is out of Scenario!!!!") if msgBox.exec_(): return transducer = Transducer('SimNDT-emisor', size, 0, borderOffset, location, Point, self.window, False, self.backing) if self.Transducers is None: self.Transducers = list() self.Transducers.append(transducer) else: self.Transducers[0] = transducer method = Transmission(location) if self.transmissionRadioButton.isChecked() else PulseEcho(location) linearScan = LinearScan(OffsetVector[0], OffsetVector[1], OffsetVector[2], location, method.Name, method.Theta) self.Inspection = copy.deepcopy(linearScan) if self.Signal is None: msgBox = WarningParms("Please Setup Signal Parameters!!!!") if msgBox.exec_(): return except: msgBox = WarningParms() msgBox.exec_() return QDialog.accept(self)
def preview(self): try: location = self.locationComboBox.currentText() Point = self.pointSourceCheckBox.isChecked() try: if Point: size = 0 else: size = float(self.transducerSizeLineEdit.text()) except: msgBox = WarningParms("Give correctly the transducer Size") if msgBox.exec_(): return centerOffset = 0 borderOffset = float(self.borderOffsetLineEdit.text()) if size >= self.Scenario.Width: msgBox = WarningParms("Transducer is larger than Scenario Width!!!!") if msgBox.exec_(): return elif size <= 0 and not Point: msgBox = WarningParms("Incorrect Transducer Size!!!!") if msgBox.exec_(): return if borderOffset < 0 or borderOffset >= self.Scenario.Height: msgBox = WarningParms("Transducer is out of Scenario!!!!") if msgBox.exec_(): return try: ini = float(self.startOffsetLineEdit.text()) except: msgBox = WarningParms("Please give correctly the Start Value") if msgBox.exec_(): return try: end = float(self.stopOffsetLineEdit.text()) except: msgBox = WarningParms("Please give correctly the Stop Value") if msgBox.exec_(): return try: step = float(self.stepOffsetLineEdit.text()) except: msgBox = WarningParms("Please give correctly the Step Value") if msgBox.exec_(): return vectorString = "(%g,%g,%g)" % (ini, end, step) OffsetVector = tuple(map(float, vectorString[1:-1].split(','))) if OffsetVector[0] >= OffsetVector[1]: msgBox = WarningParms("Please set correctly the Start and Stop Values") if msgBox.exec_(): return if OffsetVector[2] <= 0: msgBox = WarningParms("Please give correctly the Step Value") if msgBox.exec_(): return if np.abs(OffsetVector[0]) + size / 2.0 >= self.Scenario.Width / 2.0 or np.abs( OffsetVector[1]) + size / 2.0 >= self.Scenario.Width / 2.0: msgBox = WarningParms("Transducer is out of Scenario for the given Start, Stop, Step Values!!!!") if msgBox.exec_(): return transducer = Transducer('SimNDT-emisor', size, centerOffset, borderOffset, location, Point) method = Transmission(location) if self.transmissionRadioButton.isChecked() else PulseEcho(location) linearScan = LinearScan(OffsetVector[0], OffsetVector[1], OffsetVector[2], location, method.Name, method.Theta) inspection = copy.deepcopy(linearScan) except: msgBox = WarningParms() msgBox.exec_() return dlg = PreviewLinearScan(method, inspection, self.Scenario, transducer, self) dlg.show()