Skip to content

Correctly infer length of record when unspecified #323

New issue

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

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

Already on GitHub? # to your account

Merged
merged 4 commits into from
Sep 10, 2021
Merged

Conversation

bemoody
Copy link
Collaborator

@bemoody bemoody commented Aug 27, 2021

If the header file does not specify the signal length, rdrecord tries to determine it based on the length of the first signal file.

This calculation was wrong when the signal file contained a prolog, or any signal contained multiple samples per frame.

Benjamin Moody added 4 commits August 17, 2021 11:05
If the header file does not specify the record length, it must be
inferred from the size of the signal file (dividing the data length by
the number of samples per frame.)

Previously, this calculation assumed that tsamps_per_frame == n_sig,
which is not necessarily the case.  Correctly calculate the total spf
for the first signal file and use that as the divisor, rather than the
number of signals.  Rename the "n_sig" parameter of _infer_sig_len to
tsamps_per_frame accordingly.
If the header file does not specify the signal length, rdrecord should
calculate it from the size of the signal file.  Test that this works
correctly for multi-frequency records.
If the header file does not specify the record length, it must be
inferred from the size of the signal file (dividing the data length by
the number of samples per frame.)

Previously, this calculation assumed that the file did not contain a
prolog.  Correctly calculate the data length by subtracting the prolog
length (byte offset) from the size of the file.
If the header file does not specify the signal length, rdrecord should
calculate it from the size of the signal file.  Test that this works
correctly for a signal file with a prolog.
@tompollard
Copy link
Member

Thanks @bemoody, looks good to me.

@tompollard tompollard merged commit ae67d09 into master Sep 10, 2021
@tompollard tompollard deleted the infer-length branch September 10, 2021 16:38
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants