(
T,
m,
percentage=1.0,
s=None,
mpdist_percentage=0.05,
mpdist_k=None,
p=2.0,
)
| 1665 | |
| 1666 | |
| 1667 | def get_all_aampdist_profiles( |
| 1668 | T, |
| 1669 | m, |
| 1670 | percentage=1.0, |
| 1671 | s=None, |
| 1672 | mpdist_percentage=0.05, |
| 1673 | mpdist_k=None, |
| 1674 | p=2.0, |
| 1675 | ): |
| 1676 | right_pad = 0 |
| 1677 | if T.shape[0] % m != 0: |
| 1678 | right_pad = int(m * np.ceil(T.shape[0] / m) - T.shape[0]) |
| 1679 | pad_width = (0, right_pad) |
| 1680 | T = np.pad(T, pad_width, mode="constant", constant_values=np.nan) |
| 1681 | |
| 1682 | n_padded = T.shape[0] |
| 1683 | D = np.empty(((n_padded // m) - 1, n_padded - m + 1)) |
| 1684 | |
| 1685 | if s is not None: |
| 1686 | s = min(int(s), m) |
| 1687 | else: |
| 1688 | percentage = min(percentage, 1.0) |
| 1689 | percentage = max(percentage, 0.0) |
| 1690 | s = min(math.ceil(percentage * m), m) |
| 1691 | |
| 1692 | # Iterate over non-overlapping subsequences, see Definition 3 |
| 1693 | for i in range((n_padded // m) - 1): |
| 1694 | start = i * m |
| 1695 | stop = (i + 1) * m |
| 1696 | S_i = T[start:stop] |
| 1697 | D[i, :] = aampdist_vect( |
| 1698 | S_i, |
| 1699 | T, |
| 1700 | s, |
| 1701 | percentage=mpdist_percentage, |
| 1702 | k=mpdist_k, |
| 1703 | p=p, |
| 1704 | ) |
| 1705 | |
| 1706 | stop_idx = n_padded - m + 1 - right_pad |
| 1707 | D = D[:, :stop_idx] |
| 1708 | |
| 1709 | return D |
| 1710 | |
| 1711 | |
| 1712 | def aampdist_snippets( |
no test coverage detected