Skip to content

WinWcpRawIO: Add rec_datetime to header dict and block annotation from file #1733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion neo/rawio/winwcprawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""

import struct
import datetime

import numpy as np

Expand Down Expand Up @@ -61,6 +62,7 @@ def _parse_header(self):
continue
key, val = line.split("=")
if key in [
"VER",
"NC",
"NR",
"NBH",
Expand All @@ -80,6 +82,12 @@ def _parse_header(self):
header[key] = val

nb_segment = header["NR"]

# get rec_datetime when WCP data file version is later than 8
if header["VER"] > 8:
rec_datetime = datetime.datetime.strptime(header["RTIME"], "%d/%m/%Y %H:%M:%S")
else:
rec_datetime = None
all_sampling_interval = []
# loop for record number
for seg_index in range(header["NR"]):
Expand Down Expand Up @@ -167,7 +175,8 @@ def _parse_header(self):

# insert some annotation at some place
self._generate_minimal_annotations()

bl_annotations = self.raw_annotations["blocks"][0]
bl_annotations["rec_datetime"] = rec_datetime
def _segment_t_start(self, block_index, seg_index):
return 0.0

Expand Down
5 changes: 4 additions & 1 deletion neo/test/iotest/test_winwcpio.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ class TestRawBinarySignalIO(
):
ioclass = WinWcpIO
entities_to_download = ["winwcp"]
entities_to_test = ["winwcp/File_winwcp_1.wcp"]
entities_to_test = [
"winwcp/File_winwcp_1.wcp",
"winwcp/file_with_recording_time/File_winwcp_2.wcp",
]


if __name__ == "__main__":
Expand Down
5 changes: 4 additions & 1 deletion neo/test/rawiotest/test_winwcprawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ class TestWinWcpRawIO(
):
rawioclass = WinWcpRawIO
entities_to_download = ["winwcp"]
entities_to_test = ["winwcp/File_winwcp_1.wcp"]
entities_to_test = [
"winwcp/File_winwcp_1.wcp",
"winwcp/file_with_recording_time/File_winwcp_2.wcp",
]


if __name__ == "__main__":
Expand Down
Loading