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

DOC: Where can I find the documentation about making a .h5 file from a text file to run into PyXRF? #306

Open
laraja03 opened this issue May 22, 2023 · 3 comments

Comments

@laraja03
Copy link

laraja03 commented May 22, 2023

I have been looking for a long time how to correctly pass data that I have in text format to a .h5 file format. The end goal is to be able to read the .h5 file with PyXRF and get a spectrum.

Expected Behavior

When I run the next code:
xrfh5_page-0001

I get a .h5 file. When I try to read from PyXRF I would expect to see a spectrum.

Current Behavior

However, when reading the file I get a banner that says the following:
xrfmapproblem

Possible Solution

The first thing I did was read an .h5 file that does run with PyXRF. I managed to see the following:
xrfmap_page-0001

But when running the same code but with the .h5 file that I created, the following results:
NOxrfmap

I don't know what to do but I think the problem is in the way I pass the text file to .h5

Thanks!

@dmgav
Copy link
Collaborator

dmgav commented May 23, 2023

@laraja03 There should be no problem to write a script that creates a working .h5 file using existing data. May I first ask what kind of data you have in the text file. In the raw data for PyXRF, each pixel of the map is represented by 4096 point spectrum. Typically the energies for spectum points are in the range 0..40.95 keV, 0.01 keV step, but it could be a different range and different step. Spectra with less pixels (e.g. 2048) should be extended to 4096 points. If you need to fit a single spectrum, it is possible to create a file with a single-pixel map. Please let me know some technical details on what you are trying to do.

@laraja03
Copy link
Author

Hi @dmgav, thanks for your response.
I have results from a XRF analysis, in which the energy goes from 0.2 to 40 keV. I understand that there are 2048 channels and the steps are 0.02 keV. I leave you below a picture of a read of a csv file so you can see the data.

read csv

The first column is the energy and the others are different samples. The intensity (counts*1000) of the peaks go from 0 to 25.

@kyle-hunady
Copy link

Hi @dmgav ! I wanted to bump this issue because I had the same question -
How could we convert a text file into a single-pixel map for h5?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants