The segmentation map is categorical. Summing the spaxels in each region gives the flux-preserving spectrum used for fitting.
Regional summaries
products <- summarize_cluster_spectra(
seg,
var_cube = variance_cube,
variance_inflation = 1
)
products$cluster_ids
products$n_spaxels
products$sum_spectra
products$sum_varianceFor region (k), channel , and assigned spaxels , Capivara computes
When a variance cube is supplied, the regional variance is the sum of
valid input variances multiplied by variance_inflation.
Capivara does not estimate spatial covariance from the flux cube.
Means and medians describe spectral shape; only the summed spectra preserve the total regional flux.
Representative cubes
representative <- reconstruct_cluster_cube(
seg,
template = "median",
preserve_mask = TRUE,
return_residual = TRUE
)
flux_preserving <- reconstruct_flux_preserving_cube(
seg,
fill_mode = "na",
return_residual = TRUE
)reconstruct_cluster_cube() fills a region with a
representative spectrum. reconstruct_flux_preserving_cube()
distributes each summed regional spectrum over its assigned spaxels so
summing the reconstruction over the region recovers the regional
total.