-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from fact-project/neighbors
Add function to return pixel neighborhood matrix
- Loading branch information
Showing
4 changed files
with
73 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.20.1 | ||
0.21.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import numpy as np | ||
|
||
|
||
def test_neighbors(): | ||
from fact.instrument.camera import get_neighbor_matrix | ||
|
||
neighbors = get_neighbor_matrix() | ||
|
||
assert neighbors[1144, 259] | ||
assert neighbors[1144, 1143] | ||
assert neighbors[1144, 1146] | ||
assert neighbors[1144, 1147] | ||
assert neighbors[1144, 287] | ||
assert neighbors[1144, 284] | ||
assert not neighbors[1144, 256] | ||
assert not neighbors[1144, 281] | ||
|
||
assert np.all(neighbors.diagonal() == 0) | ||
|
||
|
||
def test_n_neighbors(): | ||
from fact.instrument.camera import get_num_neighbors | ||
|
||
n_neighbors = get_num_neighbors() | ||
|
||
assert n_neighbors[54] == 3 | ||
assert n_neighbors[86] == 3 | ||
assert n_neighbors[81] == 4 |