Skip to content

Commit 62670aa

Browse files
committed
Fixed bug in read_fastfood code when filename is supplied
1 parent 2cb6106 commit 62670aa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Corrfunc/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ def read_fastfood(filename, return_dtype=None, need_header=None):
129129
input_dtype = np.float32 if skip1 // ngal == 4 else np.float
130130
array = np.fromfile(f, input_dtype, ngal)
131131
skip2 = struct.unpack(bytes_to_native_str(b'@i'), f.read(4))[0]
132-
pos[field] = array if dtype is None else dtype(array)
132+
pos[field] = array if return_dtype == input_dtype \
133+
else return_dtype(array)
133134

134135
x = pos['x']
135136
y = pos['y']
@@ -181,7 +182,7 @@ def read_fastfood(filename, return_dtype=None, need_header=None):
181182
f = read_fastfood if '.ff' in extension else read_ascii
182183

183184
# default return is double
184-
x, y, z = f(filebase, np.float)
185+
x, y, z = f(filebase, np.float32)
185186
return x, y, z
186187

187188
raise IOError("Could not locate file {0}".format(filebase))

0 commit comments

Comments
 (0)