Skip to content
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

Dealing with data that come through as a stream of bytes #339

Open
ohmycaptainnemo opened this issue Nov 4, 2024 · 0 comments
Open

Dealing with data that come through as a stream of bytes #339

ohmycaptainnemo opened this issue Nov 4, 2024 · 0 comments

Comments

@ohmycaptainnemo
Copy link

Hi,

I really like npTDMS and am aware that it already allows for processing the TDMS file in chunks. But I could not find any examples of how to use npTDMS when the data is not in form of a file.
For example, I have a situation in which a large TDMS file comes through as chunks of bytes. Unfortunately, this means that even though reading the first chunk of bytes works as expected, the rest of the chunks result in the error:

ValueError: File should either start with 'b`TDSh`' or 'b`TDSm

or warnings such as:

[nptdms.reader WARNING] Last segment of file has less data than expected, will attempt to read to the end of the file
[nptdms.tdms_segment WARNING] Data size 3705 is not a multiple of the chunk size 7232. Will attempt to read last chunk

Which makes sense. Furthermore, in my case, I cannot read the large TDMS file into the memory and then wrap it in a BytesIO object as I do not have large memory at my disposal. So the only way I can think of is to process the chunks of data as they come through.

I would appreciate any thoughts or ideas regarding how it would be possible and how to use npTDMS for this use case.

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

No branches or pull requests

1 participant