MatrixFiles#
- class caf.mat.matrices.MatrixFiles(segmentation_, zoning, type_, folder, *, filename_template=None, check_files=True)[source]#
Bases:
MatricesBaseHandle matrices stored as CSVs in a single folder.
- Parameters:
segmentation – Segmentation for the matrices.
zoning (ZoningSystem) – ZoningSystem for all the matrices.
type – Type of the matrices.
folder (Path) – Path to folder for storing matrices in.
filename_template (str | None) –
Template for the filenames of individual matrix CSVs, if None defaults to “{type}_{slice_name}”. Template will be infilled with the following: - {type} - name of the matrix type_ e.g. “OD”; - {slice_name} - the name of the individual slice e.g. “p1_m3_nhb”
from
SegmentationSlice.check_files (bool) – If True (default) raises an error if CSV files don’t already exist for all slices in segmentation.
todo:: (..) – Add support for zipped folders.
segmentation_ (Segmentation)
type_ (MatrixType)
Attributes
Methods
__init__(segmentation_, zoning, type_, folder, *)exists()Check if matrices exist for all slices.
get_matrix(slice_)Load the matrix from a CSV.
new(name, *[, segmentation_, zoning, type_])Create a new instance of the matrices class with a new name.
set_matrix(matrix, slice_)Save the matrix to a CSV, with a filename based on the slice parameters.
Attributes Documentation
- folder#
Path to folder containing the matrices.
- name#
Name of the matrices.