You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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:
Possible Solution
The first thing I did was read an .h5 file that does run with PyXRF. I managed to see the following:
But when running the same code but with the .h5 file that I created, the following results:
I don't know what to do but I think the problem is in the way I pass the text file to .h5
Thanks!
The text was updated successfully, but these errors were encountered:
@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.
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.
The first column is the energy and the others are different samples. The intensity (counts*1000) of the peaks go from 0 to 25.
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](https://private-user-images.githubusercontent.com/134335191/240051850-17641b8b-3ec0-486b-81db-2e23f6137ef4.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNTQyODQsIm5iZiI6MTczOTI1Mzk4NCwicGF0aCI6Ii8xMzQzMzUxOTEvMjQwMDUxODUwLTE3NjQxYjhiLTNlYzAtNDg2Yi04MWRiLTJlMjNmNjEzN2VmNC5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQwNjA2MjRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02YzNjM2NkNTRmYmNjMzVhMDRiOTRjYTZmMGY1Y2IxZGI4MzFjMzRjYjFkYTcyNTYwMDY3Y2ViOTBhYjA2ZDdlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.e91UeqxBNtxOd58vkdBRnSJe2mz1IxCm1mkE_PIUNh4)
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](https://private-user-images.githubusercontent.com/134335191/240052095-2192ca86-cf8b-4b9c-acb2-e96229ef11d0.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNTQyODQsIm5iZiI6MTczOTI1Mzk4NCwicGF0aCI6Ii8xMzQzMzUxOTEvMjQwMDUyMDk1LTIxOTJjYTg2LWNmOGItNGI5Yy1hY2IyLWU5NjIyOWVmMTFkMC5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQwNjA2MjRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wYzlkYjZiODQzZTllODRhNjJhZTJhNjBkNWZhMTU1MzBlNzQ5YmUzNzFhNDFjOTc1YTFkOGU2NGUwM2MyZmNiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.Lma3EbqnGR8KWr_e1ONDjNnyb1XWNtq6QdXQTTxADuU)
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](https://private-user-images.githubusercontent.com/134335191/240052617-19823f93-849c-4e2a-bcc3-83e2bef1b3af.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNTQyODQsIm5iZiI6MTczOTI1Mzk4NCwicGF0aCI6Ii8xMzQzMzUxOTEvMjQwMDUyNjE3LTE5ODIzZjkzLTg0OWMtNGUyYS1iY2MzLTgzZTJiZWYxYjNhZi5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQwNjA2MjRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iODc2OTA1ZTZjN2FiYjAxYzk1OWY1OTYyNmU2ZDIxMjZhZTlhYWViNjQ1ODkwZTE2ODc0ODMzZTE1OGQyNjU3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.zzwc5dQ05yUtJgsVaFhvc1pbrgnv9gxLFPi6CsqQgIY)
But when running the same code but with the .h5 file that I created, the following results:
![NOxrfmap](https://private-user-images.githubusercontent.com/134335191/240053224-21d15dc6-621b-4438-9a10-5da6707701db.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNTQyODQsIm5iZiI6MTczOTI1Mzk4NCwicGF0aCI6Ii8xMzQzMzUxOTEvMjQwMDUzMjI0LTIxZDE1ZGM2LTYyMWItNDQzOC05YTEwLTVkYTY3MDc3MDFkYi5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQwNjA2MjRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iMjM3YWZmOWJmZjk2YTUxYzY5NjdlZGM4NjcyNDRiZGI0ZjEyZWExZWUxZDM3YjJmODUzYzU2MGNiZWM4NTQ3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.7Xr2y22UhBD08jn8XxIDA7nI7LKduxP9-aYo1gRFncE)
I don't know what to do but I think the problem is in the way I pass the text file to .h5
Thanks!
The text was updated successfully, but these errors were encountered: