A multi-modal physiological signal synchronization processing method based on timestamp calibration
By using synchronous timing markers and dynamic updates of clock mapping parameters in a multimodal physiological signal acquisition system, the time error problem caused by clock frequency drift in hardware modules is solved, achieving high-precision alignment and accurate feature extraction of multimodal physiological signals.
Patent Information
- Application Number
- CN202611413840.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-11
- Publication Date
- 2026-11-27
AI Technical Summary
In multimodal physiological signal acquisition systems, the physical crystal oscillators of each hardware module experience clock frequency drift due to increased operating time and temperature changes. This leads to accumulated errors between the module's local time and the system's global reference time, which current technologies cannot track and compensate for in real time, affecting the accuracy of data alignment. Furthermore, existing technologies employ a nearest-grid matching method when processing discrete experimental events, resulting in time quantization truncation errors and impacting the accuracy of signal feature extraction.
By issuing synchronous timing markers, the system controls each acquisition module to latch the start timestamp and transmit the first frame data. It provides periodic synchronous timing markers to update clock mapping parameters, generates a corrected global timestamp, and generates virtual physiological sampling points when the time matching deviation is greater than the threshold. It uses mathematical interpolation to calculate the signal amplitude at the moment the event occurs, thereby reducing quantization truncation errors.
Real-time compensation for hardware clock frequency drift was achieved, ensuring that the timestamps of multimodal physiological signals are consistent with the global reference time, reducing time jitter and high-frequency feature distortion, and improving the accuracy and reliability of signal feature extraction.
Smart Images

