Skip to content

Conversation

@skoudoro
Copy link
Collaborator

fixes #83

This pull request introduces a better handling of endianness to ensure cross-platform compatibility when reading and writing TRX files. The changes add utility functions to enforce little-endian byte order, update all relevant file writing operations to use these utilities, and include extensive tests to verify correct behavior for various data types and scenarios.

  • Added _get_dtype_little_endian and _ensure_little_endian utility functions in trx_file_memmap.py to convert data types and arrays to little-endian format, ensuring all data written to disk conforms to the TRX file specification for cross-platform compatibility.
  • Updated all file writing operations in TrxFile.deepcopy and related functions to use _ensure_little_endian, ensuring that positions, offsets, and all per-vertex, per-streamline, and per-group data are saved in little-endian byte order. [1] [2] [3] [4] [5] [6]
  • Modified the _create_memmap function to always use little-endian dtypes when mapping files, and updated the test for memmap creation accordingly. [1] [2]
  • Updated trx/workflows.py to ensure all streamline and data arrays are written in little-endian order using the new utility functions, covering positions, offsets, and additional data arrays. [1] [2]
  • Added comprehensive tests in test_memmap.py to verify correct dtype conversion, array onversion, and roundtrip data integrity for various data types and endianness scenarios.

@codecov-commenter
Copy link

codecov-commenter commented Jan 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@43edfbb). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff            @@
##             master      #89   +/-   ##
=========================================
  Coverage          ?   59.76%           
=========================================
  Files             ?       12           
  Lines             ?     2411           
  Branches          ?        0           
=========================================
  Hits              ?     1441           
  Misses            ?      970           
  Partials          ?        0           
Flag Coverage Δ
unittests 59.76% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@skoudoro
Copy link
Collaborator Author

I just tested on Fedora machine and it seems all good. see the screenshot below:

image

ready to be merged @arokem

@skoudoro
Copy link
Collaborator Author

Also, Can you accept the request for codecov @arokem or @frheault ?

Thank you

@skoudoro skoudoro added the bug Something isn't working label Jan 16, 2026
@arokem
Copy link
Collaborator

arokem commented Jan 16, 2026

I believe I just approved the codecov request.

@skoudoro
Copy link
Collaborator Author

I believe I just approved the codecov request.

I confirm, and I do not have the permission to configure it.

So I let you do it and add the secret to make it work. Thanks @arokem

@frheault
Copy link
Collaborator

@skoudoro Do you have a branch on the Dipy repo using this PR content to ensure that these changes are not breaking outside of the repo. This could avoid surprises down the line.

@skoudoro
Copy link
Collaborator Author

Hi @frheault,

I tried with the last release, no issue. but let me connect to fedora and try with master branch

@arokem
Copy link
Collaborator

arokem commented Jan 27, 2026

Given it works with the released DIPY, let's go ahead and merge this. We can keep an eye on this with future DIPY versions as well.

@arokem arokem merged commit b3a28c9 into tee-ar-ex:master Jan 27, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some tests fail on s390x (big endian) consistently

4 participants