def write_npz(windows, proximity_matrix, output_file):
"""Write a proximity matrix to an npz file.
npz files are a compressed numpy-specific format, meaning
they take up less disk space, but cannot be easily opened
by other programming languages (e.g. R). For more information
see :func:`numpy.savez_compressed`.
:param tuple windows: (list of x-axis windows, list of y-axis windows)
:param proximity_matrix: Input proximity matrix.
:type proximity_matrix: :class:`numpy array <numpy.ndarray>`
:param str filepath: Path to save matrix file.
"""
window_dict = {
'windows_{}'.format(i): win for i,
win in enumerate(windows)}
np.savez_compressed(output_file, scores=proximity_matrix, **window_dict)
评论列表
文章目录