@@ -160,14 +160,16 @@ end
160
160
161
161
# Helper function to construct HGD
162
162
function HeatmapGridDensity (
163
- data:: AbstractMatrix{<:Real} ,
163
+ # NAME SUGGESTION: SAMPLEABLE_FIELD, GenericField
164
+ field_on_grid:: AbstractMatrix{<:Real} ,
164
165
domain:: Tuple{<:AbstractVector{<:Real}, <:AbstractVector{<:Real}} ,
166
+ # encapsulate above
165
167
hint_callback:: Union{<:Function, Nothing} = nothing ,
166
168
bw_factor:: Real = 0.7 ; # kde spread between domain points
167
169
N:: Int = 10000 ,
168
170
)
169
171
#
170
- pos, weights_ = sampleHeatmap (data , domain... , 0 )
172
+ pos, weights_ = sampleHeatmap (field_on_grid , domain... , 0 )
171
173
# recast to the appropriate shape
172
174
@cast support_[i, j] := pos[j][i]
173
175
@@ -178,9 +180,9 @@ function HeatmapGridDensity(
178
180
179
181
@cast vec_preIS[j][i] := pts_preIS[i, j]
180
182
181
- # weight the intermediate samples according to interpolation of raw data
183
+ # weight the intermediate samples according to interpolation of raw field_on_grid
182
184
# interpolated heatmap
183
- hm = Interpolations. linear_interpolation (domain, data ) # depr .LinearInterpolation(..)
185
+ hm = Interpolations. linear_interpolation (domain, field_on_grid ) # depr .LinearInterpolation(..)
184
186
d_scalar = Vector {Float64} (undef, length (vec_preIS))
185
187
186
188
# interpolate d_scalar for intermediate test points
@@ -204,7 +206,7 @@ function HeatmapGridDensity(
204
206
density = ManifoldKernelDensity (TranslationGroup (Ndim (bel)), bel)
205
207
206
208
# return `<:SamplableBelief` object
207
- return HeatmapGridDensity (data , domain, hint_callback, bw_factor, density)
209
+ return HeatmapGridDensity (field_on_grid , domain, hint_callback, bw_factor, density)
208
210
end
209
211
210
212
function Base. isapprox (
225
227
226
228
# legacy construct helper
227
229
function LevelSetGridNormal (
228
- data :: AbstractMatrix{<:Real} ,
230
+ field_on_grid :: AbstractMatrix{<:Real} ,
229
231
domain:: Tuple{<:AbstractVector{<:Real}, <:AbstractVector{<:Real}} ,
230
232
level:: Real ,
231
233
sigma:: Real ;
@@ -235,8 +237,18 @@ function LevelSetGridNormal(
235
237
N:: Int = 10000 ,
236
238
)
237
239
#
238
- hgd = HeatmapGridDensity (data , domain, hint_callback, bw_factor; N = N)
239
- return LevelSetGridNormal (level, sigma, float (sigma_scale), hgd )
240
+ field = HeatmapGridDensity (field_on_grid , domain, hint_callback, bw_factor; N = N)
241
+ return LevelSetGridNormal (level, sigma, float (sigma_scale), field )
240
242
end
241
243
244
+ # Field: domain (R^2/3), image (R^1/n scalar or tensor) e.g.: x,y -> elevation ;; x, y, z, t -> EM-field (R^(4x4))
245
+ # Field( grid_x, grid_y,.... field_grid )
246
+ # Field^ = interpolator(field_at_grid, grid)
247
+ #
248
+ # FieldGrid(data_on_grid, grid_domain) # internally does interpolation vodoo (same as Field^)
249
+ # BeliefGrid <: FieldGrid
250
+ # BeliefGrid(field_data: FieldGrid, measurement: Normal(mean: image_domain, cov: image_domain^2) ) -> domain, R_0+
251
+ #
252
+ # calcApproxLoss(ref::BeliefGrid, appr::ManifoldKernelDensity)::Field{Real}
253
+ # ref = Normal(ScalarField - measurement, cov)
242
254
#
0 commit comments