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

SCIInstitute / UncertainSCI / 4659511182

pending completion
4659511182

Pull #108

github

GitHub
Merge 3320693ee into 52de2ab68
Pull Request #108: Sphinx build

1589 of 3151 relevant lines covered (50.43%)

4.46 hits per line

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

0.0
/UncertainSCI/utils/array_unique.py
1
import numpy as np
×
2

3

4
def array_unique(a, tol=1e-8):
×
5
    """
6
    Given an 1d numpy array, selects eps-close unique elements and delete, then
7
    sort.
8
    """
9
    a_sort = np.sort(a)
×
10
    seq_diff = a_sort[1:] - a_sort[:-1]
×
11
    ind = np.where(seq_diff < tol)
×
12
    return np.delete(a_sort, ind)
×
13

14

15
if __name__ == '__main__':
×
16
    x = np.array([1, 2, 1-1e-12, 2-1e-4])
×
17
    y = array_unique(x)
×
18
    print(x, y)
×
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

© 2025 Coveralls, Inc