예제 #1
0
    def select_files(self):
        self._ui.teFilesList.clear()
        file_dialog = QFileDialog()
        file_dialog.setFileMode(QFileDialog.ExistingFiles)
        names = file_dialog.getOpenFileNames()[0]
        folder_path = None
        min_dt = None
        max_dt = None
        max_frequency = None
        for path in names:
            if folder_path is None:
                folder_path = os.path.dirname(path)
                self._ui.leInputFolder.setText(folder_path)
            file_name = os.path.basename(path)
            t = file_name.split('.')
            if len(t) != 2:
                continue
            name, extension = t
            if extension not in ('00', 'xx'):
                continue

            bin_data = BinaryFile()
            bin_data.path = path
            bin_data.record_type = 'XYZ'

            is_correct, _ = bin_data.check_correct()
            if not is_correct:
                continue

            if min_dt is None:
                min_dt = bin_data.datetime_start
                max_dt = bin_data.datetime_stop
                max_frequency = bin_data.signal_frequency
            else:
                min_dt = max(min_dt, bin_data.datetime_start)
                max_dt = min(max_dt, bin_data.datetime_stop)
                max_frequency = max(max_frequency, bin_data.signal_frequency)

            self._ui.teFilesList.append(file_name)

        if min_dt is None:
            return None

        if min_dt >= max_dt:
            self._ui.teFilesList.clear()
            msg = QMessageBox()
            msg.setIcon(QMessageBox.Information)
            msg.setText("Отсутствует перекрытие по времени")
            msg.exec_()
        else:
            self._ui.dtMinDt.setMinimumDateTime(min_dt)
            self._ui.dtMinDt.setMaximumDateTime(max_dt)
            self._ui.dtMaxDt.setMinimumDateTime(min_dt)
            self._ui.dtMaxDt.setMaximumDateTime(max_dt)
            self._ui.dtMinDt.setDateTime(min_dt)
            self._ui.dtMaxDt.setDateTime(min_dt + datetime.timedelta(hours=1))
            self._ui.sbResampleFrequency.setMinimum(0)
            self._ui.sbResampleFrequency.setMaximum(max_frequency)
            self._ui.sbResampleFrequency.setValue(max_frequency)
예제 #2
0
signal = bin_data.signals[1000:2000]
plt.plot(signal)
plt.show()
print(signal.shape[0])
signal = signal[
    (signal[:, 0] != 0) * (signal[:, 1] != 0) * (signal[:, 2] != 0)]
print(signal.shape[0])
print("")
exit(1)

bin_data.read_date_time_start = datetime(2019, 7, 28, 8, 0, 0) + timedelta(
    seconds=-1 * 3)
bin_data.read_date_time_stop = datetime(2019, 7, 28, 8, 0, 2)

print(bin_data.discrete_amount)
print(bin_data.check_correct())
exit(0)

bin_data.read_date_time_start = datetime(2019, 7, 28, 8, 0, 0) + timedelta(
    seconds=-1 * 3)
bin_data.read_date_time_stop = datetime(2019, 7, 28, 8, 0, 2)

signal = bin_data.signals[:, 0]

check_function(signal=signal, frequency=1000, order=3, long_window=0.5,
               short_window=0.05)

# sfa=sl_filter_a(signal,100,1,1,0.05)
# sfb=sl_filter_b(signal,100,1,1,0.05)
#
# print(np.max(np.abs(sfa-sfb)))