aphalo / photobiology

Package ‘photobiology’ defines a system of classes for storing spectral data and accompanying methods and operators. This is the core of a suite of R packages for photobiological calculations.
4 stars 1 forks source link

normalize options #27

Closed CdeMills closed 3 months ago

CdeMills commented 9 months ago

Hello

the paper with DOI contains a review of several methods to express the distance between two spectra.

Its most significant contribution is IMHO to normalize an energy spectrum by its integral over the whole domain, making it a pdf. That way gives access to many methods from statistics and econometry to compare two pdfs. One of the main promising one is the Kullback–Leibler divergence, which compare some test pdf to a reference pdf.

That divergence can be turned into a distance as

KL_distance = 0.5 * (KL(P, Q) + KL(Q, P))

where KL is the divergence computation which is available from a few R packages.

Could you please add a "pdf" option to the normalize operator ? That operation should be applied 'as is" for energy spectra, and by weighting by the wavelength for photon spectra.

Regards

Pascal

aphalo commented 9 months ago

@CdeMills As some people use normalization only in the case of when the value at a given wavelength is used as a reference, the operation you would like to do is implemented in function fscale(). If you use e_irrad as argument for parameter f it will give the output you need, as the default is to apply the function to the whole domain and set the "summary" to 1: range = NULL and target = 1.

aphalo commented 9 months ago

@CdeMills Could you please provide the DOI for the paper? It sounds like something I should read! Thanks!

In package 'photobiologyInOut' there is a wrapper to a function from package 'colorSpec': spct_SSI() that computes a spectrum similarity index. There are also functions to exchange data between 'photobiology' and 'colorSpec' packages.

CdeMills commented 9 months ago

Hello. The DOI is 10.1016/B978-0-08-102894-0.00020-6

Did a "Copy-and-Paste" -- get lost somewhere.

"Metrological hyperspectral image analysis through spectral differences", Deborah, Hilda et al.; Hyperspectral Remote Sensing, 2020, pp 319 -- 340

Pascal