Skip to content

BF: always save data in <f4 #545

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

Merged
merged 2 commits into from
Jul 5, 2017
Merged

BF: always save data in <f4 #545

merged 2 commits into from
Jul 5, 2017

Conversation

MarcCote
Copy link
Contributor

@MarcCote MarcCote commented Jul 3, 2017

Fixes #543
It seems that index trick np.r_[...] (for arrays concatenation) results in an array that has the same endianness of the system without any regard to the endianness of the arrays to be concatenated.

For instance, on a little-endian system:

In [1]: import numpy as np
In [2]: A = np.array([1,2,3], dtype=">f4")
In [3]: B = np.array([1,2,3], dtype=">f4")
In [4]: np.r_[A, B].dtype
Out[4]: dtype('float32')
In [5]: np.r_[A, B].dtype.byteorder
Out[5]: '='

@@ -220,9 +220,9 @@ def save(self, fileobj):
tractogram = self.tractogram.to_world(lazy=True)

for t in tractogram:
s = t.streamline.astype(dtype)
s = t.streamline
data = np.r_[s, self.FIBER_DELIMITER]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Save a line with:

data = np.r_[t.streamline, self.FIBER_DELIMITER]

?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 96.227% when pulling 25d5ba0 on MarcCote:bf_543 into c6e06d9 on nipy:master.

@codecov-io
Copy link

codecov-io commented Jul 3, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@c6e06d9). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #545   +/-   ##
=========================================
  Coverage          ?   94.27%           
=========================================
  Files             ?      177           
  Lines             ?    24332           
  Branches          ?     2610           
=========================================
  Hits              ?    22940           
  Misses            ?      918           
  Partials          ?      474
Impacted Files Coverage Δ
nibabel/streamlines/tck.py 98.88% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c6e06d9...c8b3479. Read the comment docs.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.0002%) to 96.227% when pulling c8b3479 on MarcCote:bf_543 into c6e06d9 on nipy:master.

@matthew-brett
Copy link
Member

Thanks for indulging my pedantry :)

@matthew-brett matthew-brett merged commit f5dec18 into nipy:master Jul 5, 2017
@MarcCote MarcCote deleted the bf_543 branch July 8, 2017 13:29
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.

4 participants