@@ -100,8 +100,8 @@ def test_kosmos_trace():
100
100
tg = KosmosTrace (img , peak_method = 'gaussian' )
101
101
tc = KosmosTrace (img , peak_method = 'centroid' )
102
102
tm = KosmosTrace (img , peak_method = 'max' )
103
- # traces should all be close to 100 (note this passes with the current set values, but if
104
- # changing the seed, noise, etc, then this test might need to be updated )
103
+ # traces should all be close to 100
104
+ # (values may need to be updated on changes to seed, noise, etc. )
105
105
assert np .max (abs (tg .trace - 100 )) < sigma_pix
106
106
assert np .max (abs (tc .trace - 100 )) < 3 * sigma_pix
107
107
assert np .max (abs (tm .trace - 100 )) < 6 * sigma_pix
@@ -116,6 +116,14 @@ def test_kosmos_trace():
116
116
img_win_nans = img .copy ()
117
117
img_win_nans [guess - window :guess + window ] = np .nan
118
118
119
+ # ensure a low bin number is rejected
120
+ with pytest .raises (ValueError , match = 'bins must be >= 4' ):
121
+ KosmosTrace (img , bins = 3 )
122
+
123
+ # ensure number of bins greater than number of dispersion pixels is rejected
124
+ with pytest .raises (ValueError , match = r'bins must be <*' ):
125
+ KosmosTrace (img , bins = ncols )
126
+
119
127
# error on trace of otherwise valid image with all-nan window around guess
120
128
try :
121
129
KosmosTrace (img_win_nans , guess = guess , window = window )
0 commit comments