NSLS-II / PyXRF

Fluorescence fitting GUI.
http://nsls-ii.github.io/PyXRF
BSD 3-Clause "New" or "Revised" License
31 stars 23 forks source link

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

Open laraja03 opened 1 year ago

laraja03 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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.