xraypy/xraylarch

Problem with export to csv

Closed this issue · 5 comments

Dear Matt,
I'm using the latest version of Larix (larch version 0.9.74). I noticed that I cannot export some processed data to csv files - especially from EXAFS. For the same file I can export normalized, flattened data but not in kspace or Rspace.

I got such error:

Could not export CSV File C:\Users\Sample1_Ni3B_Rspace.csv
Traceback (most recent calls last):
File "C:\Users\anna.wach\xraylarch\Lib\site-packages\larch\wxxas\xasgui.py", line 686, in onExportCSV
groups2csv(savegroups, outfile, x=res.xarray, y=res.yarray,
File "C:\Users\anna.wach\xraylarch\Lib\site-packages\larch\io\csvfiles.py", line 94, in groups2csv
buff.append(delim.join([gformat(s[i]) for s in columns]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\anna.wach\xraylarch\Lib\site-packages\larch\io\csvfiles.py", line 94, in
buff.append(delim.join([gformat(s[i]) for s in columns]))
~^^^
IndexError: index 392 is out of bounds for axis 0 with size 392

Any ideas why? I guess this may be a problem only on my computer.

Best,
Anna

Hi @AnnaDragonfly,

The error shows that the length of the x axis and y axis of the data is not matching.
Is there any chance that you are using "energy" as a x axis?
If so, you can specify "k" for the "X Array" when you save it. (same for R)
length of 392 corresponds to k = 19.6, which is relatively large for k space.

Hi @Ameyanagi
You're right. I was so used to Athena, that I didn't notice this.
Thanks for your prompt answer.
Best,
Anna

@AnnaDragonfly @Ameyanagi Thanks -- I was just looking at this too. I will try to fix it so that selecting "chi(k)" will change the default X-axis to "k" (and also for chi(R)). And I'll try to give a better warning.

@newville
I think it would be better to automatically select k when we choose "chi(k)" and r or q when we select the r or q space.
Thank you.

@Ameyanagi done - well, at least the easy part ;)