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

Fix issue with loading large files #101

Merged
merged 1 commit into from
Nov 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nrrd/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def read_data(header, fh=None, filename=None, index_order='F'):
fh = open(data_filename, 'rb')

# Get the total number of data points by multiplying the size of each dimension together
total_data_points = header['sizes'].prod()
total_data_points = header['sizes'].prod(dtype=np.int64)

# Skip the number of lines requested when line_skip >= 0
# Irrespective of the NRRD file having attached/detached header
Expand Down
4 changes: 3 additions & 1 deletion nrrd/tests/test_reading.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,16 +412,18 @@ def test_invalid_endian(self):
with self.assertRaisesRegex(nrrd.NRRDError, 'Invalid endian value in header: "fake"'):
nrrd.read_data(header, fh, RAW_NRRD_FILE_PATH)


def test_invalid_index_order(self):
with self.assertRaisesRegex(nrrd.NRRDError, 'Invalid index order'):
nrrd.read(RAW_NRRD_FILE_PATH, index_order=None)


class TestReadingFunctionsFortran(TestReadingFunctions, unittest.TestCase):
index_order = 'F'


class TestReadingFunctionsC(TestReadingFunctions, unittest.TestCase):
index_order = 'C'


if __name__ == '__main__':
unittest.main()