Skip to content

Conversation

@briangow
Copy link
Contributor

As mentioned in #557, we should add segment validation when writing multi-segment records. This PR adds pre-write validation to MultiRecord.wrsamp() by activating the previously unused _check_segment_cohesion() method, which is now called before any files are written.

The validation includes checks for basic segment cohesion (matching n_seg, sampling frequencies, and segment lengths) as well as new validation for expanded signals. For segments with e_d_signal or e_p_signal, the method now verifies that samps_per_frame is properly set for all channels and that expanded signal lengths match expected values (samps_per_frame[ch] * sig_len). This provides clear, descriptive error messages when segments are misconfigured, preventing invalid multi-segment records from being written.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants