Skip to content
Snippets Groups Projects

Read two data points instead of one

Merged Kien Le requested to merge enhancement-#154-read_two_data_points_from_each_record into develop

Currently, we follow logpeek and qpeek's example and read only one data point from each data record/packet. In order to solve #154 (closed), we now read two data points.

Closes #154 (closed)

There are some issues that arise from this merge request:

  • The data is not downsampled after being read anymore. This is in response to a problem with the downsampling algorithm. More details can be found in a discussion in this MR.
  • A new way of calculating end time of a data record/packet causes #229 (closed). This will be fixed in another MR.
Edited by Kien Le

Merge request reports

Pipeline #3617 passed

Pipeline passed for 0542cc4f on enhancement-#154-read_two_data_points_from_each_record

Approved by

Merged by Kien LeKien Le 11 months ago (Mar 15, 2024 10:54pm UTC)

Pipeline #3618 passed

Pipeline passed for f02ae558 on develop

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • assigned to @kienle

  • Kien Le requested review from @ldam

    requested review from @ldam

    • Maintainer

      I run different data set to compare between this MR and master with wf and SOH

      Centaur-DataTest key Edit:

      master this MR
      total read 206 275
      total plot 0.0436 1.1288
      total plot 0.0333 1.0848

      Q330 5083

      key 2468

      master this MR
      total read 273.66 370.14
      total plot 0.216 0.0434
      total plot 0.0543 0.0555

      key ICEZ

      master this MR
      total plot 0.0555 1.1842
      total plot 0.0559 1.2879

      Q330 5281

      master this MR
      total read 183.07 189.32
      total plot 0.0361 0.0315
      total plot 0.0451 0.0446

      For Q330 5281, plotting isn't correct for HH* channels:

      In master: Q330-5281-HH_-master

      This MR: Q330-5281-HH_-2_data_points

    • Author Developer

      This is a problem with the downsampling algorithm. Currently, the downsampling threshold is 1 million points. The first case has fewer points than that per graph, so no downsampling happened. The second case, however, has double the points in each graph, which mean the data was downsampled. To fix this, the downsampling process was disabled.

    • Please register or sign in to reply
  • Kien Le added 1 commit

    added 1 commit

    Compare with previous version

  • Kien Le requested review from @ldam

    requested review from @ldam

  • Maintainer

    This is the comparison of the time of reading and plotting data between this MR and master.

    Timing code

    general_data.py/reftek.py

        def processing_data(self):
            import time
            start = time.time()
            if self.creator_thread.isInterruptionRequested():
                raise ThreadStopped()
            self.read_folders()
            step1 = time.time()
            read_folder = step1 - start
            self.selected_key = self.select_key()
            step2 = time.time()
            self.fill_empty_data()
            if self.creator_thread.isInterruptionRequested():
                raise ThreadStopped()
            self.finalize_data()
            end = time.time()
            finalize = end - step2
            print("read:", (read_folder + finalize))
            """
            rt130
            end = time.time()
            finalize = end - start
            print("read:", finalize)
            """

    multi_threaded_plotting_widget.py

        def plot_channels(self, d_obj, key, start_tm, end_tm, time_ticks_total,
                          pref_order=[]):
            self.start = time.time()
            ...
    
            def done(self):
            ...
            self.end = time.time()
            print(f"plot {self.name}:", (self.end - self.start))

    Centaur-DataTest key Edit:

    master this MR
    read 184 304
    plot WF 7.37 18.63
    plot SOH 8.81 23.71

    Q330 5083

    key 2468

    master this MR
    total read 272.36 275.22
    plot SOH 3.14 3.39
    plot WF 4.03 4.32

    key ICEZ

    master this MR
    plot SOH 15.55 17.34
    plot WF 17.30 20.13

    Q330 5281

    master this MR
    total read 182.85 188.45
    plot WF 11.18 15.01
    plot SOH 11.89 15.50

    RT130 2016174.9AC4

    master this MR
    total read 70.05 59.90
    plot WF 4.60 6.58
    plot SOH 6.27 8.24

    RT130 9926

    master this MR
    total read 37.92 30.74
    plot WF 3.69 4.39
    plot SOH 5.06 5.85

    6407.sdr

    master this MR
    total read 12.61 14.33
    plot WF 11.69 11.12
    plot SOH 12.81 12.37
    Edited by Lan Dam
26 26 point_size = int(data_format)
27 27 if point_size == 33:
28 28 point_size = 32
29 # Convert the size of a data point to byte because the data is stored
30 # as a byte string.
29 # Convert the size of a data point to byte because the data is stored as a
30 # byte string.
31 31 point_size = point_size // 8
32 first_point = data[:point_size]
33 # We need to accounts for cases where the packet is not completely filled
34 # with data.
35 print(packet[23:24])
  • Maintainer

    In the description, you should give the explanation why there are more gaps for Centaur in this MR.

    Edited by Lan Dam
  • Lan Dam mentioned in merge request !240 (merged)

    mentioned in merge request !240 (merged)

  • Maintainer

    I think the code is ok. You can resolve the last thread and fix failed unittests and this will be ready to be merged.

  • Kien Le added 45 commits

    added 45 commits

    Compare with previous version

  • Kien Le changed the description

    changed the description

  • Kien Le added 2 commits

    added 2 commits

    Compare with previous version

  • Kien Le added 1 commit

    added 1 commit

    Compare with previous version

  • Kien Le requested review from @ldam

    requested review from @ldam

  • Author Developer

    Let's remove this feature for RT130 data for now. It only works on waveform data, and due to the high sample rate, the chance of #154 (closed) happening is pretty low.

  • Kien Le added 2 commits

    added 2 commits

    • f2ab6635 - Revert "Get two data points from RT130 data"
    • f69552a1 - Import needed type

    Compare with previous version

  • Kien Le added 14 commits

    added 14 commits

    Compare with previous version

  • Lan Dam
    Lan Dam @ldam started a thread on the diff
  • 9 """
    10 Get some data points from the record as a contiguous byte string.
    11
    12 :param record_data: the data portion of the record
    13 :param sample_count: the number of sample in the record
    14 :param point_size: the size of a data point
    15 :return: some data points from the record as a contiguous byte string
    16 """
    17 first_data_point = record_data[:point_size]
    18 last_data_point_idx = (sample_count - 1) * point_size
    19 last_data_point = record_data[last_data_point_idx:
    20 last_data_point_idx + point_size]
    21 return first_data_point + last_data_point
    22
    23
    24 def decode_int16(record_data: bytes, sample_count: int,
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading