def FIR_hp_callBack(self): if self.raw_data is None: self.infile_error() else: # prompt the user to select the dataset to Process data_var, ok = QtWidgets.QInputDialog.getItem( self, "Select Dataset to process", "Dataset", self.data_list, 0, False) if ok: input_dialog = QtWidgets.QDialog() input_ui = FIR_LHP.Ui_FIR_Design() input_ui.setupUi(input_dialog) input_dialog.show() if input_dialog.exec(): ntaps, freq, win = input_ui.onOk() if ntaps and freq: if ntaps % 2 == 0: ntaps = ntaps + 1 # converitng to Odd number of taps FIR_hp_Data = FIR_hp_func( 'FIR highpass Filtered with taps ' + str(ntaps), self.data_avail[str(data_var)], self.dt, self.nrx, self.rx_component, ntaps, freq, win) self.data_avail[ 'FIR Highpass Data'] = FIR_hp_Data # Updating available datasets if 'FIR Highpass Data' not in self.data_list: self.data_list.append( 'FIR Highpass Data' ) #Updating the available dataset list tab_Var = mplt_plot(self.tab, FIR_hp_Data, self.dt, self.rx, self.rx_component) self.t_index = self.tabWidget.addTab( tab_Var, 'FIR highpass Filtered with taps ' + str(ntaps)) self.tabWidget.setCurrentIndex(self.t_index)
def FIR_bp_callBack(self): if self.raw_data is None: self.infile_error() else: # prompt the user to select the dataset to Process data_var, ok = QtWidgets.QInputDialog.getItem( self, "Select Dataset to process", "Dataset", self.data_list, 0, False) if ok: input_dialog = QtWidgets.QDialog() input_ui = FIR_B_PS.Ui_FIR_Design() input_ui.setupUi(input_dialog) input_dialog.show() if input_dialog.exec(): ntaps, freq1, freq2, win = input_ui.onOk() if ntaps % 2 == 0: ntaps = ntaps + 1 # converitng to Odd number of taps self.FIR_bp_Data = FIR_bp_func( 'FIR Bandpass Filtered with taps ' + str(ntaps), self.raw_data, self.dt, self.nrx, self.rx_component, ntaps, freq1, freq2, win) tab_Var = mplt_plot(self.tab, self.FIR_bp_Data, self.dt, self.rx, self.rx_component) self.t_index = self.tabWidget.addTab( tab_Var, 'FIR Bandpass Filtered with taps ' + str(ntaps)) self.tabWidget.setCurrentIndex(self.t_index)
def median_Filter_callBack(self): if self.raw_data is None: self.infile_error() else: # prompt the user to select the dataset to Process data_var, ok = QtWidgets.QInputDialog.getItem( self, "Select Dataset to process", "Dataset", self.data_list, 0, False) if ok: input_dialog = QtWidgets.QDialog() input_ui = Median_Filter_Window_size.Ui_dialog() input_ui.setupUi(input_dialog) input_dialog.show() if input_dialog.exec(): win1, win2 = input_ui.onOk() if win1 and win2: self.med_filt_Data = median_Filter_func( 'Median Filtered with ' + str(win1) + 'x' + str(win2) + ' window', self.data_avail[str(data_var)], self.dt, self.nrx, self.rx_component, win1, win2) self.data_avail[ 'Median Filtered Data'] = self.med_filt_Data # Updating available datasets if 'Median Filtered Data' not in self.data_list: self.data_list.append( 'Median Filtered Data' ) #Updating the available dataset list tab_Var = mplt_plot(self.tab, self.med_filt_Data, self.dt, self.rx, self.rx_component) self.t_index = self.tabWidget.addTab( tab_Var, 'Median Filtered with ' + str(win1) + 'x' + str(win2) + ' window') self.tabWidget.setCurrentIndex(self.t_index)
def gauss_Filter_callBack(self): if self.raw_data is None: self.infile_error() else: # prompt the user to select the dataset to Process data_var, ok = QtWidgets.QInputDialog.getItem( self, "Select Dataset to process", "Dataset", self.data_list, 0, False) if ok: sigma, okPressed = QtWidgets.QInputDialog.getInt( self, "Enter Sigma ", "Sigma", 2, 1, 4, 1) if sigma: gauss_filt_Data = gauss_Filter_func( 'Gaussian Filtered with sigma ' + str(sigma), self.data_avail[str(data_var)], self.dt, self.nrx, self.rx_component, sigma) self.data_avail[ 'Gaussian Filtered Data'] = gauss_filt_Data # Updating available datasets if 'Gaussian Filtered Data' not in self.data_list: self.data_list.append( 'Gaussian Filtered Data' ) #Updating the available dataset list tab_Var = mplt_plot(self.tab, gauss_filt_Data, self.dt, self.rx, self.rx_component) self.t_index = self.tabWidget.addTab( tab_Var, 'Gaussian Filtered with sigma ' + str(sigma)) self.tabWidget.setCurrentIndex(self.t_index)
def time_gain(self): if self.raw_data is None: self.infile_error() else: # prompt the user to select the dataset to Process data_var, ok = QtWidgets.QInputDialog.getItem( self, "Select Dataset to process", "Dataset", self.data_list, 0, False) if ok: time_pow, okPressed = QtWidgets.QInputDialog.getDouble( self, "Enter time Power", "Time Power", 2, 0.1, 20, 4) if time_pow: t_Data = time_gain_func( 'Time Gain ' + str(time_pow) + 'Applied', self.data_avail[str(data_var)], self.dt, self.nrx, self.rx_component, time_pow) self.data_avail[ 'Time Gain Applied Data'] = t_Data # Updating available datasets if 'Time Gain Applied Data' not in self.data_list: self.data_list.append( 'Time Gain Applied Data' ) #Updating the available dataset list tab_Var = mplt_plot(self.tab, t_Data, self.dt, self.rx, self.rx_component) self.t_index = self.tabWidget.addTab( tab_Var, 'Time Gain Applied with ' 't' 'power = ' + str(time_pow)) self.tabWidget.setCurrentIndex(self.t_index)
def field_to_Power(self): if self.raw_data is None: self.infile_error() else: # prompt the user to select the dataset to Process data_var, ok = QtWidgets.QInputDialog.getItem( self, "Select Dataset to process", "Dataset", self.data_list, 0, False) if ok: self.dx, okPressed = QtWidgets.QInputDialog.getDouble( self, "Enter dx(m)", "Descretisation Size (m)", 0.002, 0.0001, 0.5, 4) if self.dx and okPressed: f_Power = field_to_Power_func( 'Power (dB)', self.data_avail[str(data_var)], self.dt, self.nrx, self.rx_component, self.dx) self.data_avail[ 'Field Power(dB)'] = f_Power # Updating available datasets if 'Field Power(dB)' not in self.data_list: self.data_list.append( 'Field Power(dB)' ) #Updating the available dataset list tab_Var = mplt_plot(self.tab, f_Power, self.dt, self.rx, 'P') self.t_index = self.tabWidget.addTab( tab_Var, 'Converted Powerplot (dB) for dx = ' + str(self.dx)) self.tabWidget.setCurrentIndex(self.t_index)
def trim_Data(self): if self.raw_data is None: self.infile_error() else: # prompt the user to select the dataset to Process data_var, ok = QtWidgets.QInputDialog.getItem( self, "Select Dataset to process", "Dataset", self.data_list, 0, False) if ok: xmin, xmax, ymin, ymax = 0, 300, 0, 300 Data = self.data_avail[str(data_var)] tr_Data = Data[xmin:xmax, ymin:ymax] self.data_avail[ 'Trimmed Data'] = tr_Data # Updating available datasets if 'Trimmed Data' not in self.data_list: self.data_list.append( 'Trimmed Data') #Updating the available dataset list tab_Var = mplt_plot(self.tab, tr_Data, self.dt, self.rx, self.rx_component) self.t_index = self.tabWidget.addTab(tab_Var, 'Trimmed Data') self.tabWidget.setCurrentIndex(self.t_index)
def FIR_bs_callBack(self): if self.raw_data is None: self.infile_error() else: input_dialog = QtWidgets.QDialog() input_ui = FIR_B_PS.Ui_FIR_Design() input_ui.setupUi(input_dialog) input_dialog.show() if input_dialog.exec(): ntaps, freq1, freq2, win = input_ui.onOk() if ntaps % 2 == 0: ntaps = ntaps + 1 # converitng to Odd number of taps self.FIR_bs_Data = FIR_bs_func( 'FIR Bandpass Filtered with taps ' + str(ntaps), self.raw_data, self.dt, self.nrx, self.rx_component, ntaps, freq1, freq2, win) tab_Var = mplt_plot(self.tab, self.FIR_bs_Data, self.dt, self.rx, self.rx_component) self.t_index = self.tabWidget.addTab( tab_Var, 'FIR Bandstop Filtered with taps ' + str(ntaps)) self.tabWidget.setCurrentIndex(self.t_index)
def median_R(self): if self.raw_data is None: self.infile_error() else: # prompt the user to select the dataset to Process data_var, ok = QtWidgets.QInputDialog.getItem( self, "Select Dataset to process", "Dataset", self.data_list, 0, False) if ok: median_r_Data = median_removal_func( 'Median trace Removed', self.data_avail[str(data_var)], self.dt, self.nrx, self.rx_component) self.data_avail[ 'Median Removed Data'] = median_r_Data # Updating available datasets if 'Median Removed Data' not in self.data_list: self.data_list.append( 'Median Removed Data' ) #Updating the available dataset list tab_Var = mplt_plot(self.tab, median_r_Data, self.dt, self.rx, self.rx_component) self.t_index = self.tabWidget.addTab(tab_Var, 'Median Trace Removed') self.tabWidget.setCurrentIndex(self.t_index)
def File_Open_window(self): file_name = QtWidgets.QFileDialog.getOpenFileName( self, 'Select a File', filter="gprMax file (*.out);;GSSI File (*.DZT);;All (*)") if file_name[0]: self.fname = file_name[0] self.f_type = path.splitext(file_name[0]) (self.directory, self.filename) = path.split(self.fname) if self.f_type[1] == '.out': f = h5py.File(self.fname, 'r') self.nrx = f.attrs['nrx'] f.close() rx_c_list = ('Ez', 'Ex', 'Ey', 'Hx', 'Hy', 'Hz', 'Ix', 'Iy', 'Iz') self.rx_component, ok = QtWidgets.QInputDialog.getItem( self, "Select component to plot", "Rx Component", rx_c_list, 0, False) if ok: for self.rx in range(1, self.nrx + 1): self.raw_data, self.dt = get_output_data( self.fname, self.rx, self.rx_component) tab_Var = mplt_plot(self.tab, self.raw_data, self.dt, self.rx, self.rx_component) self.t_index = self.tabWidget.addTab( tab_Var, str(self.filename)) self.tabWidget.setCurrentIndex(self.t_index) # out_plot(self.fname,self.raw_data,self.dt,self.rx,self.rx_component) self.data_avail['Raw Data'] = self.raw_data if 'Raw Data' not in self.data_list: self.data_list.append('Raw Data') print(np.min(self.raw_data), np.max(self.raw_data)) elif self.f_type[1] == '.DZT': (self.directory, self.filename) = path.split(self.fname) self.header, self.raw_data = readgssi(self.fname) print(np.min(self.raw_data), np.max(self.raw_data)) self.data_avail['Raw Data'] = self.raw_data if 'Raw Data' not in self.data_list: self.data_list.append('Raw Data') self.dt = (self.header['rhf_range'] / (self.header['rh_nsamp'] - 1)) * pow(10, -9) self.rx = 1 self.nrx = 1 self.rx_component = 'Ez' tab_Var = mplt_plot(self.tab, self.raw_data, self.dt, self.rx, self.rx_component) self.t_index = self.tabWidget.addTab(tab_Var, str(self.filename)) self.tabWidget.setCurrentIndex(self.t_index) print( ' File : ', self.header['infile'], '\n', 'Antenna : ', self.header['rh_antname'], '\n', 'Bit Rate : ', self.header['rh_bits'], '\n', 'Scans per Second : ', self.header['rhf_sps'], '\n', 'Samples per Scan : ', self.header['rh_nsamp'], '\n', 'Sampling interval (ns) : ', self.dt * pow(10, 9), '\n', 'Range in ns : ', self.header['rhf_range'], '\n', 'Scans per pass : '******'rh_npass'], '\n', 'Scans per m : ', self.header['rhf_spm'], '\n', 'Scan Spacing : ', 1 / self.header['rhf_spm'], '\n', 'Di-electric Const : ', self.header['rhf_epsr'], '\n', 'Appearent Depth(m) : ', self.header['rhf_depth'], '\n') # print(self.header) elif self.f_type[1] and self.raw_data is None: QtWidgets.QMessageBox.warning( self, 'File Type Error!', 'Invalid file Type \nPlease select valid file', QtWidgets.QMessageBox.Ok) elif self.raw_data is None: self.infile_error()