(a, w, a_subseq_isconstant=None)
| 16 | |
| 17 | |
| 18 | def rolling_isconstant(a, w, a_subseq_isconstant=None): |
| 19 | # a_subseq_isconstant can be numpy.ndarray or function |
| 20 | if a_subseq_isconstant is None: |
| 21 | a_subseq_isconstant = is_ptp_zero_1d |
| 22 | |
| 23 | custom_func = None |
| 24 | if callable(a_subseq_isconstant): |
| 25 | custom_func = a_subseq_isconstant |
| 26 | |
| 27 | if custom_func is not None: |
| 28 | a_subseq_isconstant = np.logical_and( |
| 29 | core.rolling_isfinite(a, w), |
| 30 | np.apply_along_axis( |
| 31 | lambda a_row, w: custom_func(a_row, w), axis=-1, arr=a, w=w |
| 32 | ), |
| 33 | ) |
| 34 | |
| 35 | return a_subseq_isconstant |
| 36 | |
| 37 | |
| 38 | def rolling_nanstd(a, w): |
no outgoing calls
no test coverage detected