@@ -96,8 +96,8 @@ def __init__(self, cf, ds, n_eta_bins=360, y0=None):
9696 self .valid_frames_subsets = None
9797 self .valid_eta_bins_subsets = None
9898
99- self ._set_aliases ()
10099 self ._get_y0 (y0 )
100+ self ._set_aliases ()
101101 self ._compute_subsets (n_eta_bins )
102102
103103 if self .is_half_acquisition :
@@ -352,7 +352,7 @@ def sort_by_eta(self):
352352
353353 # skip sorting if already done
354354 if self .columnfile .sortedby == "eta" :
355- logger .info ("[sort_by_sinogram ] peakfile already sorted – %d peaks" ,
355+ logger .info ("[sort_by_eta ] peakfile already sorted – %d peaks" ,
356356 self .columnfile .nrows )
357357 # 1. bin by eta
358358 i_eta = np .clip (
@@ -361,7 +361,7 @@ def sort_by_eta(self):
361361
362362 # 1. bin by eta and sort
363363 else :
364- logger .info ("[sort_by_sinogram ] sorting columnfile in eta order – %d peaks to sort, may take some time... " ,
364+ logger .info ("[sort_by_eta ] sorting columnfile in eta order – %d peaks to sort, may take some time... " ,
365365 self .columnfile .nrows )
366366
367367 i_eta = np .clip (
@@ -464,7 +464,7 @@ def select_pair(self, pair_id, subset_type = 'scans', return_as = 'idx'):
464464 else :
465465 idx1 = pair .ei_hi
466466 idx2 = pair .ei_lo
467-
467+
468468 slc_1 = LUT [idx1 ].slice
469469 slc_2 = LUT [idx2 ].slice
470470
@@ -875,13 +875,15 @@ def match_friedel_pairs_by_chunks(self,
875875 s0 = 0
876876 while not valid_pairs [s0 ]:
877877 s0 += 1
878-
879878 idx1_pilot , idx2_pilot = Psub .select_pair (s0 , chunk_type , return_as = 'idx' )
880879
881880 # find weight factors for optimal rescaling
882- _ , rescaling_wts = self .estimate_search_scales (
883- idx1_pilot , idx2_pilot , 0.5 * dist_max , pair_type = pair_type )
884-
881+ try :
882+ _ , rescaling_wts = self .estimate_search_scales (
883+ idx1_pilot , idx2_pilot , 0.5 * dist_max , pair_type = pair_type )
884+ except RuntimeError :
885+ rescaling_wts = {'gx' : 1. , 'gy' : 1. , 'gz' : 1. , 'eta' : 1. , 'I' : 1. }
886+
885887 # combine user weights with auto-rescaling
886888 _w = {'gx' : 1. , 'gy' : 1. , 'gz' : 1. , 'eta' : 1. , 'I' : 1. }
887889 if self .weights is not None :
@@ -922,7 +924,10 @@ def match_friedel_pairs_by_chunks(self,
922924 continue
923925
924926 if extended_bin_search and chunk_type != 'frames' :
925- idx1 , idx2 = self .PeakSubsets ._extended_pair_selec (pid , chunk_type )
927+ try :
928+ idx1 , idx2 = self .PeakSubsets ._extended_pair_selec (pid , chunk_type )
929+ except KeyError as e : # with extended selection one bounding pair may end up being non-valid pair. in this case, use regular selection instead
930+ idx1 , idx2 = self .PeakSubsets .select_pair (pid , chunk_type , return_as = 'idx' )
926931 else :
927932 idx1 , idx2 = self .PeakSubsets .select_pair (pid , chunk_type , return_as = 'idx' )
928933
0 commit comments