@@ -818,23 +818,23 @@ def detect_clearsky(measured, clearsky, times=None, infer_limits=False,
818818 sample_interval , samples_per_window = \
819819 tools ._get_sample_intervals (times , window_length )
820820
821- if samples_per_window < 3 :
822- raise ValueError (f"Samples per window of { samples_per_window } "
823- " found. Each window must contain at least 3 data"
824- " points."
825- f" Window length of { window_length } found; increase"
826- f" window length to { 3 * sample_interval } or longer." )
827-
828821 # if infer_limits, find threshold values using the sample interval
829822 if infer_limits :
830823 window_length , mean_diff , max_diff , lower_line_length , \
831824 upper_line_length , var_diff , slope_dev = \
832825 _clearsky_get_threshold (sample_interval )
833826
834827 # recalculate samples_per_window using returned window_length
835- _ , samples_per_window = \
828+ sample_interval , samples_per_window = \
836829 tools ._get_sample_intervals (times , window_length )
837830
831+ if samples_per_window < 3 :
832+ raise ValueError (f"Samples per window of { samples_per_window } "
833+ " found. Each window must contain at least 3 data"
834+ " points."
835+ f" Window length of { window_length } found; increase"
836+ f" window length to { 3 * sample_interval } or longer." )
837+
838838 # check that we have enough data to produce a nonempty hankel matrix
839839 if len (times ) < samples_per_window :
840840 raise ValueError (f"times has only { len (times )} entries, but it must \
0 commit comments