From 1e5012b8b6071880275e49c94bad10981b62145d Mon Sep 17 00:00:00 2001 From: Bennet Meyers Date: Fri, 13 Mar 2026 11:13:16 -0700 Subject: [PATCH 1/2] wrap in try-except block --- pvsystemprofiler/algorithms/performance_model_estimation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pvsystemprofiler/algorithms/performance_model_estimation.py b/pvsystemprofiler/algorithms/performance_model_estimation.py index f1fbf6a5..cd9b8f11 100644 --- a/pvsystemprofiler/algorithms/performance_model_estimation.py +++ b/pvsystemprofiler/algorithms/performance_model_estimation.py @@ -35,7 +35,10 @@ def find_fit_costheta(data_matrix, clear_index, doy): constraints.append(cvx.diff(x2, k=1) == z) phi3 = 1e3 * cvx.sum_squares(cvx.diff(x3, k=2)) + 1e-6 * cvx.norm1(x3) for val in set(solstice_centered_index(doy)): - constraints.append(cvx.diff(x3[solstice_centered_index(doy) == val]) == 0) + try: + constraints.append(cvx.diff(x3[solstice_centered_index(doy) == val]) == 0) + except ValueError: + pass constraints.append(x3 <= 0) phi4 = 1e3 * cvx.sum_squares(cvx.diff(x4, k=2)) + 1e-3 * cvx.sum_squares(x4) constraints.append(x4[:-365] == x4[365:]) From 271fd25f3374bd5e6d5fe73135c9b66c085e8134 Mon Sep 17 00:00:00 2001 From: Bennet Meyers Date: Fri, 13 Mar 2026 11:32:46 -0700 Subject: [PATCH 2/2] updating default solver --- pvsystemprofiler/algorithms/performance_model_estimation.py | 4 ++-- solardatatools/data_handler.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pvsystemprofiler/algorithms/performance_model_estimation.py b/pvsystemprofiler/algorithms/performance_model_estimation.py index cd9b8f11..0ff3dc39 100644 --- a/pvsystemprofiler/algorithms/performance_model_estimation.py +++ b/pvsystemprofiler/algorithms/performance_model_estimation.py @@ -6,7 +6,7 @@ """ -def find_fit_costheta(data_matrix, clear_index, doy): +def find_fit_costheta(data_matrix, clear_index, doy, solver="CLARABEL"): """ Fits a 'cos(theta)' curve to the given power, which is assumed to be smooth, yearly periodic, and symmetric around the summer solstice. Previous versions of this function did not enforce the symmetric constraint. @@ -46,7 +46,7 @@ def find_fit_costheta(data_matrix, clear_index, doy): objective = phi1 + phi2 + phi3 + phi4 problem = cvx.Problem(cvx.Minimize(objective), constraints) - problem.solve(solver="OSQP") + problem.solve(solver=solver) normalized_data = data_matrix / np.exp(x2.value + x4.value) costheta_est = x3.value return normalized_data, costheta_est diff --git a/solardatatools/data_handler.py b/solardatatools/data_handler.py index 8f767d4b..a419f58e 100644 --- a/solardatatools/data_handler.py +++ b/solardatatools/data_handler.py @@ -1247,7 +1247,7 @@ def score_data_set(self): self.data_clearness_score = None return - def clipping_check(self, solver="OSQP"): + def clipping_check(self, solver="CLARABEL"): if self.clipping_analysis is None: self.clipping_analysis = ClippingDetection() self.clipping_analysis.check_clipping(