Segmentation#
- class caf.base.segmentation.Segmentation(config)[source]#
Bases:
objectSegmentation class for handling segmentation objects.
- Parameters:
config (SegmentationInput)
details. (Instance of SegmentationInput. See that class for)
Attributes
Return the names of all segments.
Return a list of segment descriptions.
Access segments in dict form.
Return all segmentation values.
Methods
__init__(config)add_segment(new_seg[, subset, new_naming_order])Add a new segment to a segmentation.
aggregate(new_segs)Aggregate segmentation to a subset of the segmentation.
convert_slice_name(name)Convert segmentation slice name into parameters.
convert_slice_tuple(slice_tuple)Convert a segmentation slice tuple into SegmentationSlice.
copy()Copy an instance of this class.
find_files(folder, template, suffixes)Find files split by segmentation in given folder.
generate_slice_name(slice_)Generate name for a slice of the segmentation from parameters.
get_segment(seg_name)Get a segment based on its name.
get_segment_values(segment)Get list of values for segment, checks for subsets.
Check whether this segmentation has time period segmentation.
ind()Return a pandas MultiIndex of the segmentation.
is_subset(other)Check whether self is a subset of other.
iter_slices([filter_])Iterate through parameters for all segmentation slices.
load(in_path[, mode])Load the segmentation from a file, either an hdf or csv file.
Produce an index from the lookups of the segments.
overlap(other)Check the overlap in segments between two segmentations.
reinit()Regenerate Segmentation from its input.
remove_segment(segment_name[, inplace])Remove a segment from a segmentation.
save(out_path[, mode])Save a segmentation to either a yaml file or an hdf file if part of a DVector.
subset_difference(other)Return the difference between self and other's subsets.
translate_segment(from_seg, to_seg[, ...])Translate one of the segments making up the segmentation.
update_subsets(extension[, remove])Add to subsets dict.
validate_segmentation(source, segmentation)Validate a segmentation from either a path to a csv, or a dataframe.
validate_slice(slice_[, fix_order])Validate slice contains expected segments, and no extra.
Attributes Documentation
- names#
Return the names of all segments.
- seg_descriptions#
Return a list of segment descriptions.
- seg_dict#
Access segments in dict form.
- seg_vals#
Return all segmentation values.