seg1d.processing.Features.match_len¶
-
static
Features.
match_len
(dataset)[source]¶ interpolate to the maximum sized data in the reference set
Parameters: - datasetList[Dict{feature:val}]
list of multiple datasets containing dictionary of 1d features that will be matched to same length
Returns: - interp_dList[Dict{feature:val}]
feature length-matched data
Notes
Requires all features within each dataset to be of same length
Examples
>>> import numpy as np >>> import seg1d.processing as process >>> s20 = np.linspace(-np.pi*2, np.pi*2, 20) >>> s30 = np.linspace(-np.pi*2, np.pi*2, 30) >>> s40 = np.linspace(-np.pi*2, np.pi*2, 40) >>> s_longest = np.sin(s40) >>> a1 = {'s':np.sin(s20), 'c':np.cos(s20)} >>> a2 = {'s':np.sin(s30), 'c':np.cos(s30)} >>> a3 = {'s':s_longest, 'c':np.cos(s40)} >>> d = [a1, a2, a3] >>> r = process.Features.match_len(d) >>> print(len(r[0]['s']) == len(s_longest)) True