From 47396e8afe288e8c8ce9d40e36209f7a3a8d2d31 Mon Sep 17 00:00:00 2001 From: "Gregory J. Ward" Date: Wed, 8 May 2024 18:43:12 +0000 Subject: [PATCH] fix: Added check for black input values to avoid divid-by-zero --- src/cal/cal/sky2spectra.cal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cal/cal/sky2spectra.cal b/src/cal/cal/sky2spectra.cal index 9354e4d3..3a5b1641 100644 --- a/src/cal/cal/sky2spectra.cal +++ b/src/cal/cal/sky2spectra.cal @@ -1,4 +1,4 @@ -{ RCSid $Id: sky2spectra.cal,v 1.3 2024/03/01 00:21:54 greg Exp $ } +{ RCSid $Id: sky2spectra.cal,v 1.4 2024/05/08 18:43:12 greg Exp $ } { Convert RGB sky to spectral sky using, for example: @@ -32,4 +32,4 @@ in_M2 = M2(in_x,in_y); co_Multiplier = in_Y / (S0normf + in_M1*S1normf + in_M2*S2normf) / 179; -co(n) = co_Multiplier * select(n, 1, in_M1, in_M2); +co(n) = if(in_Y - 1e-4, co_Multiplier*select(n, 1, in_M1, in_M2), 0);