• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

avivajpeyi / pywavelet / 12922237403

23 Jan 2025 04:24AM UTC coverage: 73.077% (-6.2%) from 79.264%
12922237403

push

github

avivajpeyi
feat: add jax as optional backend

140 of 231 branches covered (60.61%)

Branch coverage included in aggregate %.

49 of 140 new or added lines in 15 files covered. (35.0%)

21 existing lines in 3 files now uncovered.

753 of 991 relevant lines covered (75.98%)

0.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

57.69
/src/pywavelet/types/common.py
1
from typing import Tuple, Union, Callable
1✔
2
from ..logger import logger
3
from ..backend import xp
1✔
4

1✔
5

6
def _len_check(d):
7
    if not xp.log2(len(d)).is_integer():
1✔
8
        logger.warning(f"Data length {len(d)} is suggested to be a power of 2")
×
UNCOV
9

×
10

11
def is_documented_by(original:Callable):
12
    def wrapper(target):
1✔
13
        target.__doc__ = original.__doc__
1✔
14
        return target
1✔
15

1✔
16
    return wrapper
17

1✔
18

19
def fmt_time(seconds: float, units=False) -> Union[str, Tuple[str, str]]:
20
    """Returns formatted time and units [ms, s, min, hr, day]"""
1✔
21
    t, u = "", ""
22
    if seconds < 1e-3:
1✔
23
        t, u = f"{seconds * 1e6:.2f}", "µs"
1✔
24
    elif seconds < 1:
1✔
25
        t, u = f"{seconds * 1e3:.2f}", "ms"
1!
UNCOV
26
    elif seconds < 60:
×
27
        t, u = f"{seconds:.2f}", "s"
1!
28
    elif seconds < 60 * 60:
1✔
29
        t, u = f"{seconds / 60:.2f}", "min"
×
30
    elif seconds < 60 * 60 * 24:
×
31
        t, u = f"{seconds / 3600:.2f}", "hr"
×
UNCOV
32
    else:
×
33
        t, u = f"{seconds / 86400:.2f}", "day"
UNCOV
34

×
35
    if units:
36
        return t, u
1✔
37
    return t
1✔
38

1✔
39

40
def fmt_timerange(trange):
41
    t0 = fmt_time(trange[0])
1✔
42
    tend, units = fmt_time(trange[1], units=True)
1✔
43
    return f"[{t0}, {tend}] {units}"
1✔
44

1✔
45

46
def fmt_pow2(n: float) -> str:
47
    pow2 = xp.log2(n)
1✔
48
    if pow2.is_integer():
×
49
        return f"2^{int(pow2)}"
×
50
    return f"{n:,}"
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc