@@ -581,6 +581,9 @@ def _solve_candidate_ransac(
581581 weight = 1.0
582582
583583 cost = sum (err ) / (len (err ) - len (fit_coeffs ) + 1 ) / (weight + 1e-9 )
584+ self .logger .info (
585+ f"Cost: { cost :1.4f} , Weight: { weight :1.4f} , fit_coeffs: { fit_coeffs } "
586+ )
584587
585588 # If this is potentially a new best fit, then handle that first
586589 if cost <= best_cost :
@@ -604,6 +607,8 @@ def _solve_candidate_ransac(
604607 self .logger .warning ("Linear algebra error in robust fit" )
605608 continue
606609
610+ self .logger .info (f"Robust fit_coeffs: { fit_coeffs } " )
611+
607612 # Get the residual of the fit
608613 residual = self .polyval (matched_peaks , fit_coeffs ) - matched_atlas
609614 residual [np .abs (residual ) > self .ransac_tolerance ] = self .ransac_tolerance
@@ -621,7 +626,9 @@ def _solve_candidate_ransac(
621626
622627 if n_inliers < self .minimum_matches :
623628 self .logger .debug (
624- "Not enough matched peaks for valid solution, user specified {}." .format (self .minimum_matches )
629+ "Not enough matched peaks for valid solution, user specified {}." .format (
630+ self .minimum_matches
631+ )
625632 )
626633 continue
627634
@@ -648,7 +655,9 @@ def _solve_candidate_ransac(
648655 assert len (np .unique (self .matched_atlas )) == len (np .unique (self .matched_peaks ))
649656
650657 if progress :
651- sampler_list .set_description ("Most inliers: {:d}, best error: {:1.4f}" .format (best_inliers , best_err ))
658+ sampler_list .set_description (
659+ "Most inliers: {:d}, best error: {:1.4f}" .format (best_inliers , best_err )
660+ )
652661
653662 # Break early if all peaks are matched
654663 if best_inliers == len (peaks ):
@@ -1419,7 +1428,9 @@ def set_known_pairs(self, pix=(), wave=()):
14191428 wave = np .asarray (wave , dtype = "float" ).reshape (- 1 )
14201429
14211430 assert pix .size == wave .size , ValueError (
1422- "Please check the length of the input arrays. pix has size {} and wave has size {}." .format (pix .size , wave .size )
1431+ "Please check the length of the input arrays. pix has size {} and wave has size {}." .format (
1432+ pix .size , wave .size
1433+ )
14231434 )
14241435
14251436 if not all (isinstance (p , (float , int )) & (not np .isnan (p )) for p in pix ):
@@ -1574,7 +1585,9 @@ def fit(
15741585 if rms > self .fit_tolerance :
15751586 self .logger .warning ("RMS too large {} > {}" .format (rms , self .fit_tolerance ))
15761587
1577- assert fit_coeff is not None , f"Couldn't fit with { len (self .pairs )} pair(s) / { len (self .peaks )} peaks / { len (self .atlas )} lines."
1588+ assert (
1589+ fit_coeff is not None
1590+ ), f"Couldn't fit with { len (self .pairs )} pair(s) / { len (self .peaks )} peaks / { len (self .atlas )} lines."
15781591
15791592 self .fit_coeff = fit_coeff
15801593 self .rms = rms
0 commit comments