Skip to content
Merged
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
10 changes: 5 additions & 5 deletions pyemu/mat/mat_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def save_coo(x, row_names, col_names, filename, chunk=None):
header = np.array((x.shape[1], x.shape[0], x.nnz), dtype=Matrix.binary_header_dt)
header.tofile(f)

data = np.core.records.fromarrays([x.row, x.col, x.data], dtype=Matrix.coo_rec_dt)
data = np.rec.fromarrays([x.row, x.col, x.data], dtype=Matrix.coo_rec_dt)
data.tofile(f)

for name in col_names:
Expand Down Expand Up @@ -1897,7 +1897,7 @@ def to_coo(self, filename, droptol=None, chunk=None):

if chunk is None:
flat = self.x[row_idxs, col_idxs].flatten()
data = np.core.records.fromarrays(
data = np.rec.fromarrays(
[row_idxs, col_idxs, flat], dtype=self.coo_rec_dt
)
data.tofile(f)
Expand All @@ -1908,7 +1908,7 @@ def to_coo(self, filename, droptol=None, chunk=None):
# print(row_idxs[start],row_idxs[end])
# print("chunk",start,end)
flat = self.x[row_idxs[start:end], col_idxs[start:end]].flatten()
data = np.core.records.fromarrays(
data = np.rec.fromarrays(
[row_idxs[start:end], col_idxs[start:end], flat],
dtype=self.coo_rec_dt,
)
Expand Down Expand Up @@ -2052,15 +2052,15 @@ def to_binary(self, filename, droptol=None, chunk=None):

if chunk is None:
flat = self.x[row_idxs, col_idxs].flatten()
data = np.core.records.fromarrays([icount, flat], dtype=self.binary_rec_dt)
data = np.rec.fromarrays([icount, flat], dtype=self.binary_rec_dt)
# write
data.tofile(f)
else:
start, end = 0, min(chunk, row_idxs.shape[0])
while True:
# print(row_idxs[start],row_idxs[end])
flat = self.x[row_idxs[start:end], col_idxs[start:end]].flatten()
data = np.core.records.fromarrays(
data = np.rec.fromarrays(
[icount[start:end], flat], dtype=self.binary_rec_dt
)
data.tofile(f)
Expand Down
Loading