Exemplo n.º 1
0
 def generate_file(self):
     try:
         modulated_samples = self.modulate_data()
         FileOperator.save_data_dialog("", modulated_samples, parent=self)
     except Exception as e:
         Errors.generic_error(self.tr("Failed to generate data"), str(e), traceback.format_exc())
         self.unsetCursor()
Exemplo n.º 2
0
 def generate_file(self):
     try:
         total_samples = self.total_modulated_samples
         buffer = self.prepare_modulation_buffer(total_samples,
                                                 show_error=False)
         if buffer is None:
             Errors.generic_error(
                 self.tr("File too big"),
                 self.tr("This file would get too big to save."))
             self.unsetCursor()
             return
         modulated_samples = self.modulate_data(buffer)
         try:
             sample_rate = self.modulators[0].sample_rate
         except Exception as e:
             logger.exception(e)
             sample_rate = 1e6
         FileOperator.save_data_dialog("generated.complex",
                                       modulated_samples,
                                       sample_rate=sample_rate,
                                       parent=self)
     except Exception as e:
         Errors.generic_error(self.tr("Failed to generate data"), str(e),
                              traceback.format_exc())
         self.unsetCursor()
Exemplo n.º 3
0
 def generate_file(self):
     try:
         total_samples = self.total_modulated_samples
         buffer = self.prepare_modulation_buffer(total_samples, show_error=False)
         if buffer is None:
             Errors.generic_error(self.tr("File too big"), self.tr("This file would get too big to save."))
             self.unsetCursor()
             return
         modulated_samples = self.modulate_data(buffer)
         FileOperator.save_data_dialog("", modulated_samples, parent=self)
     except Exception as e:
         Errors.generic_error(self.tr("Failed to generate data"), str(e), traceback.format_exc())
         self.unsetCursor()
Exemplo n.º 4
0
 def on_btn_save_rx_clicked(self):
     rx_device = self.simulator.sniffer.rcv_device
     if isinstance(rx_device.data, np.ndarray) or isinstance(rx_device.data, IQArray):
         data = IQArray(rx_device.data[:rx_device.current_index])
         filename = FileOperator.save_data_dialog("simulation_capture", data,
                                                  sample_rate=rx_device.sample_rate, parent=self)
         if filename:
             data.tofile(filename)
             self.rx_file_saved.emit(filename)
Exemplo n.º 5
0
    def on_save_clicked(self):
        data = self.device.data[:self.device.current_index]

        dev = self.device
        big_val = Formatter.big_value_with_suffix
        initial_name = "{0} {1}Hz {2}Sps {3}Hz.complex".format(dev.name, big_val(dev.frequency),
                                                               big_val(dev.sample_rate),
                                                               big_val(dev.bandwidth)).replace(
            Formatter.local_decimal_seperator(), "_").replace("_000", "")

        filename = FileOperator.save_data_dialog(initial_name, data, parent=self)
        self.already_saved = True
        if filename is not None and filename not in self.recorded_files:
            self.recorded_files.append(filename)
Exemplo n.º 6
0
    def on_save_clicked(self):
        data = self.device.data[:self.device.current_index]

        dev = self.device
        big_val = Formatter.big_value_with_suffix
        initial_name = "{0}-{1}Hz-{2}Sps".format(dev.name, big_val(dev.frequency), big_val(dev.sample_rate))

        if dev.bandwidth_is_adjustable:
            initial_name += "-{}Hz".format(big_val(dev.bandwidth))

        initial_name = initial_name.replace(Formatter.local_decimal_seperator(), "_").replace("_000", "")

        filename = FileOperator.save_data_dialog(initial_name + ".complex", data, parent=self)
        self.already_saved = True
        if filename is not None and filename not in self.recorded_files:
            self.recorded_files.append(filename)
Exemplo n.º 7
0
    def on_save_clicked(self):
        data = self.device.data[:self.device.current_index]

        dev = self.device
        big_val = Formatter.big_value_with_suffix
        timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
        initial_name = "{0}-{1}-{2}Hz-{3}Sps".format(dev.name, timestamp,
                                                     big_val(dev.frequency),
                                                     big_val(dev.sample_rate))

        if dev.bandwidth_is_adjustable:
            initial_name += "-{}Hz".format(big_val(dev.bandwidth))

        initial_name = initial_name.replace(
            Formatter.local_decimal_seperator(), "_").replace("_000", "")

        filename = FileOperator.save_data_dialog(initial_name,
                                                 data,
                                                 sample_rate=dev.sample_rate,
                                                 parent=self)
        self.already_saved = True
        if filename is not None and filename not in self.recorded_files:
            self.recorded_files.append(filename)
Exemplo n.º 8
0
 def generate_file(self):
     modulated_samples = self.modulate_data()
     FileOperator.save_data_dialog("", modulated_samples, parent=self)
Exemplo n.º 9
0
 def on_save_clicked(self):
     data = self.device_thread.data[:self.device_thread.current_index]
     filename = FileOperator.save_data_dialog("recorded", data, parent=self)
     self.already_saved = True
     if filename is not None and filename not in self.recorded_files:
         self.recorded_files.append(filename)