12-17-2025 12:25 PM
dsb@NI wrote:
I recommend path 3 because it requires one less assumption (wavelength spacing to get required accuracy).
Can you explain the term "required accuracy", because I did not see any such requirements.
Chances are that integration of a relatively slowly changing signal with over 1000 points is only very weakly dependent on the actual integration method, especially since the signal is noisy to begin with.
12-18-2025 12:08 PM - edited 12-18-2025 12:13 PM
@altenbach wrote:
dsb@NI wrote:
I recommend path 3 because it requires one less assumption (wavelength spacing to get required accuracy).
Can you explain the term "required accuracy", because I did not see any such requirements.
OP did not share any accuracy requirements. Ironically enough, I was assuming that there was an accuracy requirement even if it was loosely defined as accurate enough. I think we have all been working towards a simple integration method that doesn't introduce error.
@altenbach wrote:Chances are that integration of a relatively slowly changing signal with over 1000 points is only very weakly dependent on the actual integration method, especially since the signal is noisy to begin with.
OP's signal does have sharp edges (rapid/instantaneous changes). When we resample to a linear x spacing, the spacing determines how accurately the resampled signal/spectrum captures those rapid changes. I have consistently favored the uneven integration because the input spectrum is uneven in x. The uneven integration captures the rapid changes without introducing resampling error.
Good observation about the noise. LED47 hasn't noted noise as an issue. However, since it seems as though the integration is aggregating power, I am dubious of any part of the corrected (noisy) spectrum that is negative (and, therefore, subtracts from the integrated result). @LED47 can figure out how to handle sharp transitions, noise in the spectrum, and negative spectrum values.
12-18-2025 12:44 PM
Yes, the current interpolation takes a tiny bite out of the trailing sharp edge. The OP needs to decide if this is significant.
12-18-2025 12:54 PM - edited 12-18-2025 01:05 PM
Also, the ratio of the two integrals is 1.00036, minute compared to all other errors.
I still strongly prefer to use the built-in uneven integration, even for the running integral. Anything handmade is less tested.
You can look inside the uneven integration and it pretty nice code. 😄
12-18-2025 02:00 PM
@altenbach wrote:
...
I still strongly prefer to use the built-in uneven integration, even for the running integral. Anything handmade is less tested.
Well said!