Example #1
0
    def track(self):
        fileformat = self.cmb_fmt.currentText()

        self.exp.camera.kill_event.set()
        reader = imageio.get_reader(str(self.input_path))
        data = []
        self.exp.window_main.stream_plot.toggle_freeze()

        output_name = str(self.output_path) + "." + fileformat
        self.diag_track.show()
        l = reader.get_length()
        if not (0 < l < 100000):
            l = 1
        self.diag_track.prog_track.setMaximum(l)
        self.diag_track.lbl_status.setText("Tracking to " + output_name)

        for i, frame in enumerate(reader):
            data.append(self.exp.pipeline.run(frame[:, :, 0]).data)
            self.diag_track.prog_track.setValue(i)
            if i % 100 == 0:
                self.app.processEvents()

        self.diag_track.lbl_status.setText("Saving " + output_name)
        df = pd.DataFrame.from_records(data, columns=data[0]._fields)
        save_df(df, self.output_path, fileformat)
        self.diag_track.lbl_status.setText("Completed " + output_name)
        self.exp.wrap_up()
Example #2
0
 def complete(self):
     save_df(
         pd.DataFrame(self.times, columns="t"),
         self.filename_base + "video_times",
         self.log_format,
     )
     self.recording = False
Example #3
0
    def _complete(self, filename: str) -> None:
        """ "
        Saves a dataframe containing the timestamps of all the frames.
        Can be extended by subclasses for other logic that should be executed upon finishing the recording.

        Parameters
        ----------
        filename
            part of the filename that the data will be saved to
            (other parts consist of 'video_times' and the log format).
        """
        save_df(
            pd.DataFrame(self._times, columns=["t"]),
            Path(str(filename) + "video_times"),
            self._log_format,
        )
Example #4
0
    def save(self, path, format="csv"):
        """ Saves the content of the accumulator in a tabular format.
        Choose CSV for widest compatibility, HDF if using Python only,
        or feather for efficient storage compatible with Python and Julia
        data frames

        Parameters
        ----------
        path : str
            output path, without extension name
        format : str
            output format, csv, feather, hdf5, json

        """
        df = self.get_dataframe()
        if df is None:
            return
        saved_filename = save_df(df, path, format)
        return basename(saved_filename)