IdentityFilter#
- class myoverse.datasets.filters.generic.IdentityFilter(input_is_chunked, is_output=False, name=None, run_checks=True)[source]#
Filter that returns the input unchanged.
This is useful as a placeholder in filter sequences or for testing.
- Parameters:
input_is_chunked (bool) – Whether the input is chunked or not. This must be explicitly set by the user as they have the best knowledge of their data structure.
is_output (bool, optional) – Whether this is an output filter, by default False
name (str, optional) – Name of the filter, by default None
run_checks (bool) –
Whether to run the checks when filtering. By default, True. If False can potentially speed up performance.
Warning
If False, the user is responsible for ensuring that the input array is valid.
Examples
>>> import numpy as np >>> from myoverse.datasets.filters.generic import IdentityFilter >>> # Create data >>> data = np.random.rand(10, 500) >>> # Apply identity filter >>> identity_filter = IdentityFilter(input_is_chunked=False) >>> output = identity_filter(data) >>> # Check that output is the same as input >>> np.array_equal(data, output) # True
Notes
This filter simply returns the input array unchanged.
See also
ApplyFunctionFilter
A more general filter for applying arbitrary functions
Methods
__init__
(input_is_chunked[, is_output, ...])_filter
(input_array, **kwargs)Return the input array unchanged.
_run_filter_checks
(input_array)Run checks on the input array.