From 4eac85852f4b6e174507394e40d5dddc99851ecc Mon Sep 17 00:00:00 2001 From: dehann Date: Mon, 16 Mar 2026 11:48:56 -0700 Subject: [PATCH] detector response bug fix 2, mnlocs --- Project.toml | 2 ++ src/CameraModels.jl | 1 + src/services/RadianceCorrection.jl | 6 +++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 7573296..4aa623c 100644 --- a/Project.toml +++ b/Project.toml @@ -12,6 +12,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc" +SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" @@ -23,6 +24,7 @@ LoopVectorization = "0.12.173" LieGroups = "0.1" RecursiveArrayTools = "3.27.0" Rotations = "1" +SparseArrays = "1" StaticArrays = "1" StatsBase = "0.34" julia = "1.10" diff --git a/src/CameraModels.jl b/src/CameraModels.jl index 80289a8..225a7fb 100644 --- a/src/CameraModels.jl +++ b/src/CameraModels.jl @@ -3,6 +3,7 @@ module CameraModels using LinearAlgebra using LieGroups using DocStringExtensions +using SparseArrays using StaticArrays using FixedPointNumbers using StatsBase diff --git a/src/services/RadianceCorrection.jl b/src/services/RadianceCorrection.jl index a3a9304..79e2ed4 100644 --- a/src/services/RadianceCorrection.jl +++ b/src/services/RadianceCorrection.jl @@ -166,7 +166,7 @@ function solveDetectorResponse( # logExposure] zeros(n)] # neqs = sum(mnlocs.*mnimgs) + 1 + n - A = zeros(neqs,n+nlocs) + A = spzeros(neqs,n+nlocs) b = zeros(neqs) # Fill in the equations from pixel value observations in A and b, @@ -184,7 +184,7 @@ function solveDetectorResponse( # A2 columns correspond to logExposure of observed pixels from list of locations i pixz1 = Z[j][i] + 1 miloc = offset+n+i - a_12 = view(A, k, [pixz1, miloc]) + a_12 = view(A, k, SA[pixz1, miloc]) a_12 .= window[pixz1] .* SA[1, -1] b[k] = window[pixz1] * logΔTs[j] k += 1 @@ -211,7 +211,7 @@ function solveDetectorResponse( x = A\b # Extract gcurve and log exposure values from solution vector - gcurve = x[1:n] + gcurve = collect(x[1:n]) logExposure = x[(n+1):end] return gcurve, logExposure end