Figure CN123178997A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of multimodal data processing technology, specifically to a method for synchronizing multimodal physiological signals based on timestamp calibration. Background Technology
[0002] In brain-computer interface and neuro-human-computer interaction research, it is typically necessary to simultaneously acquire physiological signals from multiple modalities, such as electroencephalography (EEG), eye tracking, and near-infrared spectroscopy, to comprehensively assess the cognitive or physiological state of the subject. The acquisition of these physiological signals relies on distributed hardware modules, each equipped with an independent timer and physical crystal oscillator. To ensure the effectiveness of multimodal data fusion analysis, the system needs to provide a unified reference time to align the discrete data acquired by each module onto the same timeline.
[0003] However, in real-world applications, the physical crystal oscillators of each hardware module are affected by environmental factors such as operating temperature rise and prolonged operation, causing clock frequency drift. As the acquisition time progresses, a cumulative deviation will occur between the local time of each independent module and the system's global reference time. Conventional systems often rely on a single synchronization during the initial phase or simply obtain timestamps through software polling. This approach cannot track and compensate for the dynamic offset of the underlying hardware crystal oscillators in real time, easily leading to time misalignment of cross-modal data after long-term acquisition.
[0004] Furthermore, in closed-loop experiments involving stimulus tasks, the labeling of discrete experimental events induced by external stimuli needs to be aligned with continuous physiological data on a unified global time grid. Existing techniques generally employ a nearest-grid matching logic, forcibly reducing the event occurrence time to the nearest sampling grid point. This logic ignores the offset distance between grids, directly leading to time quantization truncation errors. When performing event-related potential superposition and averaging analysis across trials, this truncation error manifests as random time jitter, causing smoothing and distortion of high-frequency waveform components, resulting in a significant attenuation of target feature peaks and reducing the accuracy of signal feature extraction. Summary of the Invention
[0005] The technical problem solved by this invention is that in a multimodal physiological signal acquisition system, the physical crystal oscillators of each hardware module will experience clock frequency drift as the running time increases and the temperature changes, resulting in an accumulated error between the module's local time and the system's global reference time.
[0006] In addition, when processing discrete experimental events and aligning them to a global time grid, existing techniques typically employ a nearest-grid matching method, which introduces time quantization truncation errors.
[0007] When performing superposition analysis of related potentials across multiple trials, this quantization error manifests as time jitter, leading to peak broadening, high-frequency characteristic distortion, and amplitude attenuation in the superimposed waveform, thus affecting the reliability of the final data analysis results.
[0008] To address the above problems, the present invention provides the following technical solution:
[0009] The first aspect of this invention provides a method for synchronizing and processing multimodal physiological signals based on timestamp calibration, comprising the following steps:
[0010] Send out the start synchronization broadcast signal to control each acquisition module to latch the start timestamp and send back the first frame of data;
[0011] It provides periodic synchronization timing markers, updates clock mapping parameters, and generates a corrected global timestamp based on the clock mapping parameters;
[0012] A unified global time grid is set up for time axis resampling. When the time matching deviation of discrete experimental events is greater than the time deviation tolerance threshold, virtual physiological sampling points are generated.
[0013] The resampled data and virtual physiological sampling points are vector-encapsulated to generate a structured fusion dataset.
[0014] The above method compensates for hardware clock frequency drift by issuing synchronization timing markers and dynamically updating clock mapping parameters.
[0015] Meanwhile, when the time matching deviation is too large, mathematical interpolation is used to calculate the signal amplitude corresponding to the time of the event, instead of the nearest grid calculation, to reduce the time quantization truncation error in the discrete event alignment process.
[0016] Preferably, a start synchronization broadcast signal is sent to control each acquisition module to latch the start timestamp and transmit the first frame of data, including:
[0017] Activate the system timer to establish a global clock source;
[0018] Send a start synchronization broadcast signal and record the global start timestamp; generate a hardware time capture event and latch the start timestamp.
[0019] Initiate the analog-to-digital conversion operation to generate the original local timestamp, and send the original local timestamp back with the first frame data to establish an initial correspondence.
[0020] Preferably, updating the clock mapping parameters includes:
[0021] Each acquisition module is controlled to latch its local timestamp as a calibration anchor point;
[0022] Perform in-band encapsulation on the calibration anchor points and transmit them back with the physiological data stream; extract the synchronization sequence number and local timestamp to generate mapping data pairs;
[0023] The mapped data is linearly fitted, and the clock frequency deviation coefficient and initial offset, which are used as clock mapping parameters, are updated.
[0024] This step establishes a linear relationship model between local time and global time by using timing parameters transmitted back with the data stream, thereby enabling continuous updates to the clock mapping parameters.
[0025] Preferably, generating a corrected global timestamp based on clock mapping parameters includes:
[0026] Using the updated clock frequency deviation coefficient and the initial offset, a linear mapping calculation is performed on the local timestamp to generate the corrected global timestamp, and a continuity check is performed.
[0027] In a preferred embodiment of the present invention, when the time matching deviation of discrete experimental events is greater than the time deviation tolerance threshold, virtual physiological sampling points are generated, including:
[0028] Calculate the time matching deviation between the occurrence time of a discrete experimental event and the nearest grid point;
[0029] When the time matching deviation is greater than the time deviation tolerance threshold, a cubic spline interpolation function is constructed using the corrected global timestamp as the node; the occurrence time of the discrete experimental event is substituted into the cubic spline interpolation function to calculate the estimated amplitude as the virtual physiological sampling point.
[0030] The physiological signal amplitude at the actual moment of the experimental event is obtained by interpolation, avoiding the introduction of time deviation due to forced alignment to the nearest grid point.
[0031] Preferred options also include:
[0032] When the time matching deviation is not greater than the time deviation tolerance threshold, the time of occurrence of discrete experimental events is associated with the nearest grid point.
[0033] Preferably, the resampled data and virtual physiological sampling points are vector-encapsulated to generate a structured fusion dataset, including:
[0034] Construct a multi-dimensional structured fused data frame, merge the synchronization amplitude sequence and configure the event label field;
[0035] Perform time-series fusion operations on virtual physiological sampling points to generate a structured fusion dataset;
[0036] Configure the output routing path of the data stream according to the control instructions and then output it.
[0037] A second aspect of the present invention provides a multimodal physiological signal synchronization processing system based on timestamp calibration, comprising:
[0038] The initial synchronization module is used to send out the initial synchronization broadcast signal, control each acquisition module to latch the start timestamp and send back the first frame of data;
[0039] The calibration mapping module is used to provide periodic synchronization timing markers, update clock mapping parameters, and generate corrected global timestamps based on the clock mapping parameters.
[0040] The resampling and interpolation module is used to set a unified global time grid for time axis resampling. When the time matching deviation of discrete experimental events is greater than the time deviation tolerance threshold, virtual physiological sampling points are generated.
[0041] The encapsulation output module is used to encapsulate the resampled data and virtual physiological sampling points into vectors to generate a structured fusion dataset.
[0042] A third aspect of the present invention provides an electronic device, comprising:
[0043] processor;
[0044] Memory used to store processor-executable instructions;
[0045] The processor is configured to execute instructions to implement the timestamp-calibrated multimodal physiological signal synchronization processing method of any of the first aspects of the present invention.
[0046] A fourth aspect of the present invention provides a computer-readable storage medium that, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform the timestamp-calibrated multimodal physiological signal synchronization processing method of any of the first aspects of the present invention.
[0047] This invention provides a method for synchronizing multimodal physiological signals based on timestamp calibration. It has the following beneficial effects:
[0048] 1. This invention issues periodic synchronization timing markers and controls the acquisition module to transmit calibration anchor points in-band encapsulation. It then uses linear fitting to dynamically update the clock frequency deviation coefficient and initial offset. This mechanism continuously compensates for clock frequency drift caused by temperature changes or operating time of the underlying physical crystal oscillator during system operation, ensuring that the timestamps of multimodal physiological signals remain consistent with the global reference time during long-term acquisition.
[0049] 2. This invention introduces an interpolation compensation mechanism based on time matching deviation judgment in the resampling alignment stage. When the time of the experimental event deviates from the global time grid and the deviation is greater than the tolerance threshold, a cubic spline interpolation function is constructed to calculate the estimated amplitude corresponding to the actual time of the event, replacing the traditional forced reduction to the nearest grid, thus avoiding the time quantization truncation error caused by grid reduction.
[0050] 3. This invention encapsulates resampled data and interpolated virtual physiological sampling points into vectors, outputting a structured fusion dataset. This method restores the signal amplitude at the location of discrete experimental events, eliminates high-frequency feature distortion and amplitude attenuation caused by time jitter in cross-trial event correlation potential superposition analysis, and improves the accuracy and reliability of post-event feature extraction of multimodal physiological signals. Attached Figure Description
[0051] Figure 1 This is a diagram of the synchronous processing system architecture of the present invention;
[0052] Figure 2 This is a flowchart of the synchronization processing method of the present invention;
[0053] Figure 3 For the present invention Figure 2 Execution timing diagram of step S10;
[0054] Figure 4 For the present invention Figure 2 Execution principle diagram of step S20;
[0055] Figure 5 For the present invention Figure 2 Execution principle diagram of step S30;
[0056] Figure 6 For the present invention Figure 2 Flowchart of step S40;
[0057] Figure 7 This is a comprehensive comparison chart of the multimodal data alignment logic and experimental results of the present invention;
[0058] in, Figure 7 The upper sub-figure is a partially enlarged schematic diagram of the virtual physiological sampling point generation logic;
[0059] Figure 7 The lower sub-figure is a comparative experimental verification diagram of the superimposed waveform of auditory evoked related potentials. Detailed Implementation
[0060] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0061] Example:
[0062] See attached document Figure 1 , Figure 1 This is a diagram of a synchronization processing system architecture according to an embodiment of the present invention.
[0063] The present invention provides a synchronous processing system, which includes a main control unit and multiple acquisition modules connected via a data bus.
[0064] The acquisition module includes an EEG module, an eye-tracking module, and a near-infrared module.
[0065] The main control unit is equipped with a system timer.
[0066] The system timer provides a global time base for system operation.
[0067] The EEG module, eye-tracking module, and near-infrared module each have their own built-in physical crystal oscillator circuits.
[0068] The EEG module, eye-tracking module, and near-infrared module generate independent local clock signals based on their respective physical crystal oscillator circuits. The sampling clock used to drive the analog-to-digital conversion operation and the local hardware timer clock used to generate the local timestamp in each acquisition module are derived from the same physical crystal oscillator of that acquisition module, or they have a predetermined fixed frequency ratio relationship. They independently perform analog-to-digital conversion operations based on the set sampling rate to generate physiological data streams.
[0069] The data bus provides a hardware-level common timing mark mechanism that can be jointly detected by multiple acquisition modules. The data bus provides synchronization timing marks for each acquisition module for time synchronization, and at the same time transmits the physiological data streams generated by each acquisition module to the main control unit.
[0070] The data bus adopts the Universal Serial Bus protocol or the Ethernet protocol, and uses the frame start packet, microframe start packet or synchronous communication frame at the protocol layer as the physical carrier of the synchronization timing mark.
[0071] See attached document Figure 2 , Figure 2 This is a flowchart of a synchronization processing method according to an embodiment of the present invention.
[0072] This invention provides a synchronization processing method, comprising the following steps:
[0073] S10, the main control unit sends the start synchronization broadcast signal to the EEG module, eye-tracking module and near-infrared module through the data bus. When the EEG module, eye-tracking module and near-infrared module capture the start synchronization broadcast signal at the underlying hardware interface, they trigger an internal hardware interrupt, latch the start timestamp corresponding to their local clock signal, and encapsulate the start timestamp into the first frame of data and send it back to the main control unit.
[0074] S20, the main control unit provides periodic synchronization timing marks through the data bus according to a set period. When each acquisition module detects the periodic synchronization timing marks at the underlying hardware interface, it performs hardware time capture, latches the current local timestamp as a calibration anchor point, and appends the calibration anchor point as a time tag to the reserved field of the next physiological data frame being constructed and sends it back to the main control unit. The main control unit establishes a mapping data pair between the local timestamp corresponding to the calibration anchor point and the global reference time recorded when the corresponding periodic synchronization broadcast packet is sent. Based on multiple mapping data pairs within the sliding time window, it performs linear fitting to update the clock frequency deviation coefficient and initial offset of each acquisition module. The updated clock frequency deviation coefficient and initial offset are used to perform mapping calculation on the original local timestamp in the physiological data stream to generate a corrected global timestamp.
[0075] S30, the main control unit sets the target sampling frequency and the corresponding unified global time grid, and constructs a cubic spline interpolation function for each acquisition module with the corrected global timestamp as the independent variable node, and performs time axis resampling of each modality physiological signal on the unified global time grid based on the cubic spline interpolation function;
[0076] For discrete experimental event markers input from external sources, the time matching deviation between the global timestamp of the event and the nearest grid point in the unified global time grid is determined. When the time matching deviation is greater than the set time deviation tolerance threshold, the amplitude of each modal physiological signal is calculated at the global time position of the event corresponding to the discrete experimental event marker using the cubic spline interpolation function to generate virtual physiological sampling points, and the discrete experimental event marker is associated with the virtual physiological sampling points.
[0077] S40, the main control unit encapsulates the time-axis aligned values of each modal physiological signal, virtual physiological sampling points, and associated discrete experimental event markers into vectors according to the corrected global timestamps, generates a structured fusion dataset, and outputs it to an external computing node or storage medium.
[0078] The technical details of the present invention will be described in detail below in conjunction with specific implementation steps.
[0079] See attached document Figure 3, Figure 3 This is a timing diagram of the execution of step S10 according to an embodiment of the present invention.
[0080] In practical implementation, in order to reduce the uncertainty of system call delay caused by the issuance of conventional software instructions, the specific execution process of the above step S10 may include the following sub-steps:
[0081] S101, the main control unit is equipped with a high-precision system timer. The main control unit activates the high-precision system timer to establish a global clock source when the system starts up.
[0082] A global clock source is used to provide a unified global reference time for system operation. .
[0083] Typically, to meet the time axis alignment requirements of high-frequency physiological signals, the system uses a unified global reference time. The time resolution can be set to the microsecond level or higher.
[0084] For the specific circuit structure and clock source configuration of high-precision system timers, those skilled in the art can use conventional real-time clock chips or hardware timer peripherals within microprocessors to implement them. The basic circuits and register configurations are well-known technologies in the field and will not be described in detail here.
[0085] S102, the main control unit sends the start synchronization broadcast signal to the EEG module, eye-tracking module and near-infrared module through the data bus.
[0086] Since conventional operating system-based software synchronization instructions often generate millisecond-level random delay jitter due to system thread queuing or task scheduling, in order to avoid such uncertain errors, when the data bus adopts the Universal Serial Bus protocol, the underlying hardware controller of the Universal Serial Bus continuously generates frame start packets or microframe start packets according to the protocol. Before starting acquisition, the main control unit determines a target frame number or target microframe sequence number and sends the target frame number or target microframe sequence number to each acquisition module through configuration instructions.
[0087] The main control unit uses the frame start packet or microframe start packet corresponding to the target frame number or target microframe sequence number as the start synchronization broadcast signal, and each acquisition module performs start timestamp capture when it detects the corresponding frame start packet or microframe start packet.
[0088] When the data bus uses the Ethernet protocol, the master control unit uses the synchronization broadcast message at the underlying layer of the precision time protocol as the starting synchronization broadcast signal.
[0089] The broadcast delivery mechanism is executed directly by the underlying hardware communication interface of the main control unit, without going through the software thread queuing and scheduling of the operating system running on the main control unit, thereby effectively reducing network transmission latency jitter at the software level.
[0090] At the instant the initial synchronization broadcast signal is sent, the underlying hardware controller inside the main control unit obtains the hardware transmission timestamp corresponding to the synchronization broadcast signal, or triggers the hardware capture channel of the high-precision system timer to automatically latch the current count value. The main control unit then reads the latched timestamp value and records the system's unified global reference time at this moment as the global start timestamp. .
[0091] The S103 integrates microcontrollers within its EEG module, eye-tracking module, and near-infrared module.
[0092] A microcontroller contains a bus peripheral controller and a local hardware timer.
[0093] The moment the EEG module, eye-tracking module, and near-infrared module capture the initial synchronization broadcast signal on the data bus on their respective bus peripheral controllers on the physical link, the bus peripheral controllers generate a hardware time capture event at the hardware level and trigger the capture unit of the local hardware timer to automatically latch the current count value into the capture register, while generating a hardware interrupt.
[0094] After responding to a hardware interrupt, the microcontroller reads the local time count value already latched in the capture register. This latched count value serves as the start timestamp corresponding to the local clock signal of the current acquisition module.
[0095] Set collection This refers to the collection of all acquisition modules connected to the system.
[0096] For sets Any one of the acquisition modules ( The start timestamp latched by capturing the start synchronization broadcast signal and responding to hardware interrupts is recorded as follows: .
[0097] S104: After completing the initial timestamp latch, the EEG module, eye-tracking module, and near-infrared module initiate analog-to-digital conversion to acquire physiological signals.
[0098] During the continuous analog-to-digital conversion process, each acquisition module establishes an original local timestamp for the acquired physiological data based on the local hardware timer.
[0099] Specifically, each acquisition module records at least the local timestamp corresponding to the first sampling point in each physiological data frame, and records the sampling sequence number of each sampling point within the physiological data frame. Since the sampling clock of the analog-to-digital converter and the local hardware timer clock are derived from the same physical crystal oscillator or have a fixed frequency ratio, the main control unit or acquisition module can determine the original local timestamp corresponding to each sampling point within the frame based on the local timestamp of the first sampling point of the frame, the sampling point sequence number within the frame, and the corresponding local sampling period.
[0100] For the acquisition module Let the local timestamp of the first sampling point of a certain data frame be... Then the first data frame in that data frame The original local timestamp corresponding to each sampling point can be represented as:
[0101] ;
[0102] in, For the acquisition module The time length corresponding to one sampling period under the local time base.
[0103] In other implementations, hardware timestamp capture can be performed directly for each analog-to-digital conversion completion event to obtain the original local timestamps corresponding to each physiological data sampling point.
[0104] Each acquisition module will latch the start timestamp Write the reserved header field of the first frame physiological data packet to generate the first frame data containing the start timestamp.
[0105] Subsequently, each acquisition module transmits the first frame of data to the main control unit via the data bus through its internal direct memory access controller.
[0106] After receiving the first frame of data from each acquisition module, the main control unit extracts the start timestamp. And establish a global start timestamp With each start timestamp The initial correspondence pair .
[0107] Since the electrical signal transmission delay of the physical cable of the data bus in a conventional system layout environment is usually small, the fixed delay component of the relatively stable physical link propagation delay and interface processing delay under a fixed hardware topology can be included in the initial offset of the subsequent local time to global time linear mapping model.
[0108] When there is a variable link delay in the data bus that reaches or exceeds the target synchronization accuracy level, the main control unit can also use hardware sending timestamps, hardware receiving timestamps, pre-link calibration, or precise time synchronization network devices to compensate for the variable link delay.
[0109] Therefore, the main control unit can use the established initial correspondence as the initial time reference point for each acquisition module.
[0110] See attached document Figure 4 , Figure 4 This is a schematic diagram illustrating the execution principle of step S20 according to an embodiment of the present invention.
[0111] During the long-term independent operation of multimodal devices, the physical crystal oscillators inside each acquisition module are affected by ambient temperature and device aging, and their clock frequencies will dynamically drift over time.
[0112] To achieve high-precision timeline alignment, the specific execution process of step S20 above may include the following sub-steps:
[0113] S201, the main control unit operates according to the set time cycle. Determine the periodic synchronization timing marker.
[0114] Typically, time period It can be set to the range of one second to several seconds, so as to capture the slow time-varying drift characteristics of the physical crystal oscillator while avoiding high-frequency broadcasting occupying too much bus bandwidth.
[0115] When the data bus uses the Universal Serial Bus protocol, the master control unit does not change the frame start packet or microframe start packet generation period of the Universal Serial Bus protocol itself, but rather follows the time period. The target frame start packet or target microframe start packet is selected from the frame start packets or microframe start packets continuously generated by the underlying hardware controller as a periodic synchronization timing mark, and the corresponding synchronization sequence number is determined for the selected periodic synchronization timing mark. .
[0116] Before continuous data acquisition begins, the main control unit configures the same periodic synchronization timing mark filtering rules for each acquisition module. These filtering rules are used to identify the target frame start packet or target microframe start packet from continuously generated frame start packets or target microframe start packets based on the frame number, microframe count value, or preset frame interval. The main control unit and each acquisition module determine the synchronization sequence number corresponding to each target frame start packet or target microframe start packet according to the same filtering rules. This enables each acquisition module to perform timestamp capture on the same periodic synchronization time marker.
[0117] When the data bus uses the Ethernet protocol, the main control unit operates according to a time cycle. Send containing synchronization sequence number Synchronous broadcast messages or synchronous multicast messages.
[0118] The mechanism for determining, sending, and detecting the aforementioned periodic synchronization timing markers is executed by the underlying hardware communication interface or the control logic directly associated with the underlying hardware interface.
[0119] The main control unit obtains the first The sub-periodic synchronization timing mark is used to record the hardware timestamp corresponding to the actual transmission or occurrence, and the global reference time at that moment is also recorded. .
[0120] When each acquisition module detects the corresponding periodic synchronization timing mark at the underlying hardware interface, it triggers the hardware capture unit of the local hardware timer to automatically latch the current count value into the capture register and generate a hardware interrupt.
[0121] After responding to a hardware interrupt, the microcontroller reads the latched count value and uses it as the anchor point for this calibration.
[0122] For any acquisition module Its target is the first The local timestamp of the next periodic synchronization timing mark latch is denoted as .
[0123] For any acquisition module , its first The local timestamp of the hardware interrupt latch is recorded as follows: .
[0124] S202, each acquisition module performs in-band encapsulation operation of calibration anchor points.
[0125] During routine physiological signal acquisition, the analog-to-digital converter inside the acquisition module relies on the direct memory access controller to move the continuously sampled physiological data into memory and package it into physiological data frames.
[0126] To avoid forcibly inserting isolated synchronous data frames into continuous business data streams and disrupting the continuity of memory pointers in the direct memory access mechanism, each acquisition module adopts an in-band transmission strategy.
[0127] Each acquisition module captures the calibration anchor point. After that, instead of creating a new independent data frame, the synchronization sequence number is... With this calibration anchor point Together, they serve as synchronization time stamps, appended to the reserved header field of the next regular physiological data frame being constructed internally.
[0128] After the physiological data frame is encapsulated, it is transmitted back to the main control unit along with the regular physiological data stream.
[0129] S203, the main control unit parses the received physiological data stream and extracts the synchronization sequence number from the physiological data frames with time tags. and the local timestamp corresponding to the synchronization sequence number. and based on the same synchronization sequence number The local timestamp Compared with the global reference time recorded by the main control unit itself Establish mapping data pairs.
[0130] When the master control unit does not receive a valid calibration anchor point corresponding to a certain synchronization sequence number, or the received synchronization time tag fails the integrity check, the master control unit discards the mapping data pair corresponding to the synchronization sequence number and continues to update the sliding time window using subsequent valid mapping data pairs.
[0131] .
[0132] The main control unit internally maintains a memory with a length of A sliding time window that retains the most recently acquired data. One valid mapping data pair.
[0133] Sliding time window length The specific value can be determined based on the stability of the physical crystal oscillator in the actual application, for example... The value is an integer between 5 and 10.
[0134] In the Within a sliding time window, the main control unit targets the acquisition module. Construct a linear mapping model from local time to global time:
[0135] ;
[0136] in, The global time estimate obtained from the mapping calculation. For the acquisition module within this window Clock frequency deviation coefficient, This is the initial offset.
[0137] The main control unit uses the least squares method to calculate the time within the sliding time window. Linear fitting was performed on each data pair.
[0138] The linear fitting process aims to minimize the sum of squared errors. Its physical significance lies in reducing the impact of timestamp quantization errors, residual link delay fluctuations, and small random disturbances during hardware time acquisition on single-mapped data through multi-point statistical regression, thereby extracting stable clock temperature drift and frequency offset trends.
[0139] The local time series mean within the main control unit's calculation window Compared with the global time series mean :
[0140] ;
[0141] ;
[0142] in, This is the index number of the mapped data pair within the sliding time window.
[0143] Based on the principle of least squares, the main control unit calculates the clock frequency deviation coefficient. With initial offset The updated value is:
[0144] ;
[0145] ;
[0146] For conventional matrix solving algorithms using linear fitting and least squares methods, those skilled in the art can implement them using standard mathematical operation libraries. The underlying operational logic is well-known in the field and will not be elaborated here.
[0147] The system has not yet obtained the necessary time to form the first complete sliding time window after startup. When a periodic synchronous mapping data pair is generated, the main control unit enters the initialization mapping phase.
[0148] The main control unit uses the initial correspondence established in step S10 and the nominal local clock frequency of the acquisition module to determine the initial clock frequency deviation coefficient and the initial offset.
[0149] When you have obtained no fewer than two but less than When there are 10 effective periodic synchronized mapping data pairs, the main control unit can perform temporary linear fitting based on the currently obtained effective mapping data pairs; when the number of effective mapping data pairs reaches 100, the main control unit can perform temporary linear fitting based on the currently obtained effective mapping data pairs. After that, enter based on length. The normal operation phase involves continuous updates via a sliding time window.
[0150] S204, the main control unit uses the updated clock frequency deviation coefficient and the initial offset to perform mapping calculations on the original local timestamps corresponding to each physiological data sampling point in the physiological data stream;
[0151] For physiological data frames that do not carry local timestamps directly at each sampling point, the original local timestamps corresponding to each sampling point are first restored based on the local timestamp of the first sampling point, the sampling point number, and the local sampling period recorded in step S104.
[0152] For the data acquisition module Any continuously generated physiological data sampling point Its corresponding original local timestamp is .
[0153] To meet the needs of different application scenarios, the main control unit is configured with two mapping calculation logics to generate corrected global timestamps. :
[0154] In real-time feedforward compensation mode, since it is impossible to obtain calibration anchor points at future time points to construct the current window when outputting data in real time, the main control unit utilizes the previous sliding time window. The calculated model parameters are used for feedforward extrapolation of the newly received data points, i.e. .
[0155] This mode outputs aligned data with lower computational latency, making it suitable for use in scenarios with real-time requirements, such as closed-loop neural feedback experiments.
[0156] In offline high-precision correction mode, after the full data acquisition task is completed, the main control unit uses the current sliding time window that includes the time period in which the data point is located. The model parameters are then determined and corrected. .
[0157] This mode avoids the feedforward extrapolation error caused by the inability to utilize subsequent calibration anchors in the real-time feedforward compensation mode, and can improve the accuracy of post-time axis correction. It is typically used to generate high-precision aligned datasets for post-analysis.
[0158] When the clock mapping model switches from the model parameters of the previous sliding time window to the model parameters of the new sliding time window, the main control unit performs a continuity check on the corrected global timestamp at the model switching position.
[0159] When the current global timestamp obtained based on the updated model parameters is not greater than the global timestamp of the previous output sampling point, the main control unit performs continuous correction on the updated initial offset to keep the global time mapping before and after the model switching position continuous, and to keep the continuously output corrected global timestamp monotonically increasing.
[0160] See attached document Figure 5 , Figure 5 This is a schematic diagram illustrating the execution principle of step S30 according to an embodiment of the present invention.
[0161] To map multimodal physiological data with different raw sampling rates to a unified time axis and accurately associate discrete experimental events with their corresponding time positions, the specific execution process of step S30 above may include the following sub-steps:
[0162] S301, the main control unit sets the target sampling frequency. .
[0163] Typically, the target sampling frequency It can be set to a value no lower than the highest sampling rate among the original sampling rates of each acquisition module in the system, preferably equal to the highest sampling rate or an integer multiple of the highest sampling rate, so as to avoid downsampling the highest sampling rate mode during the unified time axis processing and improve the time resolution of the unified global time grid.
[0164] Based on the target sampling frequency The main control unit divides the time axis into a uniform global time grid with equal intervals. This grid consists of discrete time point sequences. The structure consists of the time interval between adjacent grid points. ,in, Indicates time interval Increasing discrete global time points.
[0165] For each acquisition module The main control unit uses its corrected global timestamp As the independent variable node, with the corresponding physiological signal amplitude As the dependent variable, construct a module corresponding to the data acquisition module. cubic spline interpolation function .
[0166] The main control unit further utilizes the cubic spline interpolation function. The amplitude of the corresponding synchronous physiological signal is calculated at each grid point of the unified global time grid, thereby completing the unified time axis resampling of the physiological signals of each acquisition module.
[0167] For acquisition modules with an original sampling rate lower than the target sampling frequency, this process is characterized by interpolation upsampling based on a unified global time grid.
[0168] For acquisition modules where the original sampling rate equals the target sampling frequency, when the corrected original sampling timestamp coincides with the corresponding grid point, the original physiological signal amplitude can be directly used; otherwise, the physiological signal amplitude at the corresponding grid point is calculated using the cubic spline interpolation function.
[0169] Cubic spline interpolation helps maintain the continuity of the first and second derivatives at waveform nodes, thereby improving the continuity and smoothness of physiological signals after time axis resampling and reducing waveform abrupt changes caused by time axis resampling.
[0170] For any interval Target grid points within Its interpolation polynomial expression is:
[0171] ;
[0172] Among them, coefficient , , as well as It is determined by the function values of adjacent nodes and the boundary conditions for the continuity of derivatives.
[0173] The main control unit calculates the acquisition module based on this polynomial. Synchronization amplitude sequence on a unified global time grid .
[0174] For the specific solution matrix of polynomial coefficients in the cubic spline interpolation algorithm, those skilled in the art can use conventional numerical calculation methods to achieve it. The solution process is a well-known technology in this field and will not be described in detail here.
[0175] In real-time closed-loop mode, the main control unit maintains a finite-length interpolation buffer when performing cubic spline interpolation to temporarily store the current time interval to be processed and several adjacent raw physiological data sampling points.
[0176] When the right-side adjacent sampling node required to calculate the cubic spline interpolation value at the target grid point or the global time position of the event has not yet arrived, the main control unit temporarily suspends the output of data for the corresponding time interval.
[0177] After the required adjacent sampling nodes arrive, a local cubic spline interpolation function is constructed based on the nodes in the interpolation buffer, and the corresponding synchronous physiological signal data or virtual physiological sampling points are output.
[0178] Therefore, the real-time closed-loop mode trades limited sampling point buffering delay for the adjacent node information required for cubic spline interpolation.
[0179] In offline high-precision processing mode, a cubic spline interpolation function can be established based on the full amount of physiological data that has been collected.
[0180] S302 During the experiment, discrete experimental event markers will be input from outside the system to record the timing of specific experimental actions such as sound and light stimulation.
[0181] Let the set of discrete experimental event labels be . For any discrete experimental event, mark The main control unit, using its external hardware trigger interface, triggers the hardware capture channel of the high-precision system timer the instant it captures an event pulse signal, automatically latching the current count value into the event timestamp capture register. It then reads the latched time value from the event timestamp capture register, thereby generating a global event timestamp that is identical to the global reference time. .
[0182] The main control unit operates on a unified global time grid. In the search and event global timestamp The unified global time grid point with the smallest time distance The calculation formula is as follows:
[0183] ;
[0184] The main control unit calculates the nearest grid point. with event global timestamp The time matching deviation between them, wherein the time matching deviation is the absolute value of the time difference between the two:
[0185] .
[0186] To assess the impact of this deviation on data alignment, the main control unit sets a time deviation tolerance threshold. .
[0187] The time deviation tolerance threshold Less than half the time step of the unified global time grid, that is:
[0188] ;
[0189] For example, the time deviation tolerance threshold It can be set to one-quarter of the time step of the uniform global time grid, that is:
[0190] .
[0191] The main control unit will adjust the time matching deviation. With time deviation tolerance threshold Perform a comparison. If there is a time matching deviation... Less than or equal to the time deviation tolerance threshold The main control unit determines the nearest grid point. If the nearest matching condition is met, the discrete experimental events are directly marked. Associate it with the data point corresponding to the nearest grid point.
[0192] S303, if time matching is off Greater than the time deviation tolerance threshold This indicates that the time of occurrence of the external event is far from the nearest grid point in the unified global time grid.
[0193] If the event is directly associated with the nearest grid point at this time, it will cause an artificial offset of the event on the time axis, introduce quantization truncation error, and thus affect the accuracy of subsequent phase-locked analysis such as event-related potentials.
[0194] In this case, the master control unit maintains the discrete experimental event flags. Global timestamp of events The process remains unchanged, and for all acquisition modules within the system, the cubic spline interpolation function constructed in step S301 is used respectively. Global time location of events at non-grid points The estimated amplitude of each modality of physiological signal is calculated directly at this point:
[0195] ;
[0196] in, Indicates the data acquisition module At the global time location of the event The amplitude of the virtual physiological signal at the location.
[0197] The main control unit is based on the global timestamp of the event. Estimated amplitude corresponding to all acquisition modules within the system Generate virtual physiological sampling points with precise time attributes. .
[0198] The main control unit marks discrete experimental events. It is directly associated with the virtual physiological sampling point.
[0199] This operational mechanism enables external events to be embedded into the physiological data stream according to their global timestamp, avoiding time quantization truncation errors caused by forcibly associating events with the nearest grid point, and filling the logical dead zone where discrete time grids cannot accurately cover the moment of random event occurrence.
[0200] See attached document Figure 6 , Figure 6 This is a flowchart illustrating the execution of step S40 according to an embodiment of the present invention.
[0201] After unifying the timeline and aligning the multimodal data, the system needs to organize the data in a structured manner to achieve standardized output.
[0202] The specific execution process of step S40 above may include the following sub-steps.
[0203] S401, the main control unit constructs multi-dimensional structured fused data frames.
[0204] The construction of structured data frames aims to convert temporally aligned, modal-independent data streams into spatially physically contiguous blocks of memory, thereby reducing the addressing overhead of subsequent bus transfers.
[0205] Under a unified global time grid Each grid point At that point, the main control unit extracts the corresponding global timestamp and performs vector merging of the synchronization amplitude sequences of the EEG module, eye-tracking module, and near-infrared module at that time point.
[0206] The main control unit sets the physical memory format of the structured data frame, which includes a timestamp field, a modality configuration field, a physiological data vector field, and an event tag field in sequence.
[0207] Set grid points The physiological data vector at that location is:
[0208] ;
[0209] in , as well as ;
[0210] These represent the synchronization amplitudes obtained after time resampling of the EEG, eye-tracking, and near-infrared modes, respectively. This represents the vector transpose operation.
[0211] When grid points When no discrete experimental event occurs, the master control unit configures the event tag field in the current data frame to a preset null flag.
[0212] When grid points When the discrete experimental event marker determined in step S302 is associated, the main control unit will associate the corresponding discrete experimental event marker with the global timestamp of the event corresponding to the discrete experimental event marker. Write the event tag field to the structured data frame corresponding to the grid point;
[0213] When the same grid point is associated with multiple discrete experimental event tags, the multiple discrete experimental event tags are written into the event tag field in the form of an event tag list or an event code set.
[0214] S402, the main control unit performs time-series fusion operation of virtual physiological sampling points.
[0215] For the virtual physiological sampling points generated in step S30, the main control unit uses the global timestamps of the events they contain. The numerical values are then inserted into a linear sequence composed of conventional multidimensional structured fused data frames in a monotonically increasing order over time.
[0216] For the data frame corresponding to the virtual physiological sampling point, the main control unit writes the timestamp field to the global event timestamp. Write the physiological data vector field into a virtual data vector containing the estimated amplitude of each modality. And write the specific discrete experiment event tag in the event tag field. .
[0217] By traversing all discrete time points and event markers of the unified global time grid, the main control unit generates a structured fusion dataset in memory based on the unified global time benchmark and arranged in a continuous monotonically increasing order according to the timestamps corresponding to each data point.
[0218] S403, the main control unit configures the output routing path of the data stream based on the control commands input from the outside.
[0219] When the control command sets the system to real-time closed-loop mode, the main control unit configures an unlocked circular buffer in the internal random access memory and pushes the continuously monotonically increasing structured fusion dataset into the unlocked circular buffer in sequence.
[0220] Subsequently, the main control unit activates the internal network communication hardware interface, asynchronously reads data from the unlocked circular buffer, and packages the structured fusion dataset into a network transmission payload using the User Datagram Protocol (UDP). This payload is then sent to the external computing node in the form of a low-latency data stream to support the external computing node in performing real-time EEG state decoding or feedback calculations.
[0221] When the control command sets the system to offline storage mode, the main control unit calls the internal underlying file system to convert the structured fusion dataset according to the target file format and write it to the local storage medium.
[0222] When using a hierarchical data format, the unified global time grid data, virtual physiological sampling points, and discrete experimental event markers are stored in a structured manner according to their respective global timestamps.
[0223] When using the European data format EDF+, physiological signals with equal time intervals on a unified global time grid are written into the corresponding physiological signal channels, and discrete experimental event markers and their global timestamps are written into the EDF+ event annotation channels.
[0224] For virtual physiological sampling points, their global event timestamps are used as the occurrence time of the corresponding event annotations, and the estimated amplitudes of each modality are written into the corresponding event annotation content in a preset data encoding format.
[0225] For the underlying message encapsulation mechanism of network communication protocols and the standard header definition of various file formats, those skilled in the art can use publicly available network protocol stacks and general file writing libraries to implement them. The specific underlying code arrangement is a well-known technology in this field and will not be elaborated here.
[0226] See attached document Figure 7 , Figure 7 This is a comprehensive comparison chart of the multimodal data alignment logic and experimental results verification according to a specific application embodiment of the present invention.
[0227] 1. Numerical Calculation Application Example In this multimodal closed-loop experimental scenario, the system includes a main control unit, an EEG module, and a near-infrared module.
[0228] 2. The nominal sampling rate of the EEG module is 1000Hz (local sampling period). ).
[0229] After the system starts up, and after a period of continuous data acquisition, the physical crystal oscillator drifts due to the temperature rise.
[0230] The main control unit collects the latest mapping data pairs through a sliding time window and updates the clock mapping parameters of the EEG module using the least squares method.
[0231] Clock frequency deviation coefficient (Indicating a slight slowdown in the local EEG clock), initial offset .
[0232] At this point, the EEG module generates a raw local timestamp corresponding to the local timer count value. The sampling points.
[0233] The main control unit uses the updated model to correct it and calculates the corrected global timestamp:
[0234] ;
[0235] The calculation results show that the original local time of the EEG module has been accurately mapped to the system's unified global time reference.
[0236] Entering the unified timeline alignment phase, the main control unit sets the target sampling frequency. Hz corresponds to the time step of the unified global time grid. The set time deviation tolerance threshold. .
[0237] The unified global time grid includes adjacent grid points. and .
[0238] During the experiment, the external stimulation device was at the global reference time. A discrete experimental event label for an auditory stimulus was input at each moment. .
[0239] The main control unit searches the unified global time grid to determine the grid point with the closest time distance. .
[0240] Calculate time matching deviation:
[0241] ;
[0242] Due to time matching deviation (350) s) greater than the time deviation tolerance threshold (250) s), if the event is forced to align to the nearest grid point, it will generate 350. The artificial time truncation error of s.
[0243] Therefore, the main control unit triggers the virtual sampling point generation mechanism.
[0244] The master control unit constructs a cubic spline interpolation function for EEG using the context-corrected global timestamp as nodes. And substitute the actual moment the event occurred. The estimated amplitude at the non-grid point can be calculated directly:
[0245] ;
[0246] As attached Figure 7 As shown in the magnified area, the virtual physiological sampling point (marked with an asterisk) is precisely embedded between adjacent discrete grid point data (marked with dots), preserving the true physical location of the stimulus event at an extremely high temporal resolution.
[0247] 2. Experimental verification and effect comparison
[0248] To verify the technical effectiveness of the method provided in this invention in eliminating time quantization truncation errors, a test platform was constructed using a standard physiological signal generator and multimodal acquisition equipment. 500 random auditory stimuli were applied, experimental data were extracted, and event-related potentials (ERPs) were measured. Superimposed average analysis.
[0249] Appendix Figure 7 The main plot area displays auditory evoked potentials (typical N100 components) generated based on measured data. Comparison of superimposed waveforms.
[0250] The horizontal axis represents the relative time (milliseconds) with the event occurrence time as zero, and the vertical axis represents the amplitude of the EEG signal (microvolts). .
[0251] In the conventional nearest grid point forced alignment method ( Figure 7 middle dashed line waveform In this process, random events that deviate from the grid points are roughly attributed to the nearest grid point, introducing a random time jitter of up to a maximum of positive or negative half a sampling period on the time axis in each trial.
[0252] When this artificial jitter is used to perform 500 cross-trial averaging, the high-frequency components of the waveform are severely smoothed, the N100 peak is significantly broadened, and the peak amplitude is significantly attenuated.
[0253] In contrast, the cubic spline interpolation strategy used in this embodiment of the invention to generate virtual physiological sampling points ( Figure 7 (Solid line waveform) The global time position of the event was accurately reconstructed through the aforementioned numerical calculation logic. The amplitude of physiological signals at the location.
[0254] The solid-line waveform shows a sharper latency for the N100 component, with a peak amplitude approximately 18.5 higher than that obtained using the conventional method. This comparative experiment, based on real data, objectively confirms that:
[0255] This invention effectively eliminates quantization truncation errors in the correlation process of discrete events through numerical interpolation mechanisms and structured data encapsulation, greatly improving the performance of phase-locked physiological signals (such as event-related potentials). Fidelity and significance of features in post-hoc analysis.
[0256] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for synchronizing and processing multimodal physiological signals based on timestamp calibration, characterized in that, Includes the following steps: Send out the start synchronization broadcast signal to control each acquisition module to latch the start timestamp and send back the first frame of data; Provide periodic synchronization timing markers, update clock mapping parameters, and generate a corrected global timestamp based on the clock mapping parameters; A unified global time grid is set up for time axis resampling. When the time matching deviation of discrete experimental events is greater than the time deviation tolerance threshold, virtual physiological sampling points are generated. The resampled data and the virtual physiological sampling points are vector-encapsulated to generate a structured fusion dataset.
2. The method according to claim 1, characterized in that, The step of sending out the initial synchronization broadcast signal, controlling each acquisition module to latch the initial timestamp and transmit the first frame of data, includes: Activate the system timer to establish a global clock source; Send the initial synchronization broadcast signal and record the global start timestamp; Generate a hardware time capture event and latch the start timestamp; Initiate the analog-to-digital conversion operation to generate the original local timestamp, and send the original local timestamp back with the first frame data to establish an initial correspondence pair.
3. The method according to claim 1, characterized in that, The updated clock mapping parameters include: Each acquisition module latches its local timestamp as a calibration anchor point; in-band encapsulation is performed on the calibration anchor point, and the data is transmitted back along with the physiological data stream. Extract the synchronization sequence number and the local timestamp to generate a mapping data pair; The mapped data pairs are linearly fitted, and the clock frequency deviation coefficient and initial offset, which are used as clock mapping parameters, are updated.
4. The method according to claim 3, characterized in that, The step of generating the corrected global timestamp based on the clock mapping parameters includes: Using the updated clock frequency deviation coefficient and the initial offset, a linear mapping calculation is performed on the local timestamp to generate the corrected global timestamp, and a continuity check is performed.
5. The method according to claim 1, characterized in that, When the time matching deviation of discrete experimental events exceeds the time deviation tolerance threshold, virtual physiological sampling points are generated, including: Calculate the time matching deviation between the time of occurrence of the discrete experimental event and the nearest grid point; When the time matching deviation is greater than the time deviation tolerance threshold, a cubic spline interpolation function is constructed using the corrected global timestamp as the node; Substitute the occurrence time of the discrete experimental event into the cubic spline interpolation function to calculate the estimated amplitude as the virtual physiological sampling point.
6. The method according to claim 5, characterized in that, Also includes: When the time matching deviation is not greater than the time deviation tolerance threshold, the time of occurrence of the discrete experimental event is associated with the nearest grid point.
7. The method according to claim 1, characterized in that, The step of vector encapsulating the resampled data with the virtual physiological sampling points to generate a structured fusion dataset includes: Construct a multi-dimensional structured fused data frame, merge the synchronization amplitude sequence and configure the event label field; Perform a time-series fusion operation on the virtual physiological sampling points to generate the structured fusion dataset; Configure the output routing path of the data stream according to the control instructions and then output it.
8. A multimodal physiological signal synchronization processing system based on timestamp calibration, characterized in that, include: The initial synchronization module is used to send out the initial synchronization broadcast signal, control each acquisition module to latch the start timestamp and send back the first frame of data; The calibration mapping module is used to provide periodic synchronization timing markers, update clock mapping parameters, and generate a corrected global timestamp based on the clock mapping parameters. The resampling and interpolation module is used to set a unified global time grid for time axis resampling. When the time matching deviation of discrete experimental events is greater than the time deviation tolerance threshold, virtual physiological sampling points are generated. The encapsulation output module is used to encapsulate the resampled data with the virtual physiological sampling points into vectors to generate a structured fusion dataset.
9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the timestamp-calibrated multimodal physiological signal synchronization processing method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform the timestamp-calibrated multimodal physiological signal synchronization processing method as described in any one of claims 1 to 7.
