Skip to content

BF: allow for BrainModels or Parcels to contain a single vertex #739

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
Mar 13, 2019
Merged

BF: allow for BrainModels or Parcels to contain a single vertex #739

merged 2 commits into from
Mar 13, 2019

Conversation

MichielCottaar
Copy link
Contributor

Fixes an edge case in the reading of CIFTI files.
Tests for this edge case have been added for both the BrainModel and Parcel axes.

…ertex

Fixes an edge case in the reading of CIFTI files.
Tests for this edge case have been added for both the BrainModel and Parcel axes.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 91.908% when pulling 33d061f on MichielCottaar:bug_single_vertex into de09d3a on nipy:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 91.908% when pulling 33d061f on MichielCottaar:bug_single_vertex into de09d3a on nipy:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 91.908% when pulling 33d061f on MichielCottaar:bug_single_vertex into de09d3a on nipy:master.

@coveralls
Copy link

coveralls commented Mar 12, 2019

Coverage Status

Coverage remained the same at 91.908% when pulling 3a1a94b on MichielCottaar:bug_single_vertex into de09d3a on nipy:master.

Copy link
Member

@effigies effigies left a comment

Choose a reason for hiding this comment

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

I believe this is equivalent to using np.loadtxt's ndmin parameter. Could you check that before we call another function?

@@ -517,7 +517,7 @@ def flush_chardata(self):
# conversion to numpy array
c = BytesIO(data.strip().encode('utf-8'))
vertices = self.struct_state[-1]
vertices.extend(np.loadtxt(c, dtype=np.int))
vertices.extend(np.atleast_1d(np.loadtxt(c, dtype=np.int)))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
vertices.extend(np.atleast_1d(np.loadtxt(c, dtype=np.int)))
vertices.extend(np.loadtxt(c, dtype=np.int, ndmin=1))

@@ -531,7 +531,7 @@ def flush_chardata(self):
# conversion to numpy array
c = BytesIO(data.strip().encode('utf-8'))
index = self.struct_state[-1]
index.extend(np.loadtxt(c, dtype=np.int))
index.extend(np.atleast_1d(np.loadtxt(c, dtype=np.int)))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
index.extend(np.atleast_1d(np.loadtxt(c, dtype=np.int)))
index.extend(np.loadtxt(c, dtype=np.int, ndmin=1))

@effigies effigies added this to the 2.4.0 milestone Mar 12, 2019
@codecov-io
Copy link

codecov-io commented Mar 12, 2019

Codecov Report

Merging #739 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #739   +/-   ##
=======================================
  Coverage   89.39%   89.39%           
=======================================
  Files          93       93           
  Lines       11476    11476           
  Branches     1992     1992           
=======================================
  Hits        10259    10259           
  Misses        881      881           
  Partials      336      336
Impacted Files Coverage Δ
nibabel/cifti2/parse_cifti2.py 83.76% <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 de09d3a...3a1a94b. Read the comment docs.

@MichielCottaar
Copy link
Contributor Author

Well spotted, that indeed has the same effect (sorry, I only noticed that I could simply have accepted your suggested changes after pushing a commit based on your update)

@effigies
Copy link
Member

LGTM. Thanks.

@effigies effigies merged commit 77c5baa into nipy:master Mar 13, 2019
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