xraypy / xraylarch

Larch: Applications and Python Library for Data Analysis of X-ray Absorption Spectroscopy (XAS, XANES, XAFS, EXAFS), X-ray Fluorescence (XRF) Spectroscopy and Imaging, and more.
https://xraypy.github.io/xraylarch
Other
127 stars 62 forks source link

[larix] bug in plotting selected groups with mixed normalization methods #511

Open maurov opened 2 months ago

maurov commented 2 months ago

@newville a colleague found a bug in Larix when plotting selected groups which have different types of normalization (e.g. polynomial and mback). The bug comes from (and following):

https://github.com/xraypy/xraylarch/blob/ae6ed7961ecf84a16bd5611fb9c5cc1cc5cecde6/larch/wxxas/xasnorm_panel.py#L587

If fact, the current behavior in Larix when plotting normalized selected groups depends on the current clicked group, that may be a group out of the selected ones. In my opinion, this is a bug.

My expected behavior would be that a normalization function, whatever method is used (standard, mback, area, whatever) should write the norm array of the group, while the plotting function should only plot this attribute, without repeating the normalization itself or using different array names. What do you think?

newville commented 2 months ago

@maurov I agree: this is sort of messy. It is nice to have multiple normalization options, so maybe have norm_poly and norm_mback available for comparison. But norm should be the selected one choice. I'll check this out.