brain_pipe.split.mid.MidSplit¶
- class MidSplit(*args, **kwargs)¶
Bases:
Splitter
Split data in the middle of the data.
- __init__(*args, **kwargs)¶
Create a mid-splitter.
- Parameters:
args (Sequence[Any]) – Arguments to pass to the Splitter.
kwargs (Dict[str, Any]) – Keyword arguments to pass to the Splitter.
Methods
__init__
(*args, **kwargs)Create a mid-splitter.
parse_dict_keys
(key[, name, ...])Parse a key or a sequence of keys.
split
(data, shortest_length, split_fraction, ...)Split the data into sets.
- parse_dict_keys(key: str | Sequence[str] | Mapping[str, str], name='key', require_ordered_dict=False) OrderedDict[str, str] ¶
Parse a key or a sequence of keys.
- Parameters:
- Returns:
A mapping of input keys to output keys.
- Return type:
- Raises:
TypeError – If the key is not a string, a sequence of strings or a mapping of strings. If the key is a mapping but require_ordered_dict is True and the mapping is not an OrderedDict.
- split(data, shortest_length, split_fraction, start_index)¶
Split the data into sets.
The largest set will be extracted from the front and back of the data (this should also be the first set that this method encounters, see
sort_split_names_fractions()
) The other sets will be extracted from the middle of the data, sequentially.- Parameters:
- Returns:
The split data and the index to start splitting the next data from.
- Return type:
Tuple[np.ndarray, int]