xraypy/xraylarch

XAS viewer unresponsive

Closed this issue · 3 comments

Hi @newville,

I'm not sure what the problem is here. Recently, my XAS Viewer has been struggling to open data files.

So, I am using Windows 10. I have Larch 0.9.70 installed in my base anaconda environment with the following packages:
anaconda packages.txt.

These include
python 3.10.11
wxpython 4.2.0
pymatgen 2023.05.31
scipy 1.10.1
h5py 3.7.0
matplotlib 3.7.1

Once XAS Viewer is open, I do "File>Open Data File" and to to open some data (example data file)

The "Build Arrays from Data Columns" window pops up as normal and reads the data properly. When I choose columns for the spectrum (ff/i0), they are plotted correctly in the bottom part of the window. The reference also plots as expected (lnitiref). Once I click OK, the program becomes unresponsive. Looking at the Resource Monitor on my computer shows that python.exe has become unresponsive. Usually, at this point, I kill the program. If I wait long enough, sometimes the files will be imported, but clicking on a dataset from the list on the left side to switch the data I'm looking at makes the program unresponsive again for several seconds each time (making working with the program unfeasible).

Interestingly, this problem does not occur if I change the "Data Type" to raw while still in the "Build Arrays from Data Columns" window and then import.

Any chance you might know what's going on here? Have you seen this problem before?
Any help is greatly appreciated!

@xopherjoseph Sorry for the trouble. I think I have seen this problem and fixed it already in the master branch. I can read in this file OK, but also took this opportunity to try to make this even better (more robust).

Basically, the problem is that there is a duplicate energy point in the file. This should not be something that you have to solve -- it is not uncommon for this to happen. But when finding E0, we take a derivative, which can get confused by that. For 0.9.70, I switched to doing a smoothed derivative, but then the smoothing takes forever -- which is what you are seeing.

I made a few more changes to better check that finding E0 with the smoothed derivative does not take forever.

If you're willing to try the latest version, you should be able to install that with

python -m pip install https://millenia.cars.aps.anl.gov/xraylarch/downloads/xraylarch-latest-py3-none-any.whl

Hi @newville
Thanks a ton!! The new version behaves perfectly! And this additionally explains why the problem didn't seem to occur on the machines of some of my colleagues who are using slightly older versions of Larch

maurov commented

Fixed (e345e2e and 3712a76)