geowatch.tasks.fusion.datamodules.temporal_sampling.time_kernel module¶
Defines TimeKernel
.
Note
Kernel may not be the best name for this, which is a highly overloaded term. The name was chosen based on the use of a statistical kernels or convolutional kernels used in image processing [WikiKernelImageProcessing]. It has nothing to do with kernel methods in optimization or null space in linear algebra.
It is really an ideal time distribution that will be used as a template.
References
- class geowatch.tasks.fusion.datamodules.temporal_sampling.time_kernel.TimeKernel(*args, **kwargs)[source]¶
Bases:
ndarray
Represents an ideal relative time sampling pattern.
This is just an ndarray with offsets specified in seconds.
Notes
CommandLine
xdoctest -m geowatch.tasks.fusion.datamodules.temporal_sampling.time_kernel TimeKernel --show
Example
>>> from geowatch.tasks.fusion.datamodules.temporal_sampling.time_kernel import TimeKernel >>> from geowatch.tasks.fusion.datamodules.temporal_sampling.time_kernel import _random_discrete_relative_times >>> self = TimeKernel.coerce('-1y,-3m,0,3m,1y') >>> print(f'self={self!r}') >>> # xdoctest: +REQUIRES(--show) >>> import kwplot >>> kwplot.autosns() >>> # Pretend we have discrete observations with the following relative >>> # time differences >>> import kwutil >>> time_range = kwutil.timedelta.coerce('4y') >>> relative_unixtimes = _random_discrete_relative_times(time_range) >>> self.plot(relative_unixtimes) >>> kwplot.show_if_requested()
- classmethod coerce_multiple(data)[source]¶
Example
>>> from geowatch.tasks.fusion.datamodules.temporal_sampling.time_kernel import TimeKernel >>> import ubelt as ub >>> pattern = ('-3y', '-2.5y', '-2y', '-1.5y', '-1y', 0, '1y', '1.5y', '2y', '2.5y', '3y') >>> multi_kernel = TimeKernel.coerce_multiple(pattern) >>> print('multi_kernel = {}'.format(ub.urepr(multi_kernel, nl=2)))