@@ -347,7 +347,7 @@ def sigma_r(
347
347
return sig_r
348
348
349
349
350
- def s_bar (target_specs : dict [float , int ], arw_rad : float , sig_r : float ) :
350
+ def s_bar (target_specs : dict [float , int ], arw_rad : float , sig_r : FloatArray ) -> FloatArray :
351
351
"""Calculate expected score directly from target ring sizes.
352
352
353
353
Parameters
@@ -371,15 +371,21 @@ def s_bar(target_specs: dict[float, int], arw_rad: float, sig_r: float):
371
371
dividing by overall diameter
372
372
Eg 0.12 / 2 != 3*0.4 / 20
373
373
374
+ Assumes that:
375
+ - target rings are concentric
376
+ - score decreases monotonically as ring sizes increase
377
+
374
378
Examples
375
379
--------
376
380
>>> #WA 18m compound triple spot
377
381
>>> specs = {0.02: 10, 0.08: 9, 0.12: 8, 0.16: 7, 0.2: 6}
378
382
>>> _sbar(specs, 9.3e-3, 0.04)
379
383
8.928787288284521 # differs from previous implementation by 1.7763568394002505e-15
380
384
"""
381
- ring_sizes = sorted (target_specs , key = target_specs .get , reverse = True )
382
- ring_scores = sorted (itr .chain (target_specs .values (), [0 ]), reverse = True )
385
+ target_specs = dict (sorted (target_specs .items ()))
386
+ ring_sizes = target_specs .keys ()
387
+ ring_scores = list (itr .chain (target_specs .values (), [0 ]))
388
+
383
389
score_drops = (inner - outer for inner , outer in itr .pairwise (ring_scores ))
384
390
max_score = max (ring_scores )
385
391
0 commit comments