Skip to content

Commit 16bfa25

Browse files
committed
Updated timestamp saving
1 parent 3e584d9 commit 16bfa25

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

sciopy/EIT_16_32_64_128.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,9 @@ def SetMeasurementSetup(self, setup: EitMeasurementSetup):
418418
elif setup.gain == 1_000:
419419
self.write_command_string(bytearray([0xB0, 0x03, 0x09, 0x01, 0x03, 0xB0]))
420420

421-
# Single ended mode:
422-
self.write_command_string(bytearray([0xB0, 0x03, 0x08, 0x01, 0x01, 0xB0]))
421+
# Single ended mode as standard setup, if else configured, skip patterns are possible:
422+
self.update_measurement_mode(setup.mea_mode, boundary=setup.mea_mode_boundary)
423+
#self.write_command_string(bytearray([0xB0, 0x03, 0x08, 0x01, 0x01, 0xB0]))
423424

424425
# Excitation switch type:
425426
self.write_command_string(bytearray([0xB0, 0x02, 0x0C, 0x01, 0xB0]))
@@ -487,7 +488,7 @@ def ResetMeasurementSetup(self):
487488
self.print_msg = False
488489

489490
def update_measurement_mode(
490-
self, meamode: str = "skip4", boundary: str = "external"
491+
self, meamode: str = "singleended", boundary: str = "internal"
491492
):
492493
"""
493494
Updates the measurement modes out of the options "singleended", "skip0", "skip2" or "skip4"

sciopy/sciopy_dataclasses.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class EitMeasurementSetup:
3030
gain: int
3131
adc_range: int
3232
mea_mode: str = "singleended"
33-
mea_mode_boundary: str = "external"
33+
mea_mode_boundary: str = "internal"
3434
# TBD: lin/log/sweep
3535

3636

@@ -228,6 +228,8 @@ class EITFrame:
228228
frequency_stgs : List[str] # todo
229229
timestamp1 : int Timestamp of the very first measured channel group in this frame, milli seconds?
230230
timestamp2 : int Timestamp of the very last measured channel group in this frame, milli seconds?
231+
timestamp_pc : int Timestamp of the receiving computer for further data synchronisation from datetime.now().
232+
timestamp()
231233
ppcData : np.array [[Complex measured data]]
232234
for e in used excitations stages,
233235
for f in used frequency stages:
@@ -239,4 +241,5 @@ class EITFrame:
239241
frequency_stgs: npt.NDArray[int] # List of Frequency-Sweep Settings,
240242
timestamp1: int # [ms]
241243
timestamp2: int
244+
timestamp_pc: int
242245
ppcData: npt.NDArray[complex] # Channels 1-(64) all channel groups combined

sciopy/usb_message_parser.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import struct
1818
from .sciopy_dataclasses import EitMeasurementSetup, EITFrame
1919
from .com_util import bytesarray_to_float, byteintarray_to_float, two_byte_to_int
20+
from datatime import datetime
2021

2122
# -------------------------------------------------------------------------------------------------------------------- #
2223
# -------------------------------------------------------------------------------------------------------------------- #
@@ -147,6 +148,7 @@ def reset_new_data_frame(self):
147148
# todo fill in setup freq settings
148149
timestamp1=0,
149150
timestamp2=0,
151+
timestamp_pc=0,
150152
ppcData=np.zeros(
151153
self.iMaxChannelGroups * 16 * self.iNumExcitationSettings, dtype=complex
152154
),
@@ -347,6 +349,7 @@ def interpret_data_input(
347349
# TIMESTAMP
348350
if self.iSaveCounter == 0:
349351
self.CurrentFrame.timestamp1 = message[7:11]
352+
self.CurrentFrame.timestamp_pc = datetime.now().timestamp()
350353

351354
# Data Handling
352355
for i in range(11, 135, 8):
@@ -430,6 +433,7 @@ def save_data_frame(path: str, dataframe: EITFrame, iNPZSaveIndex: int):
430433
frequency_stgs=dataframe.frequency_stgs,
431434
timestamp1=dataframe.timestamp1,
432435
timestamp2=dataframe.timestamp2,
436+
timestamp_pc = dataframe.timestamp_pc,
433437
ppcData=dataframe.ppcData,
434438
)
435439

@@ -455,6 +459,7 @@ def load_eit_frames(path):
455459
frequency_stgs=l["frequency_stgs"],
456460
timestamp1=l["timestamp1"],
457461
timestamp2=l["timestamp2"],
462+
timestamp_pc=l["timestamp_pc"],
458463
ppcData=l["ppcData"],
459464
)
460465
loaded.append(e)

0 commit comments

Comments
 (0)