Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with sum spectra for bruker M4 tonado .BCF file #290

Open
Divyadeep00 opened this issue Jul 3, 2024 · 6 comments
Open

Problem with sum spectra for bruker M4 tonado .BCF file #290

Divyadeep00 opened this issue Jul 3, 2024 · 6 comments
Labels
type: bug Something isn't working

Comments

@Divyadeep00
Copy link

import hyperspy.api as hs

import scipy
# Load your data (replace with actual data loading code)
data = hs.load('MS-1b_S.bcf')
data= data[4]
data.plot()
roi = hs.roi.RectangularROI(left=110, right=125, top=55, bottom=65)

s_roi = roi.interactive(data, recompute_out_event=None, color='C1')
s_roi = roi(data)
roi_sum = hs.interactive(s_roi.sum, recompute_out_event=None)
roi_sum.plot()

I am using above code to view the spectrum at my roi, while doing so, I encounter a flat XRF spectra shown in image
image

both orange and red are nearly (even when they overlap) the default eds signal navigator gives a spectrum but the sum plot is giving a flat signal, is it a but or I am doing something wrong.

@Divyadeep00 Divyadeep00 added the type: bug Something isn't working label Jul 3, 2024
@ericpre
Copy link
Member

ericpre commented Jul 3, 2024

By any chance, do you have any NaN in your data? If so, you should use https://hyperspy.org/hyperspy-doc/dev/reference/api.signals/BaseSignal.html#hyperspy.api.signals.BaseSignal.nansum

@Divyadeep00
Copy link
Author

but if the reason is the NaN value than default view eds viewer should also show flat, but it is showing signals

@ericpre
Copy link
Member

ericpre commented Jul 3, 2024

No, the default pointer doesn't take the sum.

@Divyadeep00
Copy link
Author

but the provided image both have same pixel, size, default pointer is giving values but sum pointer not,
as you can see in the provided image also.

@Divyadeep00
Copy link
Author

image
in this image both pixcel is overlap

@ericpre
Copy link
Member

ericpre commented Jul 4, 2024

Have you tried to use nansum instead of sum as suggested above? e.g. try to adapt your example above to use roi_sum = hs.interactive(s_roi.nansum, recompute_out_event=None).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